X-Git-Url: http://git.ipfire.org/?p=people%2Fteissler%2Fipfire-2.x.git;a=blobdiff_plain;f=html%2Fcgi-bin%2Fqos.cgi;h=6d4d025bfdbc228283fe472127bcf3d521e61394;hp=300e6ae4515604170898a717bcadb37fa27c31ac;hb=5eee5a607e213c25b350926c5234d2230cfc6e29;hpb=d7a3254acedb43995d6a6e769562576cc7ff8639 diff --git a/html/cgi-bin/qos.cgi b/html/cgi-bin/qos.cgi index 300e6ae45..6d4d025bf 100644 --- a/html/cgi-bin/qos.cgi +++ b/html/cgi-bin/qos.cgi @@ -73,8 +73,6 @@ $qossettings{'DEF_INC_SPD'} = ''; $qossettings{'DEFCLASS_INC'} = ''; $qossettings{'DEFCLASS_OUT'} = ''; $qossettings{'ACK'} = ''; -$qossettings{'MTU'} = '1492'; -$qossettings{'QLENGTH'} = '1000'; $qossettings{'RED_DEV'} = 'ppp0'; $qossettings{'IMQ_DEV'} = 'imq0'; $qossettings{'VALID'} = 'yes'; @@ -253,15 +251,29 @@ END if ($qossettings{'DOLEVEL7'} eq $Lang::tr{'save'}) { if ( $qossettings{'QIP'} ne '' ) { - unless ( &General::validip($qossettings{'QIP'}) ) { - $qossettings{'VALID'} = 'no'; - $message = $Lang::tr{'The source IP address is invalid.'}; + if ($qossettings{'QIP'} =~ /^(.*?)\/(.*?)$/){ + if (! &General::validipandmask($qossettings{'QIP'}) ) { + $qossettings{'VALID'} = 'no'; + $message = $Lang::tr{'The source IP address is invalid.'}; + } + }else{ + if ( &General::validip($qossettings{'QIP'}) ) { + $qossettings{'VALID'} = 'no'; + $message = $Lang::tr{'The source IP address is invalid.'}; + } } } if ( $qossettings{'DIP'} ne '' ) { - unless ( &General::validip($qossettings{'DIP'}) ) { - $qossettings{'VALID'} = 'no'; - $message = $Lang::tr{'The destination IP address is invalid.'}; + if ($qossettings{'QIP'} =~ /^(.*?)\/(.*?)$/){ + if ( &General::validipandmask($qossettings{'DIP'}) ) { + $qossettings{'VALID'} = 'no'; + $message = $Lang::tr{'The destination IP address is invalid.'}; + } + }else{ + if ( &General::validip($qossettings{'DIP'}) ) { + $qossettings{'VALID'} = 'no'; + $message = $Lang::tr{'The destination IP address is invalid.'}; + } } } if ($qossettings{'CLASS'} >= 100 && $qossettings{'CLASS'} < 121) { @@ -499,20 +511,21 @@ elsif ($qossettings{'ACTION'} eq $Lang::tr{'save'}) } elsif ($qossettings{'ACTION'} eq $Lang::tr{'template'} ) { - my @UP; - #print "UP
"; - for(my $i = 1; $i <= 10; $i++) { - $UP[$i] = int($qossettings{'OUT_SPD'} / $i ); - #print $i."=".$UP[$i]." "; - } - my @DOWN; - #print "

Down
"; - for(my $i = 1; $i <= 20; $i++) { - $DOWN[$i] = int($qossettings{'INC_SPD'} / $i); - #print $i."=".$DOWN[$i]." "; - } - open( FILE, "> $classfile" ) or die "Unable to write $classfile"; - print FILE < 0) && ($qossettings{'INC_SPD'} > 0)) { + my @UP; + #print "UP
"; + for(my $i = 1; $i <= 10; $i++) { + $UP[$i] = int($qossettings{'OUT_SPD'} / $i ); + #print $i."=".$UP[$i]." "; + } + my @DOWN; + #print "

