]>
git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - html/cgi-bin/qos.cgi
c2ff4a08d28f504c00efd787ed201327033a4b39
2 ###############################################################################
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2007-2011 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'} = '';
103 &General
::readhash
("${General::swroot}/qos/settings", \
%qossettings);
104 &Header
::getcgihash
(\
%qossettings);
106 $qossettings{'RED_DEV'} = &General
::get_red_interface
();
109 my %mainsettings = ();
110 &General
::readhash
("${General::swroot}/main/settings", \
%mainsettings);
111 &General
::readhash
("/srv/web/ipfire/html/themes/ipfire/include/colors.txt", \
%color);
113 &Header
::showhttpheaders
();
115 &Header
::openpage
('QoS', 1, '');
116 &Header
::openbigbox
('100%', 'left', '', $errormessage);
118 ############################################################################################################################
119 ############################################################################################################################
121 if ($qossettings{'DOCLASS'} eq $Lang::tr
{'save'})
126 if ( $qossettings{'VALID'} eq 'yes' ) {
127 open( FILE
, ">> $classfile" ) or die "Unable to write $classfile";
129 $qossettings{'DEVICE'};$qossettings{'CLASS'};$qossettings{'PRIO'};$qossettings{'MINBWDTH'};$qossettings{'MAXBWDTH'};$qossettings{'BURST'};$qossettings{'CBURST'};$qossettings{'TOS'};$qossettings{'REMARK'};
134 $qossettings{'ACTION'} = $Lang::tr
{'parentclass add'};
137 elsif ($qossettings{'DOCLASS'} eq $Lang::tr
{'edit'})
139 open( FILE
, "< $classfile" ) or die "Unable to read $classfile";
142 open( FILE
, "> $classfile" ) or die "Unable to write $classfile";
143 foreach $classentry (sort @classes)
145 @classline = split( /\;/, $classentry );
146 if ( $classline[1] ne $qossettings{'CLASS'} ) {
147 print FILE
$classentry;
149 $qossettings{'DEVICE'} = $classline[0];
150 $qossettings{'PRIO'} = $classline[2];
151 $qossettings{'MINBWDTH'} = $classline[3];
152 $qossettings{'MAXBWDTH'} = $classline[4];
153 $qossettings{'BURST'} = $classline[5];
154 $qossettings{'CBURST'} = $classline[6];
155 $qossettings{'TOS'} = $classline[7];
156 $qossettings{'REMARK'} = $classline[8];
157 $qossettings{'EDIT'} = 'yes';
162 &Header
::closebigbox
();
163 &Header
::closepage
();
166 elsif ($qossettings{'DOCLASS'} eq $Lang::tr
{'delete'})
168 open( FILE
, "< $classfile" ) or die "Unable to read $classfile";
171 open( FILE
, "> $classfile" ) or die "Unable to write $classfile";
172 foreach $classentry (sort @tmp)
174 @tmpline = split( /\;/, $classentry );
175 if ( $tmpline[1] ne $qossettings{'CLASS'} )
177 print FILE
$classentry;
181 $message = "$Lang::tr{'Class'} $qossettings{'CLASS'} $Lang::tr{'Class was deleted'}";
184 ############################################################################################################################
185 ############################################################################################################################
187 if ($qossettings{'DOLEVEL7'} eq $Lang::tr
{'save'})
189 if ( $qossettings{'QIP'} ne '' ) {
190 if ((!&General
::validipandmask
($qossettings{'QIP'})) && (!&General
::validip
($qossettings{'QIP'}))) {
191 $qossettings{'VALID'} = 'no';
192 $message = $Lang::tr
{'The source IP address is invalid.'};
195 if ( $qossettings{'DIP'} ne '' ) {
196 if ((!&General
::validipandmask
($qossettings{'DIP'})) && (!&General
::validip
($qossettings{'DIP'}))) {
197 $qossettings{'VALID'} = 'no';
198 $message = $Lang::tr
{'The destination IP address is invalid.'};
201 if ($qossettings{'CLASS'} >= 100 && $qossettings{'CLASS'} < 121) {
202 $qossettings{'DEVICE'} = $qossettings{'RED_DEV'};
203 } elsif ($qossettings{'CLASS'} >= 1000 && $qossettings{'CLASS'} < 1021) {
204 $qossettings{'DEVICE'} = $qossettings{'RED_DEV'};
205 } elsif ($qossettings{'CLASS'} >= 200 && $qossettings{'CLASS'} < 221) {
206 $qossettings{'DEVICE'} = $qossettings{'IMQ_DEV'};
207 } elsif ($qossettings{'CLASS'} >= 2000 && $qossettings{'CLASS'} < 2021) {
208 $qossettings{'DEVICE'} = $qossettings{'IMQ_DEV'};
210 if ( $qossettings{'VALID'} eq 'yes' ) {
211 open( FILE
, ">> $level7file" ) or die "Unable to write $level7file";
213 $qossettings{'CLASS'};$qossettings{'DEVICE'};$qossettings{'L7PROT'};$qossettings{'QIP'};$qossettings{'DIP'};
218 $qossettings{'ACTION'} = $Lang::tr
{'Add Level7 rule'};
220 } elsif ($qossettings{'DOLEVEL7'} eq $Lang::tr
{'delete'})
222 open( FILE
, "< $level7file" ) or die "Unable to read $level7file";
225 &General
::system("rm", "$level7file");
226 foreach $l7ruleentry (sort @l7rules)
228 @l7ruleline = split( /\;/, $l7ruleentry );
229 if ( ($l7ruleline[0] eq $qossettings{'CLASS'}) && ($l7ruleline[2] eq $qossettings{'L7PROT'}))
230 {$message = "$Lang::tr{'Level7 Rule'} ($qossettings{'CLASS'} - $qossettings{'L7PROT'}) $Lang::tr{'was deleted'}.";}
232 { open( FILE
, ">> $level7file" ) or die "Unable to read $level7file";
233 print FILE
$l7ruleentry;
237 open( FILE
, "< $level7file" ) or &General
::system("touch", "$level7file");close FILE
;
238 } elsif ($qossettings{'DOLEVEL7'} eq $Lang::tr
{'edit'})
240 open( FILE
, "< $level7file" ) or die "Unable to read $level7file";
243 &General
::system("rm", "$level7file");
244 foreach $l7ruleentry (sort @l7rules)
246 @l7ruleline = split( /\;/, $l7ruleentry );
247 if ( ($l7ruleline[0] eq $qossettings{'CLASS'}) && ($l7ruleline[2] eq $qossettings{'L7PROT'}))
248 {$qossettings{'QIP'} = $l7ruleline[3];$qossettings{'DIP'} = $l7ruleline[4];}
250 open( FILE
, ">> $level7file" ) or die "Unable to write $level7file";
251 print FILE
$l7ruleentry;
256 open( FILE
, "< $level7file" ) or &General
::system("touch", "$level7file");close FILE
;
259 ############################################################################################################################
260 ############################################################################################################################
262 if ($qossettings{'DOPORT'} eq $Lang::tr
{'save'})
264 if ( $qossettings{'QIP'} ne '' ) {
265 if ((!&General
::validipandmask
($qossettings{'QIP'})) && (!&General
::validip
($qossettings{'QIP'}))) {
266 $qossettings{'VALID'} = 'no';
267 $message = $Lang::tr
{'The source IP address is invalid.'};
270 if ( $qossettings{'DIP'} ne '' ) {
271 if ((!&General
::validipandmask
($qossettings{'DIP'})) && (!&General
::validip
($qossettings{'DIP'}))) {
272 $qossettings{'VALID'} = 'no';
273 $message = $Lang::tr
{'The destination IP address is invalid.'};
276 if ($qossettings{'CLASS'} >= 100 && $qossettings{'CLASS'} < 121) {
277 $qossettings{'DEVICE'} = $qossettings{'RED_DEV'};
278 } elsif ($qossettings{'CLASS'} >= 1000 && $qossettings{'CLASS'} < 1021) {
279 $qossettings{'DEVICE'} = $qossettings{'RED_DEV'};
280 } elsif ($qossettings{'CLASS'} >= 200 && $qossettings{'CLASS'} < 221) {
281 $qossettings{'DEVICE'} = $qossettings{'IMQ_DEV'};
282 } elsif ($qossettings{'CLASS'} >= 2000 && $qossettings{'CLASS'} < 2021) {
283 $qossettings{'DEVICE'} = $qossettings{'IMQ_DEV'};
285 if ( $qossettings{'VALID'} eq 'yes' ) {
286 open( FILE
, ">> $portfile" ) or die "Unable to write $portfile";
288 $qossettings{'CLASS'};$qossettings{'DEVICE'};$qossettings{'PPROT'};$qossettings{'QIP'};$qossettings{'QPORT'};$qossettings{'DIP'};$qossettings{'DPORT'};
293 $qossettings{'ACTION'} = $Lang::tr
{'Add Port Rule'};
295 } elsif ($qossettings{'DOPORT'} eq $Lang::tr
{'delete'})
297 open( FILE
, "< $portfile" ) or die "Unable to read $portfile";
300 open( FILE
, "> $portfile" ) or die "Unable to read $portfile";
301 foreach $portruleentry (sort @portrules)
303 @portruleline = split( /\;/, $portruleentry );
304 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'}))
306 print FILE
$portruleentry;
310 $message = "$Lang::tr{'Port Rule'} ($qossettings{'CLASS'} - $qossettings{'PPROT'}) $Lang::tr{'was deleted'}.";
311 } elsif ($qossettings{'DOPORT'} eq $Lang::tr
{'edit'})
313 open( FILE
, "< $portfile" ) or die "Unable to read $portfile";
316 &General
::system("rm", "$portfile");
317 foreach $portruleentry (sort @portrules)
319 @portruleline = split( /\;/, $portruleentry );
320 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'}))
321 {$qossettings{'CLASS'}=$portruleline[0];$qossettings{'PPROT'}=$portruleline[2];$qossettings{'QIP'}=$portruleline[3];$qossettings{'QPORT'}=$portruleline[4];$qossettings{'DIP'}=$portruleline[5];$qossettings{'DPORT'}=$portruleline[6];}
323 open( FILE
, ">> $portfile" ) or die "Unable to write $portfile";
324 print FILE
$portruleentry;
329 open( FILE
, "< $portfile" ) or &General
::system("touch", "$portfile");close FILE
;
332 ############################################################################################################################
333 ############################################################################################################################
335 if ($qossettings{'DOTOS'} eq $Lang::tr
{'save'})
337 if ($qossettings{'CLASS'} >= 100 && $qossettings{'CLASS'} < 121) {
338 $qossettings{'DEVICE'} = $qossettings{'RED_DEV'};
339 } elsif ($qossettings{'CLASS'} >= 1000 && $qossettings{'CLASS'} < 1021) {
340 $qossettings{'DEVICE'} = $qossettings{'RED_DEV'};
341 } elsif ($qossettings{'CLASS'} >= 200 && $qossettings{'CLASS'} < 221) {
342 $qossettings{'DEVICE'} = $qossettings{'IMQ_DEV'};
343 } elsif ($qossettings{'CLASS'} >= 2000 && $qossettings{'CLASS'} < 2021) {
344 $qossettings{'DEVICE'} = $qossettings{'IMQ_DEV'};
346 open( FILE
, ">> $tosfile" ) or die "Unable to write $tosfile";
348 $qossettings{'CLASS'};$qossettings{'DEVICE'};$qossettings{'TOS'};
353 elsif ($qossettings{'DOTOS'} eq $Lang::tr
{'delete'})
355 open( FILE
, "< $tosfile" ) or die "Unable to read $tosfile";
358 open( FILE
, "> $tosfile" ) or die "Unable to read $tosfile";
359 foreach $tosruleentry (sort @tosrules)
361 @tosruleline = split( /\;/, $tosruleentry );
362 unless ( ($tosruleline[0] eq $qossettings{'CLASS'}) && ($tosruleline[2] eq $qossettings{'TOS'}))
364 print FILE
$tosruleentry;
368 $message = "$Lang::tr{'TOS Rule'} ($qossettings{'CLASS'} - $qossettings{'TOS'}) $Lang::tr{'was deleted'}.";
369 } elsif ($qossettings{'DOTOS'} eq $Lang::tr
{'edit'})
371 open( FILE
, "< $tosfile" ) or die "Unable to read $tosfile";
374 open( FILE
, "> $tosfile" ) or die "Unable to write $tosfile";
375 foreach $tosruleentry (sort @tosrules)
377 @tosruleline = split( /\;/, $tosruleentry );
378 if (( $tosruleline[0] eq $qossettings{'CLASS'} ) && ( $tosruleline[2] eq $qossettings{'TOS'} )) {
379 $qossettings{'DEVICE'} = $tosruleline[1];
380 $qossettings{'CLASS'} = $tosruleline[0];
381 $qossettings{'TOS'} = $tosruleline[2];
382 $qossettings{'EDIT'} = 'yes';
384 print FILE
$tosruleentry;
389 &Header
::closebigbox
();
390 &Header
::closepage
();
394 ############################################################################################################################
395 ############################################################################################################################
397 if ($qossettings{'ACTION'} eq $Lang::tr
{'start'})
399 $qossettings{'ENABLED'} = 'on';
400 &General
::writehash
("${General::swroot}/qos/settings", \
%qossettings);
401 &General
::system("/usr/local/bin/qosctrl", "generate");
402 &General
::system("/usr/local/bin/qosctrl", "start");
403 &General
::system("logger", "-t", "ipfire", "QoS started");
405 elsif ($qossettings{'ACTION'} eq $Lang::tr
{'stop'})
407 $qossettings{'ENABLED'} = 'off';
408 &General
::writehash
("${General::swroot}/qos/settings", \
%qossettings);
409 &General
::system("/usr/local/bin/qosctrl", "stop");
410 &General
::system("/usr/local/bin/qosctrl", "generate");
411 &General
::system("logger", "-t", "ipfire", "QoS stopped");
413 elsif ($qossettings{'ACTION'} eq $Lang::tr
{'restart'})
415 if ($qossettings{'ENABLED'} eq 'on'){
416 &General
::system("/usr/local/bin/qosctrl", "stop");
417 &General
::system("/usr/local/bin/qosctrl", "generate");
418 &General
::system("/usr/local/bin/qosctrl", "start");
419 &General
::system("logger", "-t", "ipfire", "QoS restarted");
422 elsif ($qossettings{'ACTION'} eq $Lang::tr
{'save'})
424 if ($qossettings{'DEF_INC_SPD'} eq '') {
425 $qossettings{'DEF_INC_SPD'} = int($qossettings{'INC_SPD'} * 0.9);
427 if ($qossettings{'DEF_OUT_SPD'} eq '') {
428 $qossettings{'DEF_OUT_SPD'} = int($qossettings{'OUT_SPD'} * 0.9);
430 &General
::writehash
("${General::swroot}/qos/settings", \
%qossettings);
432 elsif ($qossettings{'ACTION'} eq $Lang::tr
{'template'} )
434 if (($qossettings{'OUT_SPD'} > 0) && ($qossettings{'INC_SPD'} > 0)) {
437 for(my $i = 1; $i <= 10; $i++) {
438 $UP[$i] = int($qossettings{'OUT_SPD'} / $i );
439 #print $i."=".$UP[$i]." ";
442 #print "<br /><br />Down<br />";
443 for(my $i = 1; $i <= 20; $i++) {
444 $DOWN[$i] = int($qossettings{'INC_SPD'} / $i);
445 #print $i."=".$DOWN[$i]." ";
447 open( FILE
, "> $classfile" ) or die "Unable to write $classfile";
449 imq0;200;1;$DOWN[20];$DOWN[1];;;8;VoIP;
450 imq0;203;4;$DOWN[20];$DOWN[1];;;0;VPN;
451 imq0;204;5;$DOWN[20];$DOWN[1];;;8;Webtraffic;
452 imq0;210;6;1;$DOWN[1];;;0;Default;
453 imq0;220;7;1;$DOWN[1];;;1;P2P;
454 $qossettings{'RED_DEV'};101;1;$UP[10];$UP[1];;;8;ACKs;
455 $qossettings{'RED_DEV'};102;2;$UP[10];$UP[1];;;8;VoIP;
456 $qossettings{'RED_DEV'};103;4;$UP[10];$UP[1];;;2;VPN;
457 $qossettings{'RED_DEV'};104;5;$UP[10];$UP[1];;;8;Webtraffic;
458 $qossettings{'RED_DEV'};110;6;1;$UP[1];;;0;Default;
459 $qossettings{'RED_DEV'};120;7;1;$UP[1];;;1;P2P;
463 open( FILE
, "> $level7file" ) or die "Unable to write $level7file";
465 102;$qossettings{'RED_DEV'};dns;;;
466 102;$qossettings{'RED_DEV'};rtp;;;
467 102;$qossettings{'RED_DEV'};skypetoskype;;;
468 103;$qossettings{'RED_DEV'};ssh;;;
469 103;$qossettings{'RED_DEV'};rdp;;;
470 104;$qossettings{'RED_DEV'};http;;;
471 104;$qossettings{'RED_DEV'};ssl;;;
472 104;$qossettings{'RED_DEV'};pop3;;;
473 120;$qossettings{'RED_DEV'};applejuice;;;
474 120;$qossettings{'RED_DEV'};bittorrent;;;
476 200;imq0;skypetoskype;;;
482 220;imq0;applejuice;;;
483 220;imq0;bittorrent;;;
487 open( FILE
, "> $portfile" ) or die "Unable to write $portfile";
489 101;$qossettings{'RED_DEV'};icmp;;;;;
490 102;$qossettings{'RED_DEV'};tcp;;;;53;
491 102;$qossettings{'RED_DEV'};udp;;;;53;
492 103;$qossettings{'RED_DEV'};esp;;;;;
493 103;$qossettings{'RED_DEV'};tcp;;1194;;;
494 103;$qossettings{'RED_DEV'};udp;;1194;;;
495 103;$qossettings{'RED_DEV'};tcp;;;;1194;
496 103;$qossettings{'RED_DEV'};udp;;;;1194;
497 103;$qossettings{'RED_DEV'};udp;;4500;;4500;
498 103;$qossettings{'RED_DEV'};udp;;500;;500;
499 104;$qossettings{'RED_DEV'};tcp;;;;80;
502 203;imq0;tcp;;;;1194;
503 203;imq0;udp;;;;1194;
504 203;imq0;tcp;;1194;;;
505 203;imq0;udp;;1194;;;
506 203;imq0;udp;;4500;;4500;
507 203;imq0;udp;;500;;500;
512 if ($qossettings{'DEF_INC_SPD'} eq '') {
513 $qossettings{'DEF_INC_SPD'} = int($qossettings{'INC_SPD'} * 0.9);
515 if ($qossettings{'DEF_OUT_SPD'} eq '') {
516 $qossettings{'DEF_OUT_SPD'} = int($qossettings{'OUT_SPD'} * 0.9);
518 $qossettings{'DEFCLASS_INC'} = "210";
519 $qossettings{'DEFCLASS_OUT'} = "110";
520 $qossettings{'ENABLED'} = 'on';
521 &General
::writehash
("${General::swroot}/qos/settings", \
%qossettings);
522 &General
::system("/usr/local/bin/qosctrl", "generate");
523 &General
::system("/usr/local/bin/qosctrl", "start");
524 &General
::system("logger", "-t", "ipfire", "QoS started");
526 $message = $Lang::tr
{'qos enter bandwidths'};
529 elsif ($qossettings{'ACTION'} eq $Lang::tr
{'status'} )
531 &Header
::openbox
('100%', 'left', 'QoS Status');
532 if ($qossettings{'ENABLED'} eq 'on'){
534 my @output = &General
::system_output
("/usr/local/bin/qosctrl", "status");
535 $output = &Header
::cleanhtml
(join("", @output), "y");
536 print "<pre>$output</pre>\n";
537 } else { print "$Lang::tr{'QoS not enabled'}"; }
539 &Header
::closebigbox
();
540 &Header
::closepage
();
543 elsif ($qossettings{'ACTION'} eq $Lang::tr
{'parentclass add'} )
546 &Header
::closebigbox
();
547 &Header
::closepage
();
550 elsif ($qossettings{'ACTION'} eq $Lang::tr
{'Add Rule'})
552 &Header
::openbox
('100%', 'center', $Lang::tr
{'Add Rule'});
555 <tr><td align='center'>$Lang::tr{'Choose Rule'}
556 <tr><td align='center'>
557 <input type="button" onClick="swapVisibility('l7rule')" value='$Lang::tr{'Level7 Rule'}' />
558 <input type="button" onClick="swapVisibility('portrule')" value='$Lang::tr{'Port Rule'}' />
559 <input type="button" onClick="swapVisibility('tosrule')" value='$Lang::tr{'TOS rule'}' />
565 <div id='l7rule' style='display: none'>
571 <div id='portrule' style='display: none'>
577 <div id='tosrule' style='display: none'>
585 &Header
::closebigbox
();
586 &Header
::closepage
();
589 if ($qossettings{'ACTIONBW'} eq "$Lang::tr{'modify'}" )
592 &Header
::closebigbox
();
593 &Header
::closepage
();
596 if ($qossettings{'ACTIONDEF'} eq "$Lang::tr{'modify'}" )
599 &Header
::closebigbox
();
600 &Header
::closepage
();
604 &General
::readhash
("${General::swroot}/qos/settings", \
%qossettings);
606 my $status = $Lang::tr
{'stopped'};
607 my $statuscolor = '#993333';
608 if ( $qossettings{'ENABLED'} eq 'on' ) {
609 $status = $Lang::tr
{'running'};
610 $statuscolor = '#339933';
613 if ( $netsettings{'RED_TYPE'} ne 'PPPOE' ) {
614 $qossettings{'RED_DEV'} = $netsettings{'RED_DEV'};
618 &Header
::openbox
('100%', 'left', $Lang::tr
{'error messages'});
619 print "<class name='base'>$errormessage\n";
620 print " </class>\n";
624 ############################################################################################################################
625 ############################################################################################################################
627 &Header
::openbox
('100%', 'center', );
630 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
634 if ( $message ne "" ) {
635 print "<tr><td colspan='2' align='center'><font color='red'>$message</font></tr>";
638 <tr><td width='50%' align='left'><b>Quality of Service:</b></td>
639 <td width='50%' align='center' bgcolor='$statuscolor'><font color='white'>$status</font></td></tr>
641 <td colspan='2'><br></td>
643 <tr><td width='100%' align='right' colspan='2'>
644 <input type='submit' name='ACTION' value="$Lang::tr{'start'}">
645 <input type='submit' name='ACTION' value="$Lang::tr{'stop'}">
646 <input type='submit' name='ACTION' value="$Lang::tr{'restart'}" ></td></tr></table></form>
649 if (($qossettings{'OUT_SPD'} ne '') && ($qossettings{'INC_SPD'} ne '')) {
651 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
653 <tr><td colspan='3'>
654 <tr><td width='50%' align='right'>$Lang::tr{'downlink speed'}: <td width='30%' align='left'>$qossettings{'INC_SPD'}
655 <td width='20%' rowspan='2' align='center' valign='middle'><input type='submit' name='ACTIONBW' value='$Lang::tr{'modify'}' />
656 <tr><td width='50%' align='right'>$Lang::tr{'uplink speed'}: <td width='30%' align='left'>$qossettings{'OUT_SPD'}
661 if (($qossettings{'DEFCLASS_OUT'} ne '') && ($qossettings{'DEFCLASS_INC'} ne '')) {
663 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
665 <tr><td colspan='3'><hr />
666 <tr><td width='50%' align='right'>$Lang::tr{'downlink std class'}: <td width='30%' align='left'>$qossettings{'DEFCLASS_INC'}
667 <td width='20%' rowspan='3' align='center' valign='middle'><input type='submit' name='ACTIONDEF' value='$Lang::tr{'modify'}' />
668 <tr><td width='50%' align='right'>$Lang::tr{'uplink std class'}: <td width='30%' align='left'>$qossettings{'DEFCLASS_OUT'}
669 <tr><td colspan='3' width='100%'><hr />
670 <tr><td colspan='3' width='100%' align='center'>
673 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
674 <table width='66%' border='0'>
675 <tr><td width='100%' align='center'>
676 <input type='submit' name='ACTION' value='$Lang::tr{'parentclass add'}' />
677 <input type='submit' name='ACTION' value='$Lang::tr{'status'}' />
685 if ( ($qossettings{'OUT_SPD'} eq '') || ($qossettings{'INC_SPD'} eq '') ) {
687 &Header
::closebigbox
();
688 &Header
::closepage
();
692 if ( ($qossettings{'DEFCLASS_INC'} eq '') || ($qossettings{'DEFCLASS_OUT'} eq '') ) {
694 &Header
::closebigbox
();
695 &Header
::closepage
();
699 &Header
::openbox
('100%', 'center', "$qossettings{'RED_DEV'} $Lang::tr{'graph'}, $Lang::tr{'uplink'}");
700 &Graphs
::makegraphbox
("qos.cgi",$qossettings{'RED_DEV'},"hour");
702 &Header
::openbox
('100%', 'center', "$qossettings{'IMQ_DEV'} $Lang::tr{'graph'}, $Lang::tr{'downlink'}");
703 &Graphs
::makegraphbox
("qos.cgi",$qossettings{'IMQ_DEV'},"hour");
706 &showclasses
($qossettings{'RED_DEV'});
707 &showclasses
($qossettings{'IMQ_DEV'});
709 &Header
::closebigbox
();
710 &Header
::closepage
();
712 ############################################################################################################################
713 ############################################################################################################################
715 sub changedefclasses
{
716 &Header
::openbox
('100%', 'center', $Lang::tr
{'std classes'});
718 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
720 <tr><td width='100%' colspan='3'>$Lang::tr{'no filter pass'}
721 <tr><td width='33%' align='right'>$Lang::tr{'download'}:<td width='33%' align='left'><select name='DEFCLASS_INC'>
724 for ( $c = 200 ; $c <= 220 ; $c++ )
726 if ( $qossettings{'DEFCLASS_INC'} ne $c )
727 { print "<option value='$c'>$c</option>\n"; }
728 else { print "<option selected value='$c'>$c</option>\n"; }
731 </select><td width='33%' align='center'>
732 <tr><td width='33%' align='right'>$Lang::tr{'upload'}:<td width='33%' align='left'><select name='DEFCLASS_OUT'>
735 for ( $c = 100 ; $c <= 120 ; $c++ )
737 if ( $qossettings{'DEFCLASS_OUT'} ne $c )
738 { print "<option value='$c'>$c</option>\n"; }
739 else { print "<option selected value='$c'>$c</option>\n"; }
742 </select><td width='33%' align='center'><input type='submit' name='ACTION' value="$Lang::tr{'save'}" />
750 sub changebandwidth
{
751 &Header
::openbox
('100%', 'center', $Lang::tr
{'bandwithsettings'});
752 if ($qossettings{'ENABLED'} eq 'on') {
753 print "$Lang::tr{'bandwitherror'}";
754 print "<a href='/cgi-bin/qos.cgi'>$Lang::tr{'back'}</a>";
757 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
758 <input type='hidden' name='DEF_OUT_SPD' value='' /><input type='hidden' name='DEF_INC_SPD' value='' />
760 <tr><td width='100%' colspan='3'>$Lang::tr{'down and up speed'}</td></tr>
761 <tr><td width='50%' align='right'>$Lang::tr{'downlink speed'}:</td>
762 <td width='30%' align='left'><input type='text' name='INC_SPD' maxlength='8' value="$qossettings{'INC_SPD'}" /></td>
763 <td width='20%' align='center' rowspan='2'><input type='submit' name='ACTION' value="$Lang::tr{'template'}" /><br /><input type='submit' name='ACTION' value="$Lang::tr{'save'}" /><br /><input type='reset' name='ACTION' value="$Lang::tr{'reset'}" /></td></tr>
764 <tr><td width='50%' align='right'>$Lang::tr{'uplink speed'}:</td>
765 <td width='30%' align='left'><input type='text' name='OUT_SPD' maxlength='8' value="$qossettings{'OUT_SPD'}" /></td></tr>
768 <font color='red'>$Lang::tr{'template warning'}</font>
776 &Header
::openbox
('100%', 'center', $Lang::tr
{'parentclass'});
778 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
782 if ( $message ne "" ) {
783 print "<tr><td colspan='3' align='center'>$message";
785 if ( $qossettings{'EDIT'} eq 'yes' ) {
786 print "<input type='hidden' name='CLASS' value='$qossettings{'CLASS'}' />";
787 print "<input type='hidden' name='DEVICE' value='$qossettings{'DEVICE'}' />";
790 <tr><td width='100%' colspan='3'>$Lang::tr{'enter data'}
791 <tr><td width='33%' align='right'>$Lang::tr{'interface'}:
792 <td width='33%' align='left'>
795 if ( $qossettings{'EDIT'} eq 'yes' ) {
796 print "<select name='DEVICE' disabled>";
798 print "<select name='DEVICE'>";
800 if ( $qossettings{'DEVICE'} eq $qossettings{'RED_DEV'} ) {
801 $qossettings{'RED_DEV_SEL'} = 'selected';
802 } elsif ( $qossettings{'DEVICE'} eq $qossettings{'IMQ_DEV'} ) {
803 $qossettings{'IMQ_DEV_SEL'} = 'selected';
806 <option value='$qossettings{'RED_DEV'}' $qossettings{'RED_DEV_SEL'}>$qossettings{'RED_DEV'}</option>
807 <option value='$qossettings{'IMQ_DEV'}' $qossettings{'IMQ_DEV_SEL'}>$qossettings{'IMQ_DEV'}</option></select>
808 <td width='33%' align='center'>
809 <tr><td width='33%' align='right'>$Lang::tr{'Class'}:<td width='33%' align='left'>
812 if ( $qossettings{'EDIT'} eq 'yes' ) {
813 print "<select name='CLASS' disabled>";
815 print "<select name='CLASS'>";
817 for ( $c = 100 ; $c <= 120 ; $c++ )
819 if ( $qossettings{'CLASS'} ne $c )
820 { print "<option value='$c'>$c</option>\n"; }
821 else { print "<option selected value='$c'>$c</option>\n"; }
823 for ( $c = 200 ; $c <= 220 ; $c++ )
825 if ( $qossettings{'CLASS'} ne $c )
826 { print "<option value='$c'>$c</option>\n"; }
827 else { print "<option selected value='$c'>$c</option>\n"; }
831 <td width='33%' align='center'>
832 <tr><td width='33%' align='right'>$Lang::tr{'priority'}:<td width='33%' align='left'><select name='PRIO'>
835 for ( $c = 1 ; $c <= 7 ; $c++ )
837 if ( $qossettings{'PRIO'} ne $c )
838 { print "<option value='$c'>$c</option>\n"; }
839 else { print "<option selected value='$c'>$c</option>\n"; }
841 if ($qossettings{'MINBWDTH'} eq "") { $qossettings{'MINBWDTH'} = "1"; }
844 <td width='33%' align='center'>
845 <tr><td width='33%' align='right'>$Lang::tr{'guaranteed bandwith'}:
846 <td width='33%' align='left'><input type='text' size='20' name='MINBWDTH' maxlength='8' required='1' value="$qossettings{'MINBWDTH'}" />
847 <td width='33%' align='center'>
848 <tr><td width='33%' align='right'>$Lang::tr{'max bandwith'} <img src='/blob.gif' alt='*' />:
849 <td width='33%' align='left'><input type='text' size='20' name='MAXBWDTH' maxlength='8' required='1' value="$qossettings{'MAXBWDTH'}" />
850 <td width='33%' align='center'>
851 <tr><td width='33%' align='right'>Burst:
852 <td width='33%' align='left'><input type='text' size='20' name='BURST' maxlength='8' value="$qossettings{'BURST'}" />
853 <td width='33%' align='center'>
854 <tr><td width='33%' align='right'>Ceilburst:
855 <td width='33%' align='left'><input type='text' size='20' name='CBURST' maxlength='8' value="$qossettings{'CBURST'}" />
856 <td width='33%' align='center'>
857 <tr><td width='33%' align='right'>$Lang::tr{'remark'}:
858 <td width='66%' colspan='2' align='left'><input type='text' name='REMARK' size='40' maxlength='40' value="$qossettings{'REMARK'}" />
859 <tr><td width='33%' align='right'><img src='/blob.gif' alt='*' /> $Lang::tr{'required field'}
860 <td width='33%' align='left'>
861 <td width='33%' align='center'><input type='submit' name='DOCLASS' value='$Lang::tr{'save'}' /> <input type='reset' value='$Lang::tr{'reset'}' />
869 &Header
::openbox
('100%', 'center', $Lang::tr
{'Level7 Rule'});
871 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
875 if ( $message ne "" ) {
876 print "<tr><td colspan='3' align='center'><font color='red'>$message</font>";
879 <tr><td colspan='3' width='100%'>$Lang::tr{'current class'}: $qossettings{'CLASS'}
880 <tr><td width='100%' colspan='3'>$Lang::tr{'enter data'}
881 <tr><td width='33%' align='right'>$Lang::tr{'protocol'}:
882 <td width='33%' align='left'><select name='L7PROT'>
885 opendir( DIR
, "/etc/l7-protocols/protocols" );
886 foreach $direntry ( sort readdir(DIR
) )
888 next if $direntry eq ".";
889 next if $direntry eq "..";
890 next if -d
"/etc/l7-protocols/protocols/$direntry";
891 @proto = split( /\./, $direntry );
892 if ( $proto[0] eq $qossettings{'L7PROT'} ) {
893 print "<option value='$proto[0]' selected>$proto[0]</option>\n";
895 print "<option value='$proto[0]'>$proto[0]</option>\n";
900 </select><td width='33%' align='center'>
901 <tr><td width='33%' align='right'>$Lang::tr{'source ip'}:
902 <td width='33%' align='left'><input type='text' name='QIP' maxlength='31' value='$qossettings{'QIP'}' />
903 <td width='33%' align='center'>
904 <tr><td width='33%' align='right'>$Lang::tr{'destination ip'}:
905 <td width='33%' align='left'><input type='text' name='DIP' maxlength='31' value='$qossettings{'DIP'}' />
906 <td width='33%' align='center'><input type='hidden' name='CLASS' value='$qossettings{'CLASS'}' /><input type='submit' name='DOLEVEL7' value='$Lang::tr{'save'}' />
907 <tr><td colspan="3" align='center'><font color="red"><em>$Lang::tr{'qos warning'}</em></font>
915 &Header
::openbox
('100%', 'center', $Lang::tr
{'Add Port Rule'});
917 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
919 <tr><td width='100%' colspan='3'>$Lang::tr{'enter data'}
920 <tr><td width='33%' align='right'>$Lang::tr{'protocol'}:
921 <td width='33%' align='left'><select name='PPROT'>
924 open( FILE
, "< /etc/protocols" );
927 foreach $direntry (sort @proto)
929 @tmpline = split( /\ /, $direntry );
930 next if $tmpline[0] =~ "#";
931 if ( $tmpline[0] eq $qossettings{'PPROT'} ) {
932 print "<option value='$tmpline[0]' selected>$tmpline[0]</option>\n";
934 print "<option value='$tmpline[0]'>$tmpline[0]</option>\n";
938 </select><td width='33%' align='center'>
939 <tr><td width='33%' align='right'>$Lang::tr{'source port'}:
940 <td width='33%' align='left'><input type='text' name='QPORT' maxlength='11' value='$qossettings{'QPORT'}' />
941 <td width='33%' align='center'>
942 <tr><td width='33%' align='right'>$Lang::tr{'destination port'}:
943 <td width='33%' align='left'><input type='text' name='DPORT' maxlength='11' value='$qossettings{'DPORT'}' />
944 <td width='33%' align='center'>
945 <tr><td width='33%' align='right'>$Lang::tr{'source ip'}:
946 <td width='33%' align='left'><input type='text' name='QIP' maxlength='31' value='$qossettings{'QIP'}' />
947 <td width='33%' align='center'>
948 <tr><td width='33%' align='right'>$Lang::tr{'destination ip'}:
949 <td width='33%' align='left'><input type='text' name='DIP' maxlength='31' value='$qossettings{'DIP'}' />
950 <td width='33%' align='center'><input type='hidden' name='CLASS' value='$qossettings{'CLASS'}' /><input type='submit' name='DOPORT' value='$Lang::tr{'save'}' />
958 &Header
::openbox
('100%', 'center', $Lang::tr
{'TOS Rule'});
959 if ($qossettings{'TOS'}) {
960 $checked{$qossettings{'TOS'}} = "checked";
963 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
967 if ( $message ne "" ) {
968 print "<tr><td colspan='3' align='center'><font color='red'>$message</font>";
971 <tr><td colspan='2' width='100%'>$Lang::tr{'current class'}: $qossettings{'CLASS'}
972 <tr><td width='100%' colspan='2'>$Lang::tr{'Enter TOS'}
973 <tr><td width='50%' align='left'>$Lang::tr{'min delay'} (8) <td width='50%'><input type="radio" name="TOS" value="8" $checked[8] />
974 <tr><td width='50%' align='left'>$Lang::tr{'max throughput'} (4) <td width='50%'><input type="radio" name="TOS" value="4" $checked[4] />
975 <tr><td width='50%' align='left'>$Lang::tr{'max reliability'} (2) <td width='50%'><input type="radio" name="TOS" value="2" $checked[2] />
976 <tr><td width='50%' align='left'>$Lang::tr{'min costs'} (1) <td width='50%'><input type="radio" name="TOS" value="1" $checked[1] />
977 <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'}' />
985 $qossettings{'DEV'} = shift;
986 open( FILE
, "< $classfile" ) or die "Unable to read $classfile";
990 open( FILE
, "< $level7file" ) or die "Unable to read $level7file";
993 open( FILE
, "< $tosfile" ) or die "Unable to read $tosfile";
996 open( FILE
, "< $portfile" ) or die "Unable to read $portfile";
999 foreach $classentry (sort @classes)
1001 @classline = split( /\;/, $classentry );
1002 if ( $classline[0] eq $qossettings{'DEV'} )
1004 &Header
::openbox
('100%', 'center', "$Lang::tr{'Class'}: $classline[1] $classline[8]");
1006 <table border='0' width='100%' cellspacing='0'>
1007 <tr><td bgcolor='$color{'color20'}' width='10%' align='center'><b>$Lang::tr{'interface'}</b>
1008 <td bgcolor='$color{'color20'}' width='10%' align='center'><b>$Lang::tr{'Class'}</b>
1009 <td bgcolor='$color{'color20'}' width='10%' align='center'>$Lang::tr{'priority'}
1010 <td bgcolor='$color{'color20'}' width='10%' align='center'>$Lang::tr{'guaranteed bandwith'}
1011 <td bgcolor='$color{'color20'}' width='10%' align='center'>$Lang::tr{'max bandwith'}
1012 <td bgcolor='$color{'color20'}' width='10%' align='center'>Burst
1013 <td bgcolor='$color{'color20'}' width='10%' align='center'>Ceil Burst
1014 <td bgcolor='$color{'color20'}' width='10%' align='center'>TOS
1015 <td bgcolor='$color{'color20'}' width='20%' align='center'>$Lang::tr{'action'}
1016 <tr><td align='center' bgcolor='$color{'color22'}'>$classline[0]</td>
1017 <td align='center' bgcolor='$color{'color22'}'>$classline[1]</td>
1018 <td align='center' bgcolor='$color{'color22'}'>$classline[2]</td>
1019 <td align='center' bgcolor='$color{'color22'}'>$classline[3]</td>
1020 <td align='center' bgcolor='$color{'color22'}'>$classline[4]</td>
1021 <td align='center' bgcolor='$color{'color22'}'>$classline[5]</td>
1022 <td align='center' bgcolor='$color{'color22'}'>$classline[6]</td>
1023 <td align='center' bgcolor='$color{'color22'}'>$classline[7]</td>
1024 <td align='right' bgcolor='$color{'color22'}'>
1025 <table border='0'><tr>
1026 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1027 <input type='hidden' name='CLASS' value='$classline[1]' />
1028 <input type='hidden' name='ACTION' value='$Lang::tr{'Add Rule'}' />
1029 <input type='image' alt='$Lang::tr{'Add Rule'}' title='$Lang::tr{'Add Rule'}' src='/images/addgreen.gif' />
1031 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1032 <input type='hidden' name='CLASS' value='$classline[1]' />
1033 <input type='hidden' name='DOCLASS' value='$Lang::tr{'edit'}' />
1034 <input type='image' alt='$Lang::tr{'edit'}' title='$Lang::tr{'edit'}' src='/images/edit.gif' />
1036 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1037 <input type='hidden' name='CLASS' value='$classline[1]' />
1038 <input type='hidden' name='DOCLASS' value='$Lang::tr{'delete'}' />
1039 <input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/delete.gif' />
1043 <tr><td align='right' colspan='2'><b>$Lang::tr{'remark'}:</b>
1044 <td align='center' colspan='6'> $classline[8]
1045 <td align='right'><b>Queueing:</b> $classline[9]
1050 foreach $l7ruleentry (sort @l7rules)
1052 @l7ruleline = split( /\;/, $l7ruleentry );
1053 if ( $l7ruleline[0] eq $classline[1] )
1056 <tr><td align='right' colspan='2'><b>$Lang::tr{'Level7 Protocol'}:</b>
1057 <td align='center' colspan='6'>$l7ruleline[2]
1059 <table border='0'><tr>
1060 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1061 <input type='hidden' name='CLASS' value='$l7ruleline[0]' />
1062 <input type='hidden' name='L7PROT' value='$l7ruleline[2]' />
1063 <input type='hidden' name='DOLEVEL7' value='$Lang::tr{'edit'}' />
1064 <input type='image' alt='$Lang::tr{'edit'}' title='$Lang::tr{'edit'}' src='/images/edit.gif' />
1066 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1067 <input type='hidden' name='CLASS' value='$l7ruleline[0]' />
1068 <input type='hidden' name='L7PROT' value='$l7ruleline[2]' />
1069 <input type='hidden' name='DOLEVEL7' value='$Lang::tr{'delete'}' />
1070 <input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/delete.gif' />
1075 if (($l7ruleline[3] ne "") || ($l7ruleline[4] ne "")){
1077 <tr><td align='center'>
1078 <td align='right' colspan='3'><b>$Lang::tr{'source ip'}:</b> $l7ruleline[3]
1079 <td align='right' colspan='3'><b>$Lang::tr{'destination ip'}:</b> $l7ruleline[4]
1093 foreach $portruleentry (sort @portrules)
1095 @portruleline = split( /\;/, $portruleentry );
1096 if ( $portruleline[0] eq $classline[1] )
1099 <tr><td align='right' colspan='2'><b>$Lang::tr{'Port Rule'}:</b>
1100 <td align='center'>($portruleline[2])
1101 <td align='center' colspan='2'>
1104 if ($portruleline[4]) {
1106 <i>$Lang::tr{'source port'}:</i> $portruleline[4]
1110 print "<td align='center' colspan='2'>";
1111 if ($portruleline[6]) {
1113 <i>$Lang::tr{'destination port'}:</i> $portruleline[6]
1120 <table border='0'><tr>
1121 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1122 <input type='hidden' name='CLASS' value='$portruleline[0]' />
1123 <input type='hidden' name='PPROT' value='$portruleline[2]' />
1124 <input type='hidden' name='QIP' value='$portruleline[3]' />
1125 <input type='hidden' name='QPORT' value='$portruleline[4]' />
1126 <input type='hidden' name='DIP' value='$portruleline[5]' />
1127 <input type='hidden' name='DPORT' value='$portruleline[6]' />
1128 <input type='hidden' name='DOPORT' value='$Lang::tr{'edit'}' />
1129 <input type='image' alt='$Lang::tr{'edit'}' title='$Lang::tr{'edit'}' src='/images/edit.gif' />
1131 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1132 <input type='hidden' name='CLASS' value='$portruleline[0]' />
1133 <input type='hidden' name='PPROT' value='$portruleline[2]' />
1134 <input type='hidden' name='QIP' value='$portruleline[3]' />
1135 <input type='hidden' name='QPORT' value='$portruleline[4]' />
1136 <input type='hidden' name='DIP' value='$portruleline[5]' />
1137 <input type='hidden' name='DPORT' value='$portruleline[6]' />
1138 <input type='hidden' name='DOPORT' value='$Lang::tr{'delete'}' />
1139 <input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/delete.gif' />
1144 if (($portruleline[3] ne "") || ($portruleline[5] ne "")){
1146 <tr><td align='center'>
1147 <td align='right' colspan='3'><b>$Lang::tr{'source ip'}:</b> $portruleline[3]
1148 <td align='right' colspan='3'><b>$Lang::tr{'destination ip'}:</b> $portruleline[5]
1157 foreach $tosruleentry (sort @tosrules)
1159 @tosruleline = split( /\;/, $tosruleentry );
1160 if ( $tosruleline[0] eq $classline[1] )
1163 <tr><td align='right' colspan='2'>
1164 <b>TOS Bit matches:</b>
1165 <td colspan='6' align='center'>
1168 if ( $tosruleline[2] eq "8") {
1169 print "$Lang::tr{'min delay'}\n";
1170 } elsif ( $tosruleline[2] eq "4") {
1171 print "$Lang::tr{'max throughput'}\n";
1172 } elsif ( $tosruleline[2] eq "2") {
1173 print "$Lang::tr{'max reliability'}\n";
1174 } elsif ( $tosruleline[2] eq "1") {
1175 print "$Lang::tr{'min costs'}\n";
1176 } else { print " \n"; }
1181 <table border='0'><tr>
1182 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1183 <input type='hidden' name='CLASS' value='$tosruleline[0]' />
1184 <input type='hidden' name='DEV' value='$tosruleline[1]' />
1185 <input type='hidden' name='TOS' value='$tosruleline[2]' />
1186 <input type='hidden' name='DOTOS' value='$Lang::tr{'edit'}' />
1187 <input type='image' alt='$Lang::tr{'edit'}' title='$Lang::tr{'edit'}' src='/images/edit.gif' />
1189 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1190 <input type='hidden' name='CLASS' value='$tosruleline[0]' />
1191 <input type='hidden' name='DEV' value='$tosruleline[1]' />
1192 <input type='hidden' name='TOS' value='$tosruleline[2]' />
1193 <input type='hidden' name='DOTOS' value='$Lang::tr{'delete'}' />
1194 <input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/delete.gif' />
1208 &Header
::closebox
();
1214 if ( $qossettings{'VALID'} eq 'yes' ) {
1215 if ( $qossettings{'DEVICE'} eq $qossettings{'RED_DEV'} ) {
1216 $qossettings{'SPD'} = $qossettings{'OUT_SPD'};
1217 } elsif ( $qossettings{'DEVICE'} eq $qossettings{'IMQ_DEV'} ) {
1218 $qossettings{'SPD'} = $qossettings{'INC_SPD'};
1220 unless ( ( $qossettings{'MINBWDTH'} >= 1 ) && ( $qossettings{'MINBWDTH'} <= $qossettings{'SPD'} ) ) {
1221 $qossettings{'VALID'} = 'no';
1222 $message = "$Lang::tr{'false min bandwith'}";
1224 $qossettings{'SPD'} = '';
1229 if ( $qossettings{'VALID'} eq 'yes' ) {
1230 if ( $qossettings{'DEVICE'} eq $qossettings{'RED_DEV'} ) {
1231 $qossettings{'SPD'} = $qossettings{'OUT_SPD'};
1232 } elsif ( $qossettings{'DEVICE'} eq $qossettings{'IMQ_DEV'} ) {
1233 $qossettings{'SPD'} = $qossettings{'INC_SPD'};
1235 unless ( ( $qossettings{'MAXBDWTH'} >= 0 ) && ($qossettings{'MAXBDWTH'} >= $qossettings{'MINBDWTH'}) &&( $qossettings{'MAXBDWTH'} <= $qossettings{'SPD'} ) ) {
1236 $qossettings{'VALID'} = 'no';
1237 $message = "$Lang::tr{'false max bandwith'}";
1239 $qossettings{'SPD'} = '';
1244 if ( $qossettings{'VALID'} eq 'yes' ) {
1245 if ( $qossettings{'DEVICE'} eq $qossettings{'RED_DEV'} ) {
1246 if ($qossettings{'CLASS'} lt 100 || $qossettings{'CLASS'} ge 121) {
1247 $qossettings{'VALID'} = 'no';
1248 $message = "$Lang::tr{'false classnumber'}";
1250 } elsif ( $qossettings{'DEVICE'} eq $qossettings{'IMQ_DEV'} ) {
1251 if ($qossettings{'CLASS'} lt 200 || $qossettings{'CLASS'} ge 221) {
1252 $qossettings{'VALID'} = 'no';
1253 $message = "$Lang::tr{'The class number does not match the specified interface.'}";
1256 open( FILE
, "< $classfile" ) or die "Unable to read $classfile";
1259 foreach $classentry (sort @tmp)
1261 @tmpline = split( /\;/, $classentry );
1262 if ( $tmpline[1] eq $qossettings{'CLASS'} )
1264 $qossettings{'VALID'} = 'no';
1265 $message = "$Lang::tr{'false classnumber'}";