X-Git-Url: http://git.ipfire.org/?p=ipfire-2.x.git;a=blobdiff_plain;f=html%2Fcgi-bin%2Fqos.cgi;h=b7af11204ebd29c9cf20145e5e0c84e76cd3d567;hp=26e0eef5084c815cfe67eee1860bde0e493e89a1;hb=535dab60d61f86d78e8c6753c4d6c69bd0f3cbcc;hpb=ec3573fc83603317b0e9dd195426d8947a1c25f2 diff --git a/html/cgi-bin/qos.cgi b/html/cgi-bin/qos.cgi index 26e0eef508..b7af11204e 100644 --- a/html/cgi-bin/qos.cgi +++ b/html/cgi-bin/qos.cgi @@ -2,7 +2,7 @@ ############################################################################### # # # IPFire.org - A linux based firewall # -# Copyright (C) 2007 Michael Tremer & Christian Schmidt # +# Copyright (C) 2007-2011 IPFire Team # # # # This program is free software: you can redistribute it and/or modify # # it under the terms of the GNU General Public License as published by # @@ -73,10 +73,7 @@ $qossettings{'DEF_INC_SPD'} = ''; $qossettings{'DEFCLASS_INC'} = ''; $qossettings{'DEFCLASS_OUT'} = ''; $qossettings{'ACK'} = ''; -$qossettings{'MTU'} = '1492'; -$qossettings{'SFQ_PERTUB'} = '10'; -$qossettings{'QLENGTH'} = '30'; -$qossettings{'RED_DEV'} = `cat /var/ipfire/red/iface`; +$qossettings{'RED_DEV'} = 'ppp0'; $qossettings{'IMQ_DEV'} = 'imq0'; $qossettings{'VALID'} = 'yes'; ### Values that have to be initialized @@ -113,6 +110,8 @@ $qossettings{'TOS'} = ''; &General::readhash("${General::swroot}/qos/settings", \%qossettings); &Header::getcgihash(\%qossettings); +$qossettings{'RED_DEV'} = `cat /var/ipfire/red/iface`; + my %color = (); my %mainsettings = (); &General::readhash("${General::swroot}/main/settings", \%mainsettings); @@ -252,13 +251,13 @@ END if ($qossettings{'DOLEVEL7'} eq $Lang::tr{'save'}) { if ( $qossettings{'QIP'} ne '' ) { - unless ( &General::validip($qossettings{'QIP'}) ) { + if ((!&General::validipandmask($qossettings{'QIP'})) && (!&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'}) ) { + if ((!&General::validipandmask($qossettings{'DIP'})) && (!&General::validip($qossettings{'DIP'}))) { $qossettings{'VALID'} = 'no'; $message = $Lang::tr{'The destination IP address is invalid.'}; } @@ -327,15 +326,15 @@ END if ($qossettings{'DOPORT'} eq $Lang::tr{'save'}) { if ( $qossettings{'QIP'} ne '' ) { - unless ( &General::validip($qossettings{'QIP'}) ) { + if ((!&General::validipandmask($qossettings{'QIP'})) && (!&General::validip($qossettings{'QIP'}))) { $qossettings{'VALID'} = 'no'; - $message = "$Lang::tr{'The source IP address is invalid.'}"; + $message = $Lang::tr{'The source IP address is invalid.'}; } } if ( $qossettings{'DIP'} ne '' ) { - unless ( &General::validip($qossettings{'DIP'}) ) { + if ((!&General::validipandmask($qossettings{'DIP'})) && (!&General::validip($qossettings{'DIP'}))) { $qossettings{'VALID'} = 'no'; - $message = "$Lang::tr{'The destination IP address is invalid.'}"; + $message = $Lang::tr{'The destination IP address is invalid.'}; } } if ($qossettings{'CLASS'} >= 100 && $qossettings{'CLASS'} < 121) { @@ -464,18 +463,16 @@ if ($qossettings{'ACTION'} eq $Lang::tr{'start'}) $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{'stop'}) { - system("/usr/local/bin/qosctrl stop >/dev/null 2>&1"); - unlink "/var/ipfire/qos/bin/qos.sh"; - unlink "/var/ipfire/qos/enable"; - system("logger -t ipfire 'QoS stopped'"); $qossettings{'ENABLED'} = 'off'; &General::writehash("${General::swroot}/qos/settings", \%qossettings); + system("/usr/local/bin/qosctrl stop >/dev/null 2>&1"); + system("/usr/local/bin/qosctrl generate >/dev/null 2>&1"); + system("logger -t ipfire 'QoS stopped'"); } elsif ($qossettings{'ACTION'} eq $Lang::tr{'restart'}) { @@ -498,38 +495,39 @@ 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/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'} ) { @@ -657,13 +658,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(); @@ -702,7 +696,7 @@ if ($errormessage) { ############################################################################################################################ ############################################################################################################################ -&Header::openbox('100%', 'center', 'Quality of Service'); +&Header::openbox('100%', 'center', ); print < @@ -710,15 +704,18 @@ print <$message"; + print "$message"; } print <Quality of Service: - $status - - - - + Quality of Service: + $status + +
+ + + + + END ; if (($qossettings{'OUT_SPD'} ne '') && ($qossettings{'INC_SPD'} ne '')) { @@ -747,11 +744,11 @@ END
- -
- - -
+ +
+ + +
END ; @@ -772,11 +769,11 @@ if ( ($qossettings{'DEFCLASS_INC'} eq '') || ($qossettings{'DEFCLASS_OUT'} eq '' exit } - &Header::openbox('100%', 'center', "$qossettings{'RED_DEV'} $Lang::tr{'graph'}"); - &Graphs::makegraphbox("qos.cgi",$qossettings{'RED_DEV'},"hour","325"); + &Header::openbox('100%', 'center', "$qossettings{'RED_DEV'} $Lang::tr{'graph'}, $Lang::tr{'uplink'}"); + &Graphs::makegraphbox("qos.cgi",$qossettings{'RED_DEV'},"hour"); &Header::closebox(); - &Header::openbox('100%', 'center', "$qossettings{'IMQ_DEV'} $Lang::tr{'graph'}"); - &Graphs::makegraphbox("qos.cgi",$qossettings{'IMQ_DEV'},"hour","325"); + &Header::openbox('100%', 'center', "$qossettings{'IMQ_DEV'} $Lang::tr{'graph'}, $Lang::tr{'downlink'}"); + &Graphs::makegraphbox("qos.cgi",$qossettings{'IMQ_DEV'},"hour"); &Header::closebox(); &showclasses($qossettings{'RED_DEV'}); @@ -796,7 +793,7 @@ sub changedefclasses {
$Lang::tr{'no filter pass'} -
Download:
$Lang::tr{'download'}:  -
Upload:
$Lang::tr{'upload'}:
$Lang::tr{'guaranteed bandwith'}:   -
$Lang::tr{'max bandwith'}: +
$Lang::tr{'max bandwith'} *:  
Burst: @@ -960,8 +957,8 @@ print <$Lang::tr{'min costs'} (1)  
$Lang::tr{'remark'}: - -
  + +
* $Lang::tr{'required field'}    
@@ -1079,10 +1076,10 @@ END print <  $Lang::tr{'source ip'}: - +   $Lang::tr{'destination ip'}: - + $Lang::tr{'qos warning'} @@ -1123,10 +1120,10 @@ END   $Lang::tr{'source ip'}: - +   $Lang::tr{'destination ip'}: - + END @@ -1184,7 +1181,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'} @@ -1209,22 +1206,22 @@ sub showclasses {
- +
- +
- +
- +
@@ -1249,13 +1246,13 @@ END - +
- +
END @@ -1314,7 +1311,7 @@ END - +
@@ -1324,7 +1321,7 @@ END - +
END @@ -1372,14 +1369,14 @@ END - +
- +
END @@ -1407,17 +1404,17 @@ END
- +
- +
- +
END @@ -1433,29 +1430,6 @@ END } } } - -sub expert -{ - &Header::openbox('100%', 'center', $Lang::tr{'expertoptions'}); - print < - -
MTU: - - $Lang::tr{'mtu QoS'} -
$Lang::tr{'Queuelenght'}: - -   -
SFQ Perturb: - - -
- -END -; - &Header::closebox(); -} - sub validminbwdth { if ( $qossettings{'VALID'} eq 'yes' ) { if ( $qossettings{'DEVICE'} eq $qossettings{'RED_DEV'} ) {