]>
git.ipfire.org Git - ipfire-2.x.git/blob - html/cgi-bin/qos.cgi
2 ###############################################################################
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2007-2022 IPFire Team <info@ipfire.org> #
7 # This program is free software: you can redistribute it and/or modify #
8 # it under the terms of the GNU General Public License as published by #
9 # the Free Software Foundation, either version 3 of the License, or #
10 # (at your option) any later version. #
12 # This program is distributed in the hope that it will be useful, #
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15 # GNU General Public License for more details. #
17 # You should have received a copy of the GNU General Public License #
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
20 ###############################################################################
24 # enable only the following on debugging purpose
26 # use CGI::Carp 'fatalsToBrowser';
28 require '/var/ipfire/general-functions.pl';
29 require "${General::swroot}/lang.pl";
30 require "${General::swroot}/header.pl";
31 require "${General::swroot}/graphs.pl";
37 my $errormessage = "";
42 my $portruleentry = "";
43 my $tosruleentry = "";
52 my @portruleline = ();
57 my $classfile = "/var/ipfire/qos/classes";
58 my $level7file = "/var/ipfire/qos/level7config";
59 my $portfile = "/var/ipfire/qos/portconfig";
60 my $tosfile = "/var/ipfire/qos/tosconfig";
61 &General
::readhash
("${General::swroot}/ethernet/settings", \
%netsettings);
63 $qossettings{'ENABLED'} = 'off';
64 $qossettings{'EDIT'} = 'no';
65 $qossettings{'OUT_SPD'} = '';
66 $qossettings{'INC_SPD'} = '';
67 $qossettings{'DEF_OUT_SPD'} = '';
68 $qossettings{'DEF_INC_SPD'} = '';
69 $qossettings{'DEFCLASS_INC'} = '';
70 $qossettings{'DEFCLASS_OUT'} = '';
71 $qossettings{'RED_DEV'} = 'ppp0';
72 $qossettings{'IMQ_DEV'} = 'imq0';
73 $qossettings{'VALID'} = 'yes';
74 ### Values that have to be initialized
75 $qossettings{'ACTION'} = '';
76 $qossettings{'ACTIONDEF'} = '';
77 $qossettings{'ACTIONBW'} = '';
78 $qossettings{'RED_DEV_SEL'} = '';
79 $qossettings{'IMQ_DEV_SEL'} = '';
80 $qossettings{'PRIO'} = '';
81 $qossettings{'SPD'} = '';
82 $qossettings{'CLASS'} = '';
83 $qossettings{'QPORT'} = '';
84 $qossettings{'DPORT'} = '';
85 $qossettings{'QIP'} = '';
86 $qossettings{'DIP'} = '';
87 $qossettings{'PPROT'} = '';
88 $qossettings{'L7PROT'} = '';
89 $qossettings{'DEVICE'} = '';
90 $qossettings{'MINBWDTH'} = '';
91 $qossettings{'MAXBWDTH'} = '';
92 $qossettings{'BURST'} = '';
93 $qossettings{'CBURST'} = '';
94 $qossettings{'DOCLASS'} = '';
95 $qossettings{'DOLEVEL7'} = '';
96 $qossettings{'DOPORT'} = '';
97 $qossettings{'CLASS'} = '';
98 $qossettings{'CLASSPRFX'} = '';
99 $qossettings{'DEV'} = '';
100 $qossettings{'TOS'} = '';
101 $qossettings{'CAKE_PROFILE'} = 'conservative';
103 my %CAKE_PROFILES = (
104 "ethernet" => $Lang::tr
{'cake profile ethernet 38'},
105 "ethernet ether-vlan" => $Lang::tr
{'cake profile ethernet vlan 42'},
106 "raw" => $Lang::tr
{'cake profile raw 0'},
107 "conservative" => $Lang::tr
{'cake profile conservative 48'},
108 "docsis" => $Lang::tr
{'cake profile docsis 18'},
109 "bridged-ptm" => $Lang::tr
{'cake profile bridged-ptm 19'},
110 "pppoe-ptm" => $Lang::tr
{'cake profile pppoe-ptm 27'},
111 "pppoe-llcsnap" => $Lang::tr
{'cake profile pppoe-llcsnap 40'},
112 "pppoe-vcmux" => $Lang::tr
{'cake profile pppoe-vcmux 32'},
113 "pppoa-llc" => $Lang::tr
{'cake profile pppoa-llc 14'},
114 "pppoa-vcmux" => $Lang::tr
{'cake profile pppoa-vcmux 10'},
115 "bridged-llcsnap" => $Lang::tr
{'cake profile bridged-llcsnap 32'},
116 "bridged-vcmux" => $Lang::tr
{'cake profile bridged-vcmux 24'},
117 "ipoa-llcsnap" => $Lang::tr
{'cake profile ipoa-llcsnap 16'},
118 "ipoa-vcmux" => $Lang::tr
{'cake profile ipoa-vcmux 8'},
121 &General
::readhash
("${General::swroot}/qos/settings", \
%qossettings);
122 &Header
::getcgihash
(\
%qossettings);
124 $qossettings{'RED_DEV'} = &General
::get_red_interface
();
127 my %mainsettings = ();
128 &General
::readhash
("${General::swroot}/main/settings", \
%mainsettings);
129 &General
::readhash
("/srv/web/ipfire/html/themes/ipfire/include/colors.txt", \
%color);
131 $selected{'CAKE_PROFILE'} = ();
132 foreach my $key (keys %CAKE_PROFILES) {
133 $selected{'CAKE_PROFILE'}{$key} = '';
135 $selected{'CAKE_PROFILE'}{$qossettings{'CAKE_PROFILE'}} = 'selected';
137 &Header
::showhttpheaders
();
139 &Header
::openpage
('QoS', 1, '');
140 &Header
::openbigbox
('100%', 'left', '', $errormessage);
142 ############################################################################################################################
143 ############################################################################################################################
145 if ($qossettings{'DOCLASS'} eq $Lang::tr
{'save'})
150 if ( $qossettings{'VALID'} eq 'yes' ) {
151 open( FILE
, ">> $classfile" ) or die "Unable to write $classfile";
153 $qossettings{'DEVICE'};$qossettings{'CLASS'};$qossettings{'PRIO'};$qossettings{'MINBWDTH'};$qossettings{'MAXBWDTH'};$qossettings{'BURST'};$qossettings{'CBURST'};$qossettings{'TOS'};$qossettings{'REMARK'};
158 $qossettings{'ACTION'} = $Lang::tr
{'parentclass add'};
161 elsif ($qossettings{'DOCLASS'} eq $Lang::tr
{'edit'})
163 open( FILE
, "< $classfile" ) or die "Unable to read $classfile";
166 open( FILE
, "> $classfile" ) or die "Unable to write $classfile";
167 foreach $classentry (sort @classes)
169 @classline = split( /\;/, $classentry );
170 if ( $classline[1] ne $qossettings{'CLASS'} ) {
171 print FILE
$classentry;
173 $qossettings{'DEVICE'} = $classline[0];
174 $qossettings{'PRIO'} = $classline[2];
175 $qossettings{'MINBWDTH'} = $classline[3];
176 $qossettings{'MAXBWDTH'} = $classline[4];
177 $qossettings{'BURST'} = $classline[5];
178 $qossettings{'CBURST'} = $classline[6];
179 $qossettings{'TOS'} = $classline[7];
180 $qossettings{'REMARK'} = $classline[8];
181 $qossettings{'EDIT'} = 'yes';
186 &Header
::closebigbox
();
187 &Header
::closepage
();
190 elsif ($qossettings{'DOCLASS'} eq $Lang::tr
{'delete'})
192 open( FILE
, "< $classfile" ) or die "Unable to read $classfile";
195 open( FILE
, "> $classfile" ) or die "Unable to write $classfile";
196 foreach $classentry (sort @tmp)
198 @tmpline = split( /\;/, $classentry );
199 if ( $tmpline[1] ne $qossettings{'CLASS'} )
201 print FILE
$classentry;
205 $message = "$Lang::tr{'Class'} $qossettings{'CLASS'} $Lang::tr{'Class was deleted'}";
208 ############################################################################################################################
209 ############################################################################################################################
211 if ($qossettings{'DOLEVEL7'} eq $Lang::tr
{'save'})
213 if ( $qossettings{'QIP'} ne '' ) {
214 if ((!&General
::validipandmask
($qossettings{'QIP'})) && (!&General
::validip
($qossettings{'QIP'}))) {
215 $qossettings{'VALID'} = 'no';
216 $message = $Lang::tr
{'The source IP address is invalid.'};
219 if ( $qossettings{'DIP'} ne '' ) {
220 if ((!&General
::validipandmask
($qossettings{'DIP'})) && (!&General
::validip
($qossettings{'DIP'}))) {
221 $qossettings{'VALID'} = 'no';
222 $message = $Lang::tr
{'The destination IP address is invalid.'};
225 if ($qossettings{'CLASS'} >= 100 && $qossettings{'CLASS'} < 121) {
226 $qossettings{'DEVICE'} = $qossettings{'RED_DEV'};
227 } elsif ($qossettings{'CLASS'} >= 1000 && $qossettings{'CLASS'} < 1021) {
228 $qossettings{'DEVICE'} = $qossettings{'RED_DEV'};
229 } elsif ($qossettings{'CLASS'} >= 200 && $qossettings{'CLASS'} < 221) {
230 $qossettings{'DEVICE'} = $qossettings{'IMQ_DEV'};
231 } elsif ($qossettings{'CLASS'} >= 2000 && $qossettings{'CLASS'} < 2021) {
232 $qossettings{'DEVICE'} = $qossettings{'IMQ_DEV'};
234 if ( $qossettings{'VALID'} eq 'yes' ) {
235 open( FILE
, ">> $level7file" ) or die "Unable to write $level7file";
237 $qossettings{'CLASS'};$qossettings{'DEVICE'};$qossettings{'L7PROT'};$qossettings{'QIP'};$qossettings{'DIP'};
242 $qossettings{'ACTION'} = $Lang::tr
{'Add Level7 rule'};
244 } elsif ($qossettings{'DOLEVEL7'} eq $Lang::tr
{'delete'})
246 open( FILE
, "< $level7file" ) or die "Unable to read $level7file";
249 &General
::system("rm", "$level7file");
250 foreach $l7ruleentry (sort @l7rules)
252 @l7ruleline = split( /\;/, $l7ruleentry );
253 if ( ($l7ruleline[0] eq $qossettings{'CLASS'}) && ($l7ruleline[2] eq $qossettings{'L7PROT'}))
254 {$message = "$Lang::tr{'Level7 Rule'} ($qossettings{'CLASS'} - $qossettings{'L7PROT'}) $Lang::tr{'was deleted'}.";}
256 { open( FILE
, ">> $level7file" ) or die "Unable to read $level7file";
257 print FILE
$l7ruleentry;
261 open( FILE
, "< $level7file" ) or &General
::system("touch", "$level7file");close FILE
;
262 } elsif ($qossettings{'DOLEVEL7'} eq $Lang::tr
{'edit'})
264 open( FILE
, "< $level7file" ) or die "Unable to read $level7file";
267 &General
::system("rm", "$level7file");
268 foreach $l7ruleentry (sort @l7rules)
270 @l7ruleline = split( /\;/, $l7ruleentry );
271 if ( ($l7ruleline[0] eq $qossettings{'CLASS'}) && ($l7ruleline[2] eq $qossettings{'L7PROT'}))
272 {$qossettings{'QIP'} = $l7ruleline[3];$qossettings{'DIP'} = $l7ruleline[4];}
274 open( FILE
, ">> $level7file" ) or die "Unable to write $level7file";
275 print FILE
$l7ruleentry;
280 open( FILE
, "< $level7file" ) or &General
::system("touch", "$level7file");close FILE
;
283 ############################################################################################################################
284 ############################################################################################################################
286 if ($qossettings{'DOPORT'} eq $Lang::tr
{'save'})
288 if ( $qossettings{'QIP'} ne '' ) {
289 if ((!&General
::validipandmask
($qossettings{'QIP'})) && (!&General
::validip
($qossettings{'QIP'}))) {
290 $qossettings{'VALID'} = 'no';
291 $message = $Lang::tr
{'The source IP address is invalid.'};
294 if ( $qossettings{'DIP'} ne '' ) {
295 if ((!&General
::validipandmask
($qossettings{'DIP'})) && (!&General
::validip
($qossettings{'DIP'}))) {
296 $qossettings{'VALID'} = 'no';
297 $message = $Lang::tr
{'The destination IP address is invalid.'};
300 if ($qossettings{'CLASS'} >= 100 && $qossettings{'CLASS'} < 121) {
301 $qossettings{'DEVICE'} = $qossettings{'RED_DEV'};
302 } elsif ($qossettings{'CLASS'} >= 1000 && $qossettings{'CLASS'} < 1021) {
303 $qossettings{'DEVICE'} = $qossettings{'RED_DEV'};
304 } elsif ($qossettings{'CLASS'} >= 200 && $qossettings{'CLASS'} < 221) {
305 $qossettings{'DEVICE'} = $qossettings{'IMQ_DEV'};
306 } elsif ($qossettings{'CLASS'} >= 2000 && $qossettings{'CLASS'} < 2021) {
307 $qossettings{'DEVICE'} = $qossettings{'IMQ_DEV'};
309 if ( $qossettings{'VALID'} eq 'yes' ) {
310 open( FILE
, ">> $portfile" ) or die "Unable to write $portfile";
312 $qossettings{'CLASS'};$qossettings{'DEVICE'};$qossettings{'PPROT'};$qossettings{'QIP'};$qossettings{'QPORT'};$qossettings{'DIP'};$qossettings{'DPORT'};
317 $qossettings{'ACTION'} = $Lang::tr
{'Add Port Rule'};
319 } elsif ($qossettings{'DOPORT'} eq $Lang::tr
{'delete'})
321 open( FILE
, "< $portfile" ) or die "Unable to read $portfile";
324 open( FILE
, "> $portfile" ) or die "Unable to read $portfile";
325 foreach $portruleentry (sort @portrules)
327 @portruleline = split( /\;/, $portruleentry );
328 unless ( ($portruleline[0] eq $qossettings{'CLASS'}) && ($portruleline[2] eq $qossettings{'PPROT'}) && ($portruleline[3] eq $qossettings{'QIP'}) && ($portruleline[4] eq $qossettings{'QPORT'}) && ($portruleline[5] eq $qossettings{'DIP'}) && ($portruleline[6] eq $qossettings{'DPORT'}))
330 print FILE
$portruleentry;
334 $message = "$Lang::tr{'Port Rule'} ($qossettings{'CLASS'} - $qossettings{'PPROT'}) $Lang::tr{'was deleted'}.";
335 } elsif ($qossettings{'DOPORT'} eq $Lang::tr
{'edit'})
337 open( FILE
, "< $portfile" ) or die "Unable to read $portfile";
340 &General
::system("rm", "$portfile");
341 foreach $portruleentry (sort @portrules)
343 @portruleline = split( /\;/, $portruleentry );
344 if ( ($portruleline[0] eq $qossettings{'CLASS'}) && ($portruleline[2] eq $qossettings{'PPROT'}) && ($portruleline[3] eq $qossettings{'QIP'}) && ($portruleline[4] eq $qossettings{'QPORT'}) && ($portruleline[5] eq $qossettings{'DIP'}) && ($portruleline[6] eq $qossettings{'DPORT'}))
345 {$qossettings{'CLASS'}=$portruleline[0];$qossettings{'PPROT'}=$portruleline[2];$qossettings{'QIP'}=$portruleline[3];$qossettings{'QPORT'}=$portruleline[4];$qossettings{'DIP'}=$portruleline[5];$qossettings{'DPORT'}=$portruleline[6];}
347 open( FILE
, ">> $portfile" ) or die "Unable to write $portfile";
348 print FILE
$portruleentry;
353 open( FILE
, "< $portfile" ) or &General
::system("touch", "$portfile");close FILE
;
356 ############################################################################################################################
357 ############################################################################################################################
359 if ($qossettings{'DOTOS'} eq $Lang::tr
{'save'})
361 if ($qossettings{'CLASS'} >= 100 && $qossettings{'CLASS'} < 121) {
362 $qossettings{'DEVICE'} = $qossettings{'RED_DEV'};
363 } elsif ($qossettings{'CLASS'} >= 1000 && $qossettings{'CLASS'} < 1021) {
364 $qossettings{'DEVICE'} = $qossettings{'RED_DEV'};
365 } elsif ($qossettings{'CLASS'} >= 200 && $qossettings{'CLASS'} < 221) {
366 $qossettings{'DEVICE'} = $qossettings{'IMQ_DEV'};
367 } elsif ($qossettings{'CLASS'} >= 2000 && $qossettings{'CLASS'} < 2021) {
368 $qossettings{'DEVICE'} = $qossettings{'IMQ_DEV'};
370 open( FILE
, ">> $tosfile" ) or die "Unable to write $tosfile";
372 $qossettings{'CLASS'};$qossettings{'DEVICE'};$qossettings{'TOS'};
377 elsif ($qossettings{'DOTOS'} eq $Lang::tr
{'delete'})
379 open( FILE
, "< $tosfile" ) or die "Unable to read $tosfile";
382 open( FILE
, "> $tosfile" ) or die "Unable to read $tosfile";
383 foreach $tosruleentry (sort @tosrules)
385 @tosruleline = split( /\;/, $tosruleentry );
386 unless ( ($tosruleline[0] eq $qossettings{'CLASS'}) && ($tosruleline[2] eq $qossettings{'TOS'}))
388 print FILE
$tosruleentry;
392 $message = "$Lang::tr{'TOS Rule'} ($qossettings{'CLASS'} - $qossettings{'TOS'}) $Lang::tr{'was deleted'}.";
393 } elsif ($qossettings{'DOTOS'} eq $Lang::tr
{'edit'})
395 open( FILE
, "< $tosfile" ) or die "Unable to read $tosfile";
398 open( FILE
, "> $tosfile" ) or die "Unable to write $tosfile";
399 foreach $tosruleentry (sort @tosrules)
401 @tosruleline = split( /\;/, $tosruleentry );
402 if (( $tosruleline[0] eq $qossettings{'CLASS'} ) && ( $tosruleline[2] eq $qossettings{'TOS'} )) {
403 $qossettings{'DEVICE'} = $tosruleline[1];
404 $qossettings{'CLASS'} = $tosruleline[0];
405 $qossettings{'TOS'} = $tosruleline[2];
406 $qossettings{'EDIT'} = 'yes';
408 print FILE
$tosruleentry;
413 &Header
::closebigbox
();
414 &Header
::closepage
();
418 ############################################################################################################################
419 ############################################################################################################################
421 if ($qossettings{'ACTION'} eq $Lang::tr
{'start'})
423 $qossettings{'ENABLED'} = 'on';
424 &General
::writehash
("${General::swroot}/qos/settings", \
%qossettings);
425 &General
::system("/usr/local/bin/qosctrl", "generate");
426 &General
::system("/usr/local/bin/qosctrl", "start");
427 &General
::system("logger", "-t", "ipfire", "QoS started");
429 elsif ($qossettings{'ACTION'} eq $Lang::tr
{'stop'})
431 $qossettings{'ENABLED'} = 'off';
432 &General
::writehash
("${General::swroot}/qos/settings", \
%qossettings);
433 &General
::system("/usr/local/bin/qosctrl", "stop");
434 &General
::system("/usr/local/bin/qosctrl", "generate");
435 &General
::system("logger", "-t", "ipfire", "QoS stopped");
437 elsif ($qossettings{'ACTION'} eq $Lang::tr
{'restart'})
439 if ($qossettings{'ENABLED'} eq 'on'){
440 &General
::system("/usr/local/bin/qosctrl", "stop");
441 &General
::system("/usr/local/bin/qosctrl", "generate");
442 &General
::system("/usr/local/bin/qosctrl", "start");
443 &General
::system("logger", "-t", "ipfire", "QoS restarted");
446 elsif ($qossettings{'ACTION'} eq $Lang::tr
{'save'})
448 if ($qossettings{'DEF_INC_SPD'} eq '') {
449 $qossettings{'DEF_INC_SPD'} = int($qossettings{'INC_SPD'} * 0.9);
451 if ($qossettings{'DEF_OUT_SPD'} eq '') {
452 $qossettings{'DEF_OUT_SPD'} = int($qossettings{'OUT_SPD'} * 0.9);
454 &General
::writehash
("${General::swroot}/qos/settings", \
%qossettings);
456 elsif ($qossettings{'ACTION'} eq $Lang::tr
{'template'} )
458 if (($qossettings{'OUT_SPD'} > 0) && ($qossettings{'INC_SPD'} > 0)) {
461 for(my $i = 1; $i <= 10; $i++) {
462 $UP[$i] = int($qossettings{'OUT_SPD'} / $i );
463 #print $i."=".$UP[$i]." ";
466 #print "<br /><br />Down<br />";
467 for(my $i = 1; $i <= 20; $i++) {
468 $DOWN[$i] = int($qossettings{'INC_SPD'} / $i);
469 #print $i."=".$DOWN[$i]." ";
471 open( FILE
, "> $classfile" ) or die "Unable to write $classfile";
473 imq0;200;1;$DOWN[20];$DOWN[1];;;8;VoIP;
474 imq0;203;4;$DOWN[20];$DOWN[1];;;0;VPN;
475 imq0;204;5;$DOWN[20];$DOWN[1];;;8;Webtraffic;
476 imq0;210;6;1;$DOWN[1];;;0;Default;
477 imq0;220;7;1;$DOWN[1];;;1;P2P;
478 $qossettings{'RED_DEV'};101;1;$UP[10];$UP[1];;;8;ACKs;
479 $qossettings{'RED_DEV'};102;2;$UP[10];$UP[1];;;8;VoIP;
480 $qossettings{'RED_DEV'};103;4;$UP[10];$UP[1];;;2;VPN;
481 $qossettings{'RED_DEV'};104;5;$UP[10];$UP[1];;;8;Webtraffic;
482 $qossettings{'RED_DEV'};110;6;1;$UP[1];;;0;Default;
483 $qossettings{'RED_DEV'};120;7;1;$UP[1];;;1;P2P;
487 open( FILE
, "> $level7file" ) or die "Unable to write $level7file";
489 102;$qossettings{'RED_DEV'};dns;;;
490 102;$qossettings{'RED_DEV'};rtp;;;
491 102;$qossettings{'RED_DEV'};skypetoskype;;;
492 103;$qossettings{'RED_DEV'};ssh;;;
493 103;$qossettings{'RED_DEV'};rdp;;;
494 104;$qossettings{'RED_DEV'};http;;;
495 104;$qossettings{'RED_DEV'};ssl;;;
496 104;$qossettings{'RED_DEV'};pop3;;;
497 120;$qossettings{'RED_DEV'};applejuice;;;
498 120;$qossettings{'RED_DEV'};bittorrent;;;
500 200;imq0;skypetoskype;;;
506 220;imq0;applejuice;;;
507 220;imq0;bittorrent;;;
511 open( FILE
, "> $portfile" ) or die "Unable to write $portfile";
513 101;$qossettings{'RED_DEV'};icmp;;;;;
514 102;$qossettings{'RED_DEV'};tcp;;;;53;
515 102;$qossettings{'RED_DEV'};udp;;;;53;
516 103;$qossettings{'RED_DEV'};esp;;;;;
517 103;$qossettings{'RED_DEV'};tcp;;1194;;;
518 103;$qossettings{'RED_DEV'};udp;;1194;;;
519 103;$qossettings{'RED_DEV'};tcp;;;;1194;
520 103;$qossettings{'RED_DEV'};udp;;;;1194;
521 103;$qossettings{'RED_DEV'};udp;;4500;;4500;
522 103;$qossettings{'RED_DEV'};udp;;500;;500;
523 104;$qossettings{'RED_DEV'};tcp;;;;80;
526 203;imq0;tcp;;;;1194;
527 203;imq0;udp;;;;1194;
528 203;imq0;tcp;;1194;;;
529 203;imq0;udp;;1194;;;
530 203;imq0;udp;;4500;;4500;
531 203;imq0;udp;;500;;500;
536 if ($qossettings{'DEF_INC_SPD'} eq '') {
537 $qossettings{'DEF_INC_SPD'} = int($qossettings{'INC_SPD'} * 0.9);
539 if ($qossettings{'DEF_OUT_SPD'} eq '') {
540 $qossettings{'DEF_OUT_SPD'} = int($qossettings{'OUT_SPD'} * 0.9);
542 $qossettings{'DEFCLASS_INC'} = "210";
543 $qossettings{'DEFCLASS_OUT'} = "110";
544 $qossettings{'ENABLED'} = 'on';
545 &General
::writehash
("${General::swroot}/qos/settings", \
%qossettings);
546 &General
::system("/usr/local/bin/qosctrl", "generate");
547 &General
::system("/usr/local/bin/qosctrl", "start");
548 &General
::system("logger", "-t", "ipfire", "QoS started");
550 $message = $Lang::tr
{'qos enter bandwidths'};
553 elsif ($qossettings{'ACTION'} eq $Lang::tr
{'status'} )
555 &Header
::openbox
('100%', 'left', 'QoS Status');
556 if ($qossettings{'ENABLED'} eq 'on'){
558 my @output = &General
::system_output
("/usr/local/bin/qosctrl", "status");
559 $output = &Header
::cleanhtml
(join("", @output), "y");
560 print "<pre>$output</pre>\n";
561 } else { print "$Lang::tr{'QoS not enabled'}"; }
563 &Header
::closebigbox
();
564 &Header
::closepage
();
567 elsif ($qossettings{'ACTION'} eq $Lang::tr
{'parentclass add'} )
570 &Header
::closebigbox
();
571 &Header
::closepage
();
574 elsif ($qossettings{'ACTION'} eq $Lang::tr
{'Add Rule'})
576 &Header
::openbox
('100%', 'center', $Lang::tr
{'Add Rule'});
579 <tr><td align='center'>$Lang::tr{'Choose Rule'}
580 <tr><td align='center'>
581 <input type="button" onClick="swapVisibility('l7rule')" value='$Lang::tr{'Level7 Rule'}' />
582 <input type="button" onClick="swapVisibility('portrule')" value='$Lang::tr{'Port Rule'}' />
583 <input type="button" onClick="swapVisibility('tosrule')" value='$Lang::tr{'TOS rule'}' />
589 <div id='l7rule' style='display: none'>
595 <div id='portrule' style='display: none'>
601 <div id='tosrule' style='display: none'>
609 &Header
::closebigbox
();
610 &Header
::closepage
();
613 if ($qossettings{'ACTIONBW'} eq "$Lang::tr{'modify'}" )
616 &Header
::closebigbox
();
617 &Header
::closepage
();
620 if ($qossettings{'ACTIONDEF'} eq "$Lang::tr{'modify'}" )
623 &Header
::closebigbox
();
624 &Header
::closepage
();
628 &General
::readhash
("${General::swroot}/qos/settings", \
%qossettings);
630 my $status = $Lang::tr
{'stopped'};
631 my $statuscolor = '#993333';
632 if ( $qossettings{'ENABLED'} eq 'on' ) {
633 $status = $Lang::tr
{'running'};
634 $statuscolor = '#339933';
637 if ( $netsettings{'RED_TYPE'} ne 'PPPOE' ) {
638 $qossettings{'RED_DEV'} = $netsettings{'RED_DEV'};
642 &Header
::openbox
('100%', 'left', $Lang::tr
{'error messages'});
643 print "<class name='base'>$errormessage\n";
644 print " </class>\n";
648 ############################################################################################################################
649 ############################################################################################################################
651 &Header
::openbox
('100%', 'center', );
654 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
658 if ( $message ne "" ) {
659 print "<tr><td colspan='2' align='center'><font color='red'>$message</font></tr>";
662 <tr><td width='50%' align='left'><b>Quality of Service:</b></td>
663 <td width='50%' align='center' bgcolor='$statuscolor'><font color='white'>$status</font></td></tr>
665 <td colspan='2'><br></td>
667 <tr><td width='100%' align='right' colspan='2'>
668 <input type='submit' name='ACTION' value="$Lang::tr{'start'}">
669 <input type='submit' name='ACTION' value="$Lang::tr{'stop'}">
670 <input type='submit' name='ACTION' value="$Lang::tr{'restart'}" ></td></tr></table></form>
673 if (($qossettings{'OUT_SPD'} ne '') && ($qossettings{'INC_SPD'} ne '')) {
675 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
677 <tr><td colspan='3'>
678 <tr><td width='50%' align='right'>$Lang::tr{'downlink speed'}: <td width='30%' align='left'>$qossettings{'INC_SPD'}
679 <td width='20%' rowspan='2' align='center' valign='middle'><input type='submit' name='ACTIONBW' value='$Lang::tr{'modify'}' />
680 <tr><td width='50%' align='right'>$Lang::tr{'uplink speed'}: <td width='30%' align='left'>$qossettings{'OUT_SPD'}
685 if (($qossettings{'DEFCLASS_OUT'} ne '') && ($qossettings{'DEFCLASS_INC'} ne '')) {
687 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
689 <tr><td colspan='3'><hr />
690 <tr><td width='50%' align='right'>$Lang::tr{'downlink std class'}: <td width='30%' align='left'>$qossettings{'DEFCLASS_INC'}
691 <td width='20%' rowspan='3' align='center' valign='middle'><input type='submit' name='ACTIONDEF' value='$Lang::tr{'modify'}' />
692 <tr><td width='50%' align='right'>$Lang::tr{'uplink std class'}: <td width='30%' align='left'>$qossettings{'DEFCLASS_OUT'}
693 <tr><td colspan='3' width='100%'><hr />
694 <tr><td colspan='3' width='100%' align='center'>
697 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
698 <table width='66%' border='0'>
699 <tr><td width='100%' align='center'>
700 <input type='submit' name='ACTION' value='$Lang::tr{'parentclass add'}' />
701 <input type='submit' name='ACTION' value='$Lang::tr{'status'}' />
709 if ( ($qossettings{'OUT_SPD'} eq '') || ($qossettings{'INC_SPD'} eq '') ) {
711 &Header
::closebigbox
();
712 &Header
::closepage
();
716 if ( ($qossettings{'DEFCLASS_INC'} eq '') || ($qossettings{'DEFCLASS_OUT'} eq '') ) {
718 &Header
::closebigbox
();
719 &Header
::closepage
();
723 &Header
::openbox
('100%', 'center', "$qossettings{'RED_DEV'} $Lang::tr{'graph'}, $Lang::tr{'uplink'}");
724 &Graphs
::makegraphbox
("qos.cgi",$qossettings{'RED_DEV'},"hour");
726 &Header
::openbox
('100%', 'center', "$qossettings{'IMQ_DEV'} $Lang::tr{'graph'}, $Lang::tr{'downlink'}");
727 &Graphs
::makegraphbox
("qos.cgi",$qossettings{'IMQ_DEV'},"hour");
730 &showclasses
($qossettings{'RED_DEV'});
731 &showclasses
($qossettings{'IMQ_DEV'});
733 &Header
::closebigbox
();
734 &Header
::closepage
();
736 ############################################################################################################################
737 ############################################################################################################################
739 sub changedefclasses
{
740 &Header
::openbox
('100%', 'center', $Lang::tr
{'std classes'});
742 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
744 <tr><td width='100%' colspan='3'>$Lang::tr{'no filter pass'}
745 <tr><td width='33%' align='right'>$Lang::tr{'download'}:<td width='33%' align='left'><select name='DEFCLASS_INC'>
748 for ( $c = 200 ; $c <= 220 ; $c++ )
750 if ( $qossettings{'DEFCLASS_INC'} ne $c )
751 { print "<option value='$c'>$c</option>\n"; }
752 else { print "<option selected value='$c'>$c</option>\n"; }
755 </select><td width='33%' align='center'>
756 <tr><td width='33%' align='right'>$Lang::tr{'upload'}:<td width='33%' align='left'><select name='DEFCLASS_OUT'>
759 for ( $c = 100 ; $c <= 120 ; $c++ )
761 if ( $qossettings{'DEFCLASS_OUT'} ne $c )
762 { print "<option value='$c'>$c</option>\n"; }
763 else { print "<option selected value='$c'>$c</option>\n"; }
766 </select><td width='33%' align='center'><input type='submit' name='ACTION' value="$Lang::tr{'save'}" />
774 sub changebandwidth
{
775 &Header
::openbox
('100%', 'center', $Lang::tr
{'bandwidthsettings'});
777 if ($qossettings{'ENABLED'} eq 'on') {
778 print "$Lang::tr{'bandwidtherror'}";
779 print "<table width='100%'><tr><td align='center'><a href='/cgi-bin/qos.cgi'><img src='/images/back.png' alt='$Lang::tr{'back'}' title='$Lang::tr{'back'}' /></a></td></tr></table>";
782 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
783 <input type='hidden' name='DEF_OUT_SPD' value='' /><input type='hidden' name='DEF_INC_SPD' value='' />
786 <td width='100%' colspan='2'>$Lang::tr{'down and up speed'}</td>
789 <td width='50%' align='right'>$Lang::tr{'downlink speed'}:</td>
790 <td width='50%' align='left'>
791 <input type='text' name='INC_SPD' maxlength='8' value="$qossettings{'INC_SPD'}" />
795 <td width='50%' align='right'>$Lang::tr{'uplink speed'}:</td>
796 <td width='50%' align='left'>
797 <input type='text' name='OUT_SPD' maxlength='8' value="$qossettings{'OUT_SPD'}" />
802 <td colspan="2"> </td>
806 <td width='50%' align='right'>$Lang::tr{'link-layer encapsulation'}:</td>
807 <td width='50%' align='left'>
808 <select name="CAKE_PROFILE">
811 foreach my $key (sort { $CAKE_PROFILES{$a} cmp $CAKE_PROFILES{$b} } keys %CAKE_PROFILES) {
813 <option value="$key" $selected{'CAKE_PROFILE'}{$key}>$CAKE_PROFILES{$key}</option>
823 <td colspan="2"> </td>
827 <td width='100%' align='center' colspan="2">
828 <input type='submit' name='ACTION' value="$Lang::tr{'template'}" />
829 <input type='submit' name='ACTION' value="$Lang::tr{'save'}" />
830 <input type='reset' name='ACTION' value="$Lang::tr{'reset'}" />
835 <font color='red'>$Lang::tr{'template warning'}</font>
843 &Header
::openbox
('100%', 'center', $Lang::tr
{'parentclass'});
845 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
849 if ( $message ne "" ) {
850 print "<tr><td colspan='3' align='center'>$message";
852 if ( $qossettings{'EDIT'} eq 'yes' ) {
853 print "<input type='hidden' name='CLASS' value='$qossettings{'CLASS'}' />";
854 print "<input type='hidden' name='DEVICE' value='$qossettings{'DEVICE'}' />";
857 <tr><td width='100%' colspan='3'>$Lang::tr{'enter data'}
858 <tr><td width='33%' align='right'>$Lang::tr{'interface'}:
859 <td width='33%' align='left'>
862 if ( $qossettings{'EDIT'} eq 'yes' ) {
863 print "<select name='DEVICE' disabled>";
865 print "<select name='DEVICE'>";
867 if ( $qossettings{'DEVICE'} eq $qossettings{'RED_DEV'} ) {
868 $qossettings{'RED_DEV_SEL'} = 'selected';
869 } elsif ( $qossettings{'DEVICE'} eq $qossettings{'IMQ_DEV'} ) {
870 $qossettings{'IMQ_DEV_SEL'} = 'selected';
873 <option value='$qossettings{'RED_DEV'}' $qossettings{'RED_DEV_SEL'}>$qossettings{'RED_DEV'}</option>
874 <option value='$qossettings{'IMQ_DEV'}' $qossettings{'IMQ_DEV_SEL'}>$qossettings{'IMQ_DEV'}</option></select>
875 <td width='33%' align='center'>
876 <tr><td width='33%' align='right'>$Lang::tr{'Class'}:<td width='33%' align='left'>
879 if ( $qossettings{'EDIT'} eq 'yes' ) {
880 print "<select name='CLASS' disabled>";
882 print "<select name='CLASS'>";
884 for ( $c = 100 ; $c <= 120 ; $c++ )
886 if ( $qossettings{'CLASS'} ne $c )
887 { print "<option value='$c'>$c</option>\n"; }
888 else { print "<option selected value='$c'>$c</option>\n"; }
890 for ( $c = 200 ; $c <= 220 ; $c++ )
892 if ( $qossettings{'CLASS'} ne $c )
893 { print "<option value='$c'>$c</option>\n"; }
894 else { print "<option selected value='$c'>$c</option>\n"; }
898 <td width='33%' align='center'>
899 <tr><td width='33%' align='right'>$Lang::tr{'priority'}:<td width='33%' align='left'><select name='PRIO'>
902 for ( $c = 1 ; $c <= 7 ; $c++ )
904 if ( $qossettings{'PRIO'} ne $c )
905 { print "<option value='$c'>$c</option>\n"; }
906 else { print "<option selected value='$c'>$c</option>\n"; }
908 if ($qossettings{'MINBWDTH'} eq "") { $qossettings{'MINBWDTH'} = "1"; }
911 <td width='33%' align='center'>
912 <tr><td width='33%' align='right'>$Lang::tr{'guaranteed bandwidth'}:
913 <td width='33%' align='left'><input type='text' size='20' name='MINBWDTH' maxlength='8' required='1' value="$qossettings{'MINBWDTH'}" />
914 <td width='33%' align='center'>
915 <tr><td width='33%' align='right'>$Lang::tr{'max bandwidth'} <img src='/blob.gif' alt='*' />:
916 <td width='33%' align='left'><input type='text' size='20' name='MAXBWDTH' maxlength='8' required='1' value="$qossettings{'MAXBWDTH'}" />
917 <td width='33%' align='center'>
918 <tr><td width='33%' align='right'>Burst:
919 <td width='33%' align='left'><input type='text' size='20' name='BURST' maxlength='8' value="$qossettings{'BURST'}" />
920 <td width='33%' align='center'>
921 <tr><td width='33%' align='right'>Ceilburst:
922 <td width='33%' align='left'><input type='text' size='20' name='CBURST' maxlength='8' value="$qossettings{'CBURST'}" />
923 <td width='33%' align='center'>
924 <tr><td width='33%' align='right'>$Lang::tr{'remark'}:
925 <td width='66%' colspan='2' align='left'><input type='text' name='REMARK' size='40' maxlength='40' value="$qossettings{'REMARK'}" />
926 <tr><td width='33%' align='right'><img src='/blob.gif' alt='*' /> $Lang::tr{'required field'}
927 <td width='33%' align='left'>
928 <td width='33%' align='center'><input type='submit' name='DOCLASS' value='$Lang::tr{'save'}' /> <input type='reset' value='$Lang::tr{'reset'}' />
936 &Header
::openbox
('100%', 'center', $Lang::tr
{'Level7 Rule'});
938 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
942 if ( $message ne "" ) {
943 print "<tr><td colspan='3' align='center'><font color='red'>$message</font>";
946 <tr><td colspan='3' width='100%'>$Lang::tr{'current class'}: $qossettings{'CLASS'}
947 <tr><td width='100%' colspan='3'>$Lang::tr{'enter data'}
948 <tr><td width='33%' align='right'>$Lang::tr{'protocol'}:
949 <td width='33%' align='left'><select name='L7PROT'>
952 opendir( DIR
, "/etc/l7-protocols/protocols" );
953 foreach $direntry ( sort readdir(DIR
) )
955 next if $direntry eq ".";
956 next if $direntry eq "..";
957 next if -d
"/etc/l7-protocols/protocols/$direntry";
958 @proto = split( /\./, $direntry );
959 if ( $proto[0] eq $qossettings{'L7PROT'} ) {
960 print "<option value='$proto[0]' selected>$proto[0]</option>\n";
962 print "<option value='$proto[0]'>$proto[0]</option>\n";
967 </select><td width='33%' align='center'>
968 <tr><td width='33%' align='right'>$Lang::tr{'source ip'}:
969 <td width='33%' align='left'><input type='text' name='QIP' maxlength='31' value='$qossettings{'QIP'}' />
970 <td width='33%' align='center'>
971 <tr><td width='33%' align='right'>$Lang::tr{'destination ip'}:
972 <td width='33%' align='left'><input type='text' name='DIP' maxlength='31' value='$qossettings{'DIP'}' />
973 <td width='33%' align='center'><input type='hidden' name='CLASS' value='$qossettings{'CLASS'}' /><input type='submit' name='DOLEVEL7' value='$Lang::tr{'save'}' />
974 <tr><td colspan="3" align='center'><font color="red"><em>$Lang::tr{'qos warning'}</em></font>
982 &Header
::openbox
('100%', 'center', $Lang::tr
{'Add Port Rule'});
984 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
986 <tr><td width='100%' colspan='3'>$Lang::tr{'enter data'}
987 <tr><td width='33%' align='right'>$Lang::tr{'protocol'}:
988 <td width='33%' align='left'><select name='PPROT'>
991 open( FILE
, "< /etc/protocols" );
994 foreach $direntry (sort @proto)
996 @tmpline = split( /\ /, $direntry );
997 next if $tmpline[0] =~ "#";
998 if ( $tmpline[0] eq $qossettings{'PPROT'} ) {
999 print "<option value='$tmpline[0]' selected>$tmpline[0]</option>\n";
1001 print "<option value='$tmpline[0]'>$tmpline[0]</option>\n";
1005 </select><td width='33%' align='center'>
1006 <tr><td width='33%' align='right'>$Lang::tr{'source port'}:
1007 <td width='33%' align='left'><input type='text' name='QPORT' maxlength='11' value='$qossettings{'QPORT'}' />
1008 <td width='33%' align='center'>
1009 <tr><td width='33%' align='right'>$Lang::tr{'destination port'}:
1010 <td width='33%' align='left'><input type='text' name='DPORT' maxlength='11' value='$qossettings{'DPORT'}' />
1011 <td width='33%' align='center'>
1012 <tr><td width='33%' align='right'>$Lang::tr{'source ip'}:
1013 <td width='33%' align='left'><input type='text' name='QIP' maxlength='31' value='$qossettings{'QIP'}' />
1014 <td width='33%' align='center'>
1015 <tr><td width='33%' align='right'>$Lang::tr{'destination ip'}:
1016 <td width='33%' align='left'><input type='text' name='DIP' maxlength='31' value='$qossettings{'DIP'}' />
1017 <td width='33%' align='center'><input type='hidden' name='CLASS' value='$qossettings{'CLASS'}' /><input type='submit' name='DOPORT' value='$Lang::tr{'save'}' />
1021 &Header
::closebox
();
1025 &Header
::openbox
('100%', 'center', $Lang::tr
{'TOS Rule'});
1026 if ($qossettings{'TOS'}) {
1027 $checked{$qossettings{'TOS'}} = "checked";
1030 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
1034 if ( $message ne "" ) {
1035 print "<tr><td colspan='3' align='center'><font color='red'>$message</font>";
1038 <tr><td colspan='2' width='100%'>$Lang::tr{'current class'}: $qossettings{'CLASS'}
1039 <tr><td width='100%' colspan='2'>$Lang::tr{'Enter TOS'}
1040 <tr><td width='50%' align='left'>$Lang::tr{'min delay'} (8) <td width='50%'><input type="radio" name="TOS" value="8" $checked[8] />
1041 <tr><td width='50%' align='left'>$Lang::tr{'max throughput'} (4) <td width='50%'><input type="radio" name="TOS" value="4" $checked[4] />
1042 <tr><td width='50%' align='left'>$Lang::tr{'max reliability'} (2) <td width='50%'><input type="radio" name="TOS" value="2" $checked[2] />
1043 <tr><td width='50%' align='left'>$Lang::tr{'min costs'} (1) <td width='50%'><input type="radio" name="TOS" value="1" $checked[1] />
1044 <tr><td width='100%' align='right' colspan='2'><input type='hidden' name='CLASS' value='$qossettings{'CLASS'}' /><input type='submit' name='DOTOS' value='$Lang::tr{'save'}' />
1048 &Header
::closebox
();
1052 $qossettings{'DEV'} = shift;
1053 open( FILE
, "< $classfile" ) or die "Unable to read $classfile";
1057 open( FILE
, "< $level7file" ) or die "Unable to read $level7file";
1060 open( FILE
, "< $tosfile" ) or die "Unable to read $tosfile";
1063 open( FILE
, "< $portfile" ) or die "Unable to read $portfile";
1064 @portrules = <FILE
>;
1066 foreach $classentry (sort @classes)
1068 @classline = split( /\;/, $classentry );
1069 if ( $classline[0] eq $qossettings{'DEV'} )
1071 &Header
::openbox
('100%', 'center', "$Lang::tr{'Class'}: $classline[1] $classline[8]");
1073 <table border='0' width='100%' cellspacing='0'>
1074 <tr><td bgcolor='$color{'color20'}' width='10%' align='center'><b>$Lang::tr{'interface'}</b>
1075 <td bgcolor='$color{'color20'}' width='10%' align='center'><b>$Lang::tr{'Class'}</b>
1076 <td bgcolor='$color{'color20'}' width='10%' align='center'>$Lang::tr{'priority'}
1077 <td bgcolor='$color{'color20'}' width='10%' align='center'>$Lang::tr{'guaranteed bandwidth'}
1078 <td bgcolor='$color{'color20'}' width='10%' align='center'>$Lang::tr{'max bandwidth'}
1079 <td bgcolor='$color{'color20'}' width='10%' align='center'>Burst
1080 <td bgcolor='$color{'color20'}' width='10%' align='center'>Ceil Burst
1081 <td bgcolor='$color{'color20'}' width='10%' align='center'>TOS
1082 <td bgcolor='$color{'color20'}' width='20%' align='center'>$Lang::tr{'action'}
1083 <tr><td align='center' bgcolor='$color{'color22'}'>$classline[0]</td>
1084 <td align='center' bgcolor='$color{'color22'}'>$classline[1]</td>
1085 <td align='center' bgcolor='$color{'color22'}'>$classline[2]</td>
1086 <td align='center' bgcolor='$color{'color22'}'>$classline[3]</td>
1087 <td align='center' bgcolor='$color{'color22'}'>$classline[4]</td>
1088 <td align='center' bgcolor='$color{'color22'}'>$classline[5]</td>
1089 <td align='center' bgcolor='$color{'color22'}'>$classline[6]</td>
1090 <td align='center' bgcolor='$color{'color22'}'>$classline[7]</td>
1091 <td align='right' bgcolor='$color{'color22'}'>
1092 <table border='0'><tr>
1093 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1094 <input type='hidden' name='CLASS' value='$classline[1]' />
1095 <input type='hidden' name='ACTION' value='$Lang::tr{'Add Rule'}' />
1096 <input type='image' alt='$Lang::tr{'Add Rule'}' title='$Lang::tr{'Add Rule'}' src='/images/addgreen.gif' />
1098 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1099 <input type='hidden' name='CLASS' value='$classline[1]' />
1100 <input type='hidden' name='DOCLASS' value='$Lang::tr{'edit'}' />
1101 <input type='image' alt='$Lang::tr{'edit'}' title='$Lang::tr{'edit'}' src='/images/edit.gif' />
1103 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1104 <input type='hidden' name='CLASS' value='$classline[1]' />
1105 <input type='hidden' name='DOCLASS' value='$Lang::tr{'delete'}' />
1106 <input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/delete.gif' />
1110 <tr><td align='right' colspan='2'><b>$Lang::tr{'remark'}:</b>
1111 <td align='center' colspan='6'> $classline[8]
1112 <td align='right'><b>Queueing:</b> $classline[9]
1117 foreach $l7ruleentry (sort @l7rules)
1119 @l7ruleline = split( /\;/, $l7ruleentry );
1120 if ( $l7ruleline[0] eq $classline[1] )
1123 <tr><td align='right' colspan='2'><b>$Lang::tr{'Level7 Protocol'}:</b>
1124 <td align='center' colspan='6'>$l7ruleline[2]
1126 <table border='0'><tr>
1127 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1128 <input type='hidden' name='CLASS' value='$l7ruleline[0]' />
1129 <input type='hidden' name='L7PROT' value='$l7ruleline[2]' />
1130 <input type='hidden' name='DOLEVEL7' value='$Lang::tr{'edit'}' />
1131 <input type='image' alt='$Lang::tr{'edit'}' title='$Lang::tr{'edit'}' src='/images/edit.gif' />
1133 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1134 <input type='hidden' name='CLASS' value='$l7ruleline[0]' />
1135 <input type='hidden' name='L7PROT' value='$l7ruleline[2]' />
1136 <input type='hidden' name='DOLEVEL7' value='$Lang::tr{'delete'}' />
1137 <input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/delete.gif' />
1142 if (($l7ruleline[3] ne "") || ($l7ruleline[4] ne "")){
1144 <tr><td align='center'>
1145 <td align='right' colspan='3'><b>$Lang::tr{'source ip'}:</b> $l7ruleline[3]
1146 <td align='right' colspan='3'><b>$Lang::tr{'destination ip'}:</b> $l7ruleline[4]
1160 foreach $portruleentry (sort @portrules)
1162 @portruleline = split( /\;/, $portruleentry );
1163 if ( $portruleline[0] eq $classline[1] )
1166 <tr><td align='right' colspan='2'><b>$Lang::tr{'Port Rule'}:</b>
1167 <td align='center'>($portruleline[2])
1168 <td align='center' colspan='2'>
1171 if ($portruleline[4]) {
1173 <i>$Lang::tr{'source port'}:</i> $portruleline[4]
1177 print "<td align='center' colspan='2'>";
1178 if ($portruleline[6]) {
1180 <i>$Lang::tr{'destination port'}:</i> $portruleline[6]
1187 <table border='0'><tr>
1188 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1189 <input type='hidden' name='CLASS' value='$portruleline[0]' />
1190 <input type='hidden' name='PPROT' value='$portruleline[2]' />
1191 <input type='hidden' name='QIP' value='$portruleline[3]' />
1192 <input type='hidden' name='QPORT' value='$portruleline[4]' />
1193 <input type='hidden' name='DIP' value='$portruleline[5]' />
1194 <input type='hidden' name='DPORT' value='$portruleline[6]' />
1195 <input type='hidden' name='DOPORT' value='$Lang::tr{'edit'}' />
1196 <input type='image' alt='$Lang::tr{'edit'}' title='$Lang::tr{'edit'}' src='/images/edit.gif' />
1198 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1199 <input type='hidden' name='CLASS' value='$portruleline[0]' />
1200 <input type='hidden' name='PPROT' value='$portruleline[2]' />
1201 <input type='hidden' name='QIP' value='$portruleline[3]' />
1202 <input type='hidden' name='QPORT' value='$portruleline[4]' />
1203 <input type='hidden' name='DIP' value='$portruleline[5]' />
1204 <input type='hidden' name='DPORT' value='$portruleline[6]' />
1205 <input type='hidden' name='DOPORT' value='$Lang::tr{'delete'}' />
1206 <input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/delete.gif' />
1211 if (($portruleline[3] ne "") || ($portruleline[5] ne "")){
1213 <tr><td align='center'>
1214 <td align='right' colspan='3'><b>$Lang::tr{'source ip'}:</b> $portruleline[3]
1215 <td align='right' colspan='3'><b>$Lang::tr{'destination ip'}:</b> $portruleline[5]
1224 foreach $tosruleentry (sort @tosrules)
1226 @tosruleline = split( /\;/, $tosruleentry );
1227 if ( $tosruleline[0] eq $classline[1] )
1230 <tr><td align='right' colspan='2'>
1231 <b>TOS Bit matches:</b>
1232 <td colspan='6' align='center'>
1235 if ( $tosruleline[2] eq "8") {
1236 print "$Lang::tr{'min delay'}\n";
1237 } elsif ( $tosruleline[2] eq "4") {
1238 print "$Lang::tr{'max throughput'}\n";
1239 } elsif ( $tosruleline[2] eq "2") {
1240 print "$Lang::tr{'max reliability'}\n";
1241 } elsif ( $tosruleline[2] eq "1") {
1242 print "$Lang::tr{'min costs'}\n";
1243 } else { print " \n"; }
1248 <table border='0'><tr>
1249 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1250 <input type='hidden' name='CLASS' value='$tosruleline[0]' />
1251 <input type='hidden' name='DEV' value='$tosruleline[1]' />
1252 <input type='hidden' name='TOS' value='$tosruleline[2]' />
1253 <input type='hidden' name='DOTOS' value='$Lang::tr{'edit'}' />
1254 <input type='image' alt='$Lang::tr{'edit'}' title='$Lang::tr{'edit'}' src='/images/edit.gif' />
1256 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1257 <input type='hidden' name='CLASS' value='$tosruleline[0]' />
1258 <input type='hidden' name='DEV' value='$tosruleline[1]' />
1259 <input type='hidden' name='TOS' value='$tosruleline[2]' />
1260 <input type='hidden' name='DOTOS' value='$Lang::tr{'delete'}' />
1261 <input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/delete.gif' />
1275 &Header
::closebox
();
1281 if ( $qossettings{'VALID'} eq 'yes' ) {
1282 if ( $qossettings{'DEVICE'} eq $qossettings{'RED_DEV'} ) {
1283 $qossettings{'SPD'} = $qossettings{'OUT_SPD'};
1284 } elsif ( $qossettings{'DEVICE'} eq $qossettings{'IMQ_DEV'} ) {
1285 $qossettings{'SPD'} = $qossettings{'INC_SPD'};
1287 unless ( ( $qossettings{'MINBWDTH'} >= 1 ) && ( $qossettings{'MINBWDTH'} <= $qossettings{'SPD'} ) ) {
1288 $qossettings{'VALID'} = 'no';
1289 $message = "$Lang::tr{'false min bandwidth'}";
1291 $qossettings{'SPD'} = '';
1296 if ( $qossettings{'VALID'} eq 'yes' ) {
1297 if ( $qossettings{'DEVICE'} eq $qossettings{'RED_DEV'} ) {
1298 $qossettings{'SPD'} = $qossettings{'OUT_SPD'};
1299 } elsif ( $qossettings{'DEVICE'} eq $qossettings{'IMQ_DEV'} ) {
1300 $qossettings{'SPD'} = $qossettings{'INC_SPD'};
1302 unless ( ( $qossettings{'MAXBDWTH'} >= 0 ) && ($qossettings{'MAXBDWTH'} >= $qossettings{'MINBDWTH'}) &&( $qossettings{'MAXBDWTH'} <= $qossettings{'SPD'} ) ) {
1303 $qossettings{'VALID'} = 'no';
1304 $message = "$Lang::tr{'false max bandwidth'}";
1306 $qossettings{'SPD'} = '';
1311 if ( $qossettings{'VALID'} eq 'yes' ) {
1312 if ( $qossettings{'DEVICE'} eq $qossettings{'RED_DEV'} ) {
1313 if ($qossettings{'CLASS'} lt 100 || $qossettings{'CLASS'} ge 121) {
1314 $qossettings{'VALID'} = 'no';
1315 $message = "$Lang::tr{'false classnumber'}";
1317 } elsif ( $qossettings{'DEVICE'} eq $qossettings{'IMQ_DEV'} ) {
1318 if ($qossettings{'CLASS'} lt 200 || $qossettings{'CLASS'} ge 221) {
1319 $qossettings{'VALID'} = 'no';
1320 $message = "$Lang::tr{'The class number does not match the specified interface.'}";
1323 open( FILE
, "< $classfile" ) or die "Unable to read $classfile";
1326 foreach $classentry (sort @tmp)
1328 @tmpline = split( /\;/, $classentry );
1329 if ( $tmpline[1] eq $qossettings{'CLASS'} )
1331 $qossettings{'VALID'} = 'no';
1332 $message = "$Lang::tr{'false classnumber'}";