X-Git-Url: http://git.ipfire.org/?p=people%2Fteissler%2Fipfire-2.x.git;a=blobdiff_plain;f=html%2Fcgi-bin%2Fqos.cgi;h=5542f65309d7863e9f14489d73cde0373f6d1658;hp=26e0eef5084c815cfe67eee1860bde0e493e89a1;hb=4c7bfb1f271bdd0de493772a15209e038344e57c;hpb=ec3573fc83603317b0e9dd195426d8947a1c25f2 diff --git a/html/cgi-bin/qos.cgi b/html/cgi-bin/qos.cgi index 26e0eef50..5542f6530 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) { @@ -498,20 +497,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'} ) { @@ -657,13 +661,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 +699,7 @@ if ($errormessage) { ############################################################################################################################ ############################################################################################################################ -&Header::openbox('100%', 'center', 'Quality of Service'); +&Header::openbox('100%', 'center', ); print < @@ -710,15 +707,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 +747,11 @@ END
- -
- - -
+ +
+ + +
END ; @@ -772,10 +772,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(); @@ -796,7 +796,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'}
@@ -1123,10 +1123,10 @@ END   $Lang::tr{'source ip'}: - +   $Lang::tr{'destination ip'}: - + END @@ -1184,7 +1184,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 +1209,22 @@ sub showclasses {
- +
- +
- +
- +
@@ -1249,13 +1249,13 @@ END - +
- +
END @@ -1314,7 +1314,7 @@ END - +
@@ -1324,7 +1324,7 @@ END - +
END @@ -1372,14 +1372,14 @@ END - +
- +
END @@ -1407,17 +1407,17 @@ END
- +
- +
- +
END @@ -1433,29 +1433,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'} ) {