Down
"; + for(my $i = 1; $i <= 20; $i++) { + $DOWN[$i] = int($qossettings{'INC_SPD'} / $i); + #print $i."=".$DOWN[$i]." "; + } + open( FILE, "> $classfile" ) or die "Unable to write $classfile"; + print FILE < $level7file" ) or die "Unable to write $level7file"; - print FILE < $level7file" ) or die "Unable to write $level7file"; + print FILE < $portfile" ) or die "Unable to write $portfile"; - print FILE < $portfile" ) or die "Unable to write $portfile"; + print FILE </dev/null 2>&1"); + system("/usr/bin/touch /var/ipfire/qos/enable"); + system("/usr/local/bin/qosctrl start >/dev/null 2>&1"); + system("logger -t ipfire 'QoS started'"); + } else { + $message = $Lang::tr{'qos enter bandwidths'}; } - $qossettings{'DEFCLASS_INC'} = "210"; - $qossettings{'DEFCLASS_OUT'} = "110"; - $qossettings{'ACK'} ="101"; - $qossettings{'ENABLED'} = 'on'; - &General::writehash("${General::swroot}/qos/settings", \%qossettings); - system("/usr/local/bin/qosctrl generate >/dev/null 2>&1"); - system("/usr/bin/touch /var/ipfire/qos/enable"); - system("/usr/local/bin/qosctrl start >/dev/null 2>&1"); - system("logger -t ipfire 'QoS started'"); } elsif ($qossettings{'ACTION'} eq $Lang::tr{'status'} ) { @@ -659,13 +675,6 @@ END &Header::closepage(); exit } -elsif ($qossettings{'ACTION'} eq "$Lang::tr{'urlfilter advanced settings'}" ) -{ - &expert(); - &Header::closebigbox(); - &Header::closepage(); - exit -} if ($qossettings{'ACTIONBW'} eq "$Lang::tr{'modify'}" ) { &changebandwidth(); @@ -704,7 +713,7 @@ if ($errormessage) { ############################################################################################################################ ############################################################################################################################ -&Header::openbox('100%', 'center', 'Quality of Service'); +&Header::openbox('100%', 'center', ); print < @@ -712,15 +721,18 @@ print <$message"; + print "$message"; } print <Quality of Service: - $status - - - - + Quality of Service: + $status + +
+ + + + + END ; if (($qossettings{'OUT_SPD'} ne '') && ($qossettings{'INC_SPD'} ne '')) { @@ -749,11 +761,11 @@ END
- -
- - -
+ +
+ + +
END ; @@ -774,10 +786,10 @@ if ( ($qossettings{'DEFCLASS_INC'} eq '') || ($qossettings{'DEFCLASS_OUT'} eq '' exit } - &Header::openbox('100%', 'center', "$qossettings{'RED_DEV'} $Lang::tr{'graph'}"); + &Header::openbox('100%', 'center', "$qossettings{'RED_DEV'} $Lang::tr{'graph'}, $Lang::tr{'uplink'}"); &Graphs::makegraphbox("qos.cgi",$qossettings{'RED_DEV'},"hour","325"); &Header::closebox(); - &Header::openbox('100%', 'center', "$qossettings{'IMQ_DEV'} $Lang::tr{'graph'}"); + &Header::openbox('100%', 'center', "$qossettings{'IMQ_DEV'} $Lang::tr{'graph'}, $Lang::tr{'downlink'}"); &Graphs::makegraphbox("qos.cgi",$qossettings{'IMQ_DEV'},"hour","325"); &Header::closebox(); @@ -798,7 +810,7 @@ sub changedefclasses {
$Lang::tr{'no filter pass'} -
Download:
$Lang::tr{'download'}:  -
Upload:
$Lang::tr{'upload'}: 
$Lang::tr{'source ip'}: - +  
$Lang::tr{'destination ip'}: - +
$Lang::tr{'qos warning'}
@@ -1125,10 +1137,10 @@ END   $Lang::tr{'source ip'}: - +   $Lang::tr{'destination ip'}: - + END @@ -1186,7 +1198,7 @@ sub showclasses { @classline = split( /\;/, $classentry ); if ( $classline[0] eq $qossettings{'DEV'} ) { - &Header::openbox('100%', 'center', "$Lang::tr{'Class'}: $classline[1]"); + &Header::openbox('100%', 'center', "$Lang::tr{'Class'}: $classline[1] $classline[8]"); print < $Lang::tr{'interface'} @@ -1211,22 +1223,22 @@ sub showclasses {
- +
- +
- +
- +
@@ -1251,13 +1263,13 @@ END - +
- +
END @@ -1316,7 +1328,7 @@ END - +
@@ -1326,7 +1338,7 @@ END - +
END @@ -1374,14 +1386,14 @@ END - +
- +
END @@ -1409,17 +1421,17 @@ END
- +
- +
- +
END @@ -1435,26 +1447,6 @@ END } } } - -sub expert -{ - &Header::openbox('100%', 'center', $Lang::tr{'expertoptions'}); - print < - -
MTU: - - $Lang::tr{'mtu QoS'} -
$Lang::tr{'Queuelenght'}: - - -
- -END -; - &Header::closebox(); -} - sub validminbwdth { if ( $qossettings{'VALID'} eq 'yes' ) { if ( $qossettings{'DEVICE'} eq $qossettings{'RED_DEV'} ) {