]>
git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - html/cgi-bin/qos.cgi
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{'ACK'} = '';
72 $qossettings{'RED_DEV'} = 'ppp0';
73 $qossettings{'IMQ_DEV'} = 'imq0';
74 $qossettings{'VALID'} = 'yes';
75 ### Values that have to be initialized
76 $qossettings{'ACTION'} = '';
77 $qossettings{'ACTIONDEF'} = '';
78 $qossettings{'ACTIONBW'} = '';
79 $qossettings{'RED_DEV_SEL'} = '';
80 $qossettings{'IMQ_DEV_SEL'} = '';
81 $qossettings{'PRIO'} = '';
82 $qossettings{'SPD'} = '';
83 $qossettings{'CLASS'} = '';
84 $qossettings{'QPORT'} = '';
85 $qossettings{'DPORT'} = '';
86 $qossettings{'QIP'} = '';
87 $qossettings{'DIP'} = '';
88 $qossettings{'PPROT'} = '';
89 $qossettings{'L7PROT'} = '';
90 $qossettings{'DEVICE'} = '';
91 $qossettings{'MINBWDTH'} = '';
92 $qossettings{'MAXBWDTH'} = '';
93 $qossettings{'BURST'} = '';
94 $qossettings{'CBURST'} = '';
95 $qossettings{'DOCLASS'} = '';
96 $qossettings{'DOLEVEL7'} = '';
97 $qossettings{'DOPORT'} = '';
98 $qossettings{'CLASS'} = '';
99 $qossettings{'CLASSPRFX'} = '';
100 $qossettings{'DEV'} = '';
101 $qossettings{'TOS'} = '';
104 &General
::readhash
("${General::swroot}/qos/settings", \
%qossettings);
105 &Header
::getcgihash
(\
%qossettings);
107 $qossettings{'RED_DEV'} = &General
::get_red_interface
();
110 my %mainsettings = ();
111 &General
::readhash
("${General::swroot}/main/settings", \
%mainsettings);
112 &General
::readhash
("/srv/web/ipfire/html/themes/ipfire/include/colors.txt", \
%color);
114 &Header
::showhttpheaders
();
116 &Header
::openpage
('QoS', 1, '');
117 &Header
::openbigbox
('100%', 'left', '', $errormessage);
119 ############################################################################################################################
120 ############################################################################################################################
122 if ($qossettings{'DOCLASS'} eq $Lang::tr
{'save'})
127 if ( $qossettings{'VALID'} eq 'yes' ) {
128 open( FILE
, ">> $classfile" ) or die "Unable to write $classfile";
130 $qossettings{'DEVICE'};$qossettings{'CLASS'};$qossettings{'PRIO'};$qossettings{'MINBWDTH'};$qossettings{'MAXBWDTH'};$qossettings{'BURST'};$qossettings{'CBURST'};$qossettings{'TOS'};$qossettings{'REMARK'};
135 $qossettings{'ACTION'} = $Lang::tr
{'parentclass add'};
138 elsif ($qossettings{'DOCLASS'} eq $Lang::tr
{'edit'})
140 open( FILE
, "< $classfile" ) or die "Unable to read $classfile";
143 open( FILE
, "> $classfile" ) or die "Unable to write $classfile";
144 foreach $classentry (sort @classes)
146 @classline = split( /\;/, $classentry );
147 if ( $classline[1] ne $qossettings{'CLASS'} ) {
148 print FILE
$classentry;
150 $qossettings{'DEVICE'} = $classline[0];
151 $qossettings{'PRIO'} = $classline[2];
152 $qossettings{'MINBWDTH'} = $classline[3];
153 $qossettings{'MAXBWDTH'} = $classline[4];
154 $qossettings{'BURST'} = $classline[5];
155 $qossettings{'CBURST'} = $classline[6];
156 $qossettings{'TOS'} = $classline[7];
157 $qossettings{'REMARK'} = $classline[8];
158 $qossettings{'EDIT'} = 'yes';
163 &Header
::closebigbox
();
164 &Header
::closepage
();
167 elsif ($qossettings{'DOCLASS'} eq $Lang::tr
{'delete'})
169 open( FILE
, "< $classfile" ) or die "Unable to read $classfile";
172 open( FILE
, "> $classfile" ) or die "Unable to write $classfile";
173 foreach $classentry (sort @tmp)
175 @tmpline = split( /\;/, $classentry );
176 if ( $tmpline[1] ne $qossettings{'CLASS'} )
178 print FILE
$classentry;
182 $message = "$Lang::tr{'Class'} $qossettings{'CLASS'} $Lang::tr{'Class was deleted'}";
185 ############################################################################################################################
186 ############################################################################################################################
188 if ($qossettings{'DOLEVEL7'} eq $Lang::tr
{'save'})
190 if ( $qossettings{'QIP'} ne '' ) {
191 if ((!&General
::validipandmask
($qossettings{'QIP'})) && (!&General
::validip
($qossettings{'QIP'}))) {
192 $qossettings{'VALID'} = 'no';
193 $message = $Lang::tr
{'The source IP address is invalid.'};
196 if ( $qossettings{'DIP'} ne '' ) {
197 if ((!&General
::validipandmask
($qossettings{'DIP'})) && (!&General
::validip
($qossettings{'DIP'}))) {
198 $qossettings{'VALID'} = 'no';
199 $message = $Lang::tr
{'The destination IP address is invalid.'};
202 if ($qossettings{'CLASS'} >= 100 && $qossettings{'CLASS'} < 121) {
203 $qossettings{'DEVICE'} = $qossettings{'RED_DEV'};
204 } elsif ($qossettings{'CLASS'} >= 1000 && $qossettings{'CLASS'} < 1021) {
205 $qossettings{'DEVICE'} = $qossettings{'RED_DEV'};
206 } elsif ($qossettings{'CLASS'} >= 200 && $qossettings{'CLASS'} < 221) {
207 $qossettings{'DEVICE'} = $qossettings{'IMQ_DEV'};
208 } elsif ($qossettings{'CLASS'} >= 2000 && $qossettings{'CLASS'} < 2021) {
209 $qossettings{'DEVICE'} = $qossettings{'IMQ_DEV'};
211 if ( $qossettings{'VALID'} eq 'yes' ) {
212 open( FILE
, ">> $level7file" ) or die "Unable to write $level7file";
214 $qossettings{'CLASS'};$qossettings{'DEVICE'};$qossettings{'L7PROT'};$qossettings{'QIP'};$qossettings{'DIP'};
219 $qossettings{'ACTION'} = $Lang::tr
{'Add Level7 rule'};
221 } elsif ($qossettings{'DOLEVEL7'} eq $Lang::tr
{'delete'})
223 open( FILE
, "< $level7file" ) or die "Unable to read $level7file";
226 &General
::system("rm", "$level7file");
227 foreach $l7ruleentry (sort @l7rules)
229 @l7ruleline = split( /\;/, $l7ruleentry );
230 if ( ($l7ruleline[0] eq $qossettings{'CLASS'}) && ($l7ruleline[2] eq $qossettings{'L7PROT'}))
231 {$message = "$Lang::tr{'Level7 Rule'} ($qossettings{'CLASS'} - $qossettings{'L7PROT'}) $Lang::tr{'was deleted'}.";}
233 { open( FILE
, ">> $level7file" ) or die "Unable to read $level7file";
234 print FILE
$l7ruleentry;
238 open( FILE
, "< $level7file" ) or &General
::system("touch", "$level7file");close FILE
;
239 } elsif ($qossettings{'DOLEVEL7'} eq $Lang::tr
{'edit'})
241 open( FILE
, "< $level7file" ) or die "Unable to read $level7file";
244 &General
::system("rm", "$level7file");
245 foreach $l7ruleentry (sort @l7rules)
247 @l7ruleline = split( /\;/, $l7ruleentry );
248 if ( ($l7ruleline[0] eq $qossettings{'CLASS'}) && ($l7ruleline[2] eq $qossettings{'L7PROT'}))
249 {$qossettings{'QIP'} = $l7ruleline[3];$qossettings{'DIP'} = $l7ruleline[4];}
251 open( FILE
, ">> $level7file" ) or die "Unable to write $level7file";
252 print FILE
$l7ruleentry;
257 open( FILE
, "< $level7file" ) or &General
::system("touch", "$level7file");close FILE
;
260 ############################################################################################################################
261 ############################################################################################################################
263 if ($qossettings{'DOPORT'} eq $Lang::tr
{'save'})
265 if ( $qossettings{'QIP'} ne '' ) {
266 if ((!&General
::validipandmask
($qossettings{'QIP'})) && (!&General
::validip
($qossettings{'QIP'}))) {
267 $qossettings{'VALID'} = 'no';
268 $message = $Lang::tr
{'The source IP address is invalid.'};
271 if ( $qossettings{'DIP'} ne '' ) {
272 if ((!&General
::validipandmask
($qossettings{'DIP'})) && (!&General
::validip
($qossettings{'DIP'}))) {
273 $qossettings{'VALID'} = 'no';
274 $message = $Lang::tr
{'The destination IP address is invalid.'};
277 if ($qossettings{'CLASS'} >= 100 && $qossettings{'CLASS'} < 121) {
278 $qossettings{'DEVICE'} = $qossettings{'RED_DEV'};
279 } elsif ($qossettings{'CLASS'} >= 1000 && $qossettings{'CLASS'} < 1021) {
280 $qossettings{'DEVICE'} = $qossettings{'RED_DEV'};
281 } elsif ($qossettings{'CLASS'} >= 200 && $qossettings{'CLASS'} < 221) {
282 $qossettings{'DEVICE'} = $qossettings{'IMQ_DEV'};
283 } elsif ($qossettings{'CLASS'} >= 2000 && $qossettings{'CLASS'} < 2021) {
284 $qossettings{'DEVICE'} = $qossettings{'IMQ_DEV'};
286 if ( $qossettings{'VALID'} eq 'yes' ) {
287 open( FILE
, ">> $portfile" ) or die "Unable to write $portfile";
289 $qossettings{'CLASS'};$qossettings{'DEVICE'};$qossettings{'PPROT'};$qossettings{'QIP'};$qossettings{'QPORT'};$qossettings{'DIP'};$qossettings{'DPORT'};
294 $qossettings{'ACTION'} = $Lang::tr
{'Add Port Rule'};
296 } elsif ($qossettings{'DOPORT'} eq $Lang::tr
{'delete'})
298 open( FILE
, "< $portfile" ) or die "Unable to read $portfile";
301 open( FILE
, "> $portfile" ) or die "Unable to read $portfile";
302 foreach $portruleentry (sort @portrules)
304 @portruleline = split( /\;/, $portruleentry );
305 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'}))
307 print FILE
$portruleentry;
311 $message = "$Lang::tr{'Port Rule'} ($qossettings{'CLASS'} - $qossettings{'PPROT'}) $Lang::tr{'was deleted'}.";
312 } elsif ($qossettings{'DOPORT'} eq $Lang::tr
{'edit'})
314 open( FILE
, "< $portfile" ) or die "Unable to read $portfile";
317 &General
::system("rm", "$portfile");
318 foreach $portruleentry (sort @portrules)
320 @portruleline = split( /\;/, $portruleentry );
321 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'}))
322 {$qossettings{'CLASS'}=$portruleline[0];$qossettings{'PPROT'}=$portruleline[2];$qossettings{'QIP'}=$portruleline[3];$qossettings{'QPORT'}=$portruleline[4];$qossettings{'DIP'}=$portruleline[5];$qossettings{'DPORT'}=$portruleline[6];}
324 open( FILE
, ">> $portfile" ) or die "Unable to write $portfile";
325 print FILE
$portruleentry;
330 open( FILE
, "< $portfile" ) or &General
::system("touch", "$portfile");close FILE
;
333 ############################################################################################################################
334 ############################################################################################################################
336 if ($qossettings{'DOTOS'} eq $Lang::tr
{'save'})
338 if ($qossettings{'CLASS'} >= 100 && $qossettings{'CLASS'} < 121) {
339 $qossettings{'DEVICE'} = $qossettings{'RED_DEV'};
340 } elsif ($qossettings{'CLASS'} >= 1000 && $qossettings{'CLASS'} < 1021) {
341 $qossettings{'DEVICE'} = $qossettings{'RED_DEV'};
342 } elsif ($qossettings{'CLASS'} >= 200 && $qossettings{'CLASS'} < 221) {
343 $qossettings{'DEVICE'} = $qossettings{'IMQ_DEV'};
344 } elsif ($qossettings{'CLASS'} >= 2000 && $qossettings{'CLASS'} < 2021) {
345 $qossettings{'DEVICE'} = $qossettings{'IMQ_DEV'};
347 open( FILE
, ">> $tosfile" ) or die "Unable to write $tosfile";
349 $qossettings{'CLASS'};$qossettings{'DEVICE'};$qossettings{'TOS'};
354 elsif ($qossettings{'DOTOS'} eq 'Loeschen')
356 open( FILE
, "< $tosfile" ) or die "Unable to read $tosfile";
359 open( FILE
, "> $tosfile" ) or die "Unable to read $tosfile";
360 foreach $tosruleentry (sort @tosrules)
362 @tosruleline = split( /\;/, $tosruleentry );
363 unless ( ($tosruleline[0] eq $qossettings{'CLASS'}) && ($tosruleline[2] eq $qossettings{'TOS'}))
365 print FILE
$tosruleentry;
369 $message = "$Lang::tr{'TOS Rule'} ($qossettings{'CLASS'} - $qossettings{'TOS'}) $Lang::tr{'was deleted'}.";
370 } elsif ($qossettings{'DOTOS'} eq $Lang::tr
{'edit'})
372 open( FILE
, "< $tosfile" ) or die "Unable to read $tosfile";
375 open( FILE
, "> $tosfile" ) or die "Unable to write $tosfile";
376 foreach $tosruleentry (sort @tosrules)
378 @tosruleline = split( /\;/, $tosruleentry );
379 if (( $tosruleline[0] eq $qossettings{'CLASS'} ) && ( $tosruleline[2] eq $qossettings{'TOS'} )) {
380 $qossettings{'DEVICE'} = $tosruleline[1];
381 $qossettings{'CLASS'} = $tosruleline[0];
382 $qossettings{'TOS'} = $tosruleline[2];
383 $qossettings{'EDIT'} = 'yes';
385 print FILE
$tosruleentry;
390 &Header
::closebigbox
();
391 &Header
::closepage
();
395 ############################################################################################################################
396 ############################################################################################################################
398 if ($qossettings{'ACTION'} eq $Lang::tr
{'start'})
400 $qossettings{'ENABLED'} = 'on';
401 &General
::writehash
("${General::swroot}/qos/settings", \
%qossettings);
402 &General
::system("/usr/local/bin/qosctrl", "generate");
403 &General
::system("/usr/local/bin/qosctrl", "start");
404 &General
::system("logger", "-t", "ipfire", "QoS started");
406 elsif ($qossettings{'ACTION'} eq $Lang::tr
{'stop'})
408 $qossettings{'ENABLED'} = 'off';
409 &General
::writehash
("${General::swroot}/qos/settings", \
%qossettings);
410 &General
::system("/usr/local/bin/qosctrl", "stop");
411 &General
::system("/usr/local/bin/qosctrl", "generate");
412 &General
::system("logger", "-t", "ipfire", "QoS stopped");
414 elsif ($qossettings{'ACTION'} eq $Lang::tr
{'restart'})
416 if ($qossettings{'ENABLED'} eq 'on'){
417 &General
::system("/usr/local/bin/qosctrl", "stop");
418 &General
::system("/usr/local/bin/qosctrl", "generate");
419 &General
::system("/usr/local/bin/qosctrl", "start");
420 &General
::system("logger", "-t", "ipfire", "QoS restarted");
423 elsif ($qossettings{'ACTION'} eq $Lang::tr
{'save'})
425 if ($qossettings{'DEF_INC_SPD'} eq '') {
426 $qossettings{'DEF_INC_SPD'} = int($qossettings{'INC_SPD'} * 0.9);
428 if ($qossettings{'DEF_OUT_SPD'} eq '') {
429 $qossettings{'DEF_OUT_SPD'} = int($qossettings{'OUT_SPD'} * 0.9);
431 &General
::writehash
("${General::swroot}/qos/settings", \
%qossettings);
433 elsif ($qossettings{'ACTION'} eq $Lang::tr
{'template'} )
435 if (($qossettings{'OUT_SPD'} > 0) && ($qossettings{'INC_SPD'} > 0)) {
438 for(my $i = 1; $i <= 10; $i++) {
439 $UP[$i] = int($qossettings{'OUT_SPD'} / $i );
440 #print $i."=".$UP[$i]." ";
443 #print "<br /><br />Down<br />";
444 for(my $i = 1; $i <= 20; $i++) {
445 $DOWN[$i] = int($qossettings{'INC_SPD'} / $i);
446 #print $i."=".$DOWN[$i]." ";
448 open( FILE
, "> $classfile" ) or die "Unable to write $classfile";
450 imq0;200;1;$DOWN[20];$DOWN[1];;;8;VoIP;
451 imq0;203;4;$DOWN[20];$DOWN[1];;;0;VPN;
452 imq0;204;5;$DOWN[20];$DOWN[1];;;8;Webtraffic;
453 imq0;210;6;1;$DOWN[1];;;0;Default;
454 imq0;220;7;1;$DOWN[1];;;1;P2P;
455 $qossettings{'RED_DEV'};101;1;$UP[10];$UP[1];;;8;ACKs;
456 $qossettings{'RED_DEV'};102;2;$UP[10];$UP[1];;;8;VoIP;
457 $qossettings{'RED_DEV'};103;4;$UP[10];$UP[1];;;2;VPN;
458 $qossettings{'RED_DEV'};104;5;$UP[10];$UP[1];;;8;Webtraffic;
459 $qossettings{'RED_DEV'};110;6;1;$UP[1];;;0;Default;
460 $qossettings{'RED_DEV'};120;7;1;$UP[1];;;1;P2P;
464 open( FILE
, "> $level7file" ) or die "Unable to write $level7file";
466 102;$qossettings{'RED_DEV'};dns;;;
467 102;$qossettings{'RED_DEV'};rtp;;;
468 102;$qossettings{'RED_DEV'};skypetoskype;;;
469 103;$qossettings{'RED_DEV'};ssh;;;
470 103;$qossettings{'RED_DEV'};rdp;;;
471 104;$qossettings{'RED_DEV'};http;;;
472 104;$qossettings{'RED_DEV'};ssl;;;
473 104;$qossettings{'RED_DEV'};pop3;;;
474 120;$qossettings{'RED_DEV'};applejuice;;;
475 120;$qossettings{'RED_DEV'};bittorrent;;;
477 200;imq0;skypetoskype;;;
483 220;imq0;applejuice;;;
484 220;imq0;bittorrent;;;
488 open( FILE
, "> $portfile" ) or die "Unable to write $portfile";
490 101;$qossettings{'RED_DEV'};icmp;;;;;
491 102;$qossettings{'RED_DEV'};tcp;;;;53;
492 102;$qossettings{'RED_DEV'};udp;;;;53;
493 103;$qossettings{'RED_DEV'};esp;;;;;
494 103;$qossettings{'RED_DEV'};tcp;;1194;;;
495 103;$qossettings{'RED_DEV'};udp;;1194;;;
496 103;$qossettings{'RED_DEV'};tcp;;;;1194;
497 103;$qossettings{'RED_DEV'};udp;;;;1194;
498 103;$qossettings{'RED_DEV'};udp;;4500;;4500;
499 103;$qossettings{'RED_DEV'};udp;;500;;500;
500 104;$qossettings{'RED_DEV'};tcp;;;;80;
503 203;imq0;tcp;;;;1194;
504 203;imq0;udp;;;;1194;
505 203;imq0;tcp;;1194;;;
506 203;imq0;udp;;1194;;;
507 203;imq0;udp;;4500;;4500;
508 203;imq0;udp;;500;;500;
513 if ($qossettings{'DEF_INC_SPD'} eq '') {
514 $qossettings{'DEF_INC_SPD'} = int($qossettings{'INC_SPD'} * 0.9);
516 if ($qossettings{'DEF_OUT_SPD'} eq '') {
517 $qossettings{'DEF_OUT_SPD'} = int($qossettings{'OUT_SPD'} * 0.9);
519 $qossettings{'DEFCLASS_INC'} = "210";
520 $qossettings{'DEFCLASS_OUT'} = "110";
521 $qossettings{'ACK'} ="101";
522 $qossettings{'ENABLED'} = 'on';
523 &General
::writehash
("${General::swroot}/qos/settings", \
%qossettings);
524 &General
::system("/usr/local/bin/qosctrl", "generate");
525 &General
::system("/usr/local/bin/qosctrl", "start");
526 &General
::system("logger", "-t", "ipfire", "QoS started");
528 $message = $Lang::tr
{'qos enter bandwidths'};
531 elsif ($qossettings{'ACTION'} eq $Lang::tr
{'status'} )
533 &Header
::openbox
('100%', 'left', 'QoS Status');
534 if ($qossettings{'ENABLED'} eq 'on'){
536 my @output = &General
::system_output
("/usr/local/bin/qosctrl", "status");
537 $output = &Header
::cleanhtml
(@output[0],"y");
538 print "<pre>$output</pre>\n";
539 } else { print "$Lang::tr{'QoS not enabled'}"; }
541 &Header
::closebigbox
();
542 &Header
::closepage
();
545 elsif ($qossettings{'ACTION'} eq $Lang::tr
{'parentclass add'} )
548 &Header
::closebigbox
();
549 &Header
::closepage
();
552 elsif ($qossettings{'ACTION'} eq $Lang::tr
{'Add Rule'})
554 &Header
::openbox
('100%', 'center', $Lang::tr
{'Add Rule'});
557 <tr><td align='center'>$Lang::tr{'Choose Rule'}
558 <tr><td align='center'>
559 <input type="button" onClick="swapVisibility('l7rule')" value='$Lang::tr{'Level7 Rule'}' />
560 <input type="button" onClick="swapVisibility('portrule')" value='$Lang::tr{'Port Rule'}' />
561 <input type="button" onClick="swapVisibility('tosrule')" value='$Lang::tr{'TOS rule'}' />
567 <div id='l7rule' style='display: none'>
573 <div id='portrule' style='display: none'>
579 <div id='tosrule' style='display: none'>
587 &Header
::closebigbox
();
588 &Header
::closepage
();
591 if ($qossettings{'ACTIONBW'} eq "$Lang::tr{'modify'}" )
594 &Header
::closebigbox
();
595 &Header
::closepage
();
598 if ($qossettings{'ACTIONDEF'} eq "$Lang::tr{'modify'}" )
601 &Header
::closebigbox
();
602 &Header
::closepage
();
606 &General
::readhash
("${General::swroot}/qos/settings", \
%qossettings);
608 my $status = $Lang::tr
{'stopped'};
609 my $statuscolor = '#993333';
610 if ( $qossettings{'ENABLED'} eq 'on' ) {
611 $status = $Lang::tr
{'running'};
612 $statuscolor = '#339933';
615 if ( $netsettings{'RED_TYPE'} ne 'PPPOE' ) {
616 $qossettings{'RED_DEV'} = $netsettings{'RED_DEV'};
620 &Header
::openbox
('100%', 'left', $Lang::tr
{'error messages'});
621 print "<class name='base'>$errormessage\n";
622 print " </class>\n";
626 ############################################################################################################################
627 ############################################################################################################################
629 &Header
::openbox
('100%', 'center', );
632 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
636 if ( $message ne "" ) {
637 print "<tr><td colspan='2' align='center'><font color='red'>$message</font></tr>";
640 <tr><td width='50%' align='left'><b>Quality of Service:</b></td>
641 <td width='50%' align='center' bgcolor='$statuscolor'><font color='white'>$status</font></td></tr>
643 <td colspan='2'><br></td>
645 <tr><td width='100%' align='right' colspan='2'>
646 <input type='submit' name='ACTION' value="$Lang::tr{'start'}">
647 <input type='submit' name='ACTION' value="$Lang::tr{'stop'}">
648 <input type='submit' name='ACTION' value="$Lang::tr{'restart'}" ></td></tr></table></form>
651 if (($qossettings{'OUT_SPD'} ne '') && ($qossettings{'INC_SPD'} ne '')) {
653 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
655 <tr><td colspan='3'>
656 <tr><td width='50%' align='right'>$Lang::tr{'downlink speed'}: <td width='30%' align='left'>$qossettings{'INC_SPD'}
657 <td width='20%' rowspan='2' align='center' valign='middle'><input type='submit' name='ACTIONBW' value='$Lang::tr{'modify'}' />
658 <tr><td width='50%' align='right'>$Lang::tr{'uplink speed'}: <td width='30%' align='left'>$qossettings{'OUT_SPD'}
663 if (($qossettings{'DEFCLASS_OUT'} ne '') && ($qossettings{'DEFCLASS_INC'} ne '')&& ($qossettings{'ACK'} ne '')) {
665 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
667 <tr><td colspan='3'><hr />
668 <tr><td width='50%' align='right'>$Lang::tr{'downlink std class'}: <td width='30%' align='left'>$qossettings{'DEFCLASS_INC'}
669 <td width='20%' rowspan='3' align='center' valign='middle'><input type='submit' name='ACTIONDEF' value='$Lang::tr{'modify'}' />
670 <tr><td width='50%' align='right'>$Lang::tr{'uplink std class'}: <td width='30%' align='left'>$qossettings{'DEFCLASS_OUT'}
671 <tr><td width='50%' align='right'>ACKs: <td width='30%' align='left'>$qossettings{'ACK'}
672 <tr><td colspan='3' width='100%'><hr />
673 <tr><td colspan='3' width='100%' align='center'>
676 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
677 <table width='66%' border='0'>
678 <tr><td width='100%' align='center'>
679 <input type='submit' name='ACTION' value='$Lang::tr{'parentclass add'}' />
680 <input type='submit' name='ACTION' value='$Lang::tr{'status'}' />
688 if ( ($qossettings{'OUT_SPD'} eq '') || ($qossettings{'INC_SPD'} eq '') ) {
690 &Header
::closebigbox
();
691 &Header
::closepage
();
695 if ( ($qossettings{'DEFCLASS_INC'} eq '') || ($qossettings{'DEFCLASS_OUT'} eq '') || ($qossettings{'ACK'} eq '') ) {
697 &Header
::closebigbox
();
698 &Header
::closepage
();
702 &Header
::openbox
('100%', 'center', "$qossettings{'RED_DEV'} $Lang::tr{'graph'}, $Lang::tr{'uplink'}");
703 &Graphs
::makegraphbox
("qos.cgi",$qossettings{'RED_DEV'},"hour");
705 &Header
::openbox
('100%', 'center', "$qossettings{'IMQ_DEV'} $Lang::tr{'graph'}, $Lang::tr{'downlink'}");
706 &Graphs
::makegraphbox
("qos.cgi",$qossettings{'IMQ_DEV'},"hour");
709 &showclasses
($qossettings{'RED_DEV'});
710 &showclasses
($qossettings{'IMQ_DEV'});
712 &Header
::closebigbox
();
713 &Header
::closepage
();
715 ############################################################################################################################
716 ############################################################################################################################
718 sub changedefclasses
{
719 &Header
::openbox
('100%', 'center', $Lang::tr
{'std classes'});
721 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
723 <tr><td width='100%' colspan='3'>$Lang::tr{'no filter pass'}
724 <tr><td width='33%' align='right'>$Lang::tr{'download'}:<td width='33%' align='left'><select name='DEFCLASS_INC'>
727 for ( $c = 200 ; $c <= 220 ; $c++ )
729 if ( $qossettings{'DEFCLASS_INC'} ne $c )
730 { print "<option value='$c'>$c</option>\n"; }
731 else { print "<option selected value='$c'>$c</option>\n"; }
734 </select><td width='33%' align='center'>
735 <tr><td width='33%' align='right'>$Lang::tr{'upload'}:<td width='33%' align='left'><select name='DEFCLASS_OUT'>
738 for ( $c = 100 ; $c <= 120 ; $c++ )
740 if ( $qossettings{'DEFCLASS_OUT'} ne $c )
741 { print "<option value='$c'>$c</option>\n"; }
742 else { print "<option selected value='$c'>$c</option>\n"; }
745 </select><td width='33%' align='center'>
749 <tr><td width='100%' colspan='3'>$Lang::tr{'enter ack class'}
750 <tr><td width='33%' align='right'>ACKs:<td width='33%' align='left'><select name='ACK'>
753 for ( $c = 100 ; $c <= 120 ; $c++ )
755 if ( $qossettings{'ACK'} ne $c )
756 { print "<option value='$c'>$c</option>\n"; }
757 else { print "<option selected value='$c'>$c</option>\n"; }
760 </select><td width='33%' align='center'><input type='submit' name='ACTION' value="$Lang::tr{'save'}" />
768 sub changebandwidth
{
769 &Header
::openbox
('100%', 'center', $Lang::tr
{'bandwithsettings'});
770 if ($qossettings{'ENABLED'} eq 'on') {
771 print "$Lang::tr{'bandwitherror'}";
772 print "<a href='/cgi-bin/qos.cgi'>$Lang::tr{'back'}</a>";
775 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
776 <input type='hidden' name='DEF_OUT_SPD' value='' /><input type='hidden' name='DEF_INC_SPD' value='' />
778 <tr><td width='100%' colspan='3'>$Lang::tr{'down and up speed'}</td></tr>
779 <tr><td width='50%' align='right'>$Lang::tr{'downlink speed'}:</td>
780 <td width='30%' align='left'><input type='text' name='INC_SPD' maxlength='8' value="$qossettings{'INC_SPD'}" /></td>
781 <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>
782 <tr><td width='50%' align='right'>$Lang::tr{'uplink speed'}:</td>
783 <td width='30%' align='left'><input type='text' name='OUT_SPD' maxlength='8' value="$qossettings{'OUT_SPD'}" /></td></tr>
786 <font color='red'>$Lang::tr{'template warning'}</font>
794 &Header
::openbox
('100%', 'center', $Lang::tr
{'parentclass'});
796 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
800 if ( $message ne "" ) {
801 print "<tr><td colspan='3' align='center'>$message";
803 if ( $qossettings{'EDIT'} eq 'yes' ) {
804 print "<input type='hidden' name='CLASS' value='$qossettings{'CLASS'}' />";
805 print "<input type='hidden' name='DEVICE' value='$qossettings{'DEVICE'}' />";
808 <tr><td width='100%' colspan='3'>$Lang::tr{'enter data'}
809 <tr><td width='33%' align='right'>$Lang::tr{'interface'}:
810 <td width='33%' align='left'>
813 if ( $qossettings{'EDIT'} eq 'yes' ) {
814 print "<select name='DEVICE' disabled>";
816 print "<select name='DEVICE'>";
818 if ( $qossettings{'DEVICE'} eq $qossettings{'RED_DEV'} ) {
819 $qossettings{'RED_DEV_SEL'} = 'selected';
820 } elsif ( $qossettings{'DEVICE'} eq $qossettings{'IMQ_DEV'} ) {
821 $qossettings{'IMQ_DEV_SEL'} = 'selected';
824 <option value='$qossettings{'RED_DEV'}' $qossettings{'RED_DEV_SEL'}>$qossettings{'RED_DEV'}</option>
825 <option value='$qossettings{'IMQ_DEV'}' $qossettings{'IMQ_DEV_SEL'}>$qossettings{'IMQ_DEV'}</option></select>
826 <td width='33%' align='center'>
827 <tr><td width='33%' align='right'>$Lang::tr{'Class'}:<td width='33%' align='left'>
830 if ( $qossettings{'EDIT'} eq 'yes' ) {
831 print "<select name='CLASS' disabled>";
833 print "<select name='CLASS'>";
835 for ( $c = 100 ; $c <= 120 ; $c++ )
837 if ( $qossettings{'CLASS'} ne $c )
838 { print "<option value='$c'>$c</option>\n"; }
839 else { print "<option selected value='$c'>$c</option>\n"; }
841 for ( $c = 200 ; $c <= 220 ; $c++ )
843 if ( $qossettings{'CLASS'} ne $c )
844 { print "<option value='$c'>$c</option>\n"; }
845 else { print "<option selected value='$c'>$c</option>\n"; }
849 <td width='33%' align='center'>
850 <tr><td width='33%' align='right'>$Lang::tr{'priority'}:<td width='33%' align='left'><select name='PRIO'>
853 for ( $c = 1 ; $c <= 7 ; $c++ )
855 if ( $qossettings{'PRIO'} ne $c )
856 { print "<option value='$c'>$c</option>\n"; }
857 else { print "<option selected value='$c'>$c</option>\n"; }
859 if ($qossettings{'MINBWDTH'} eq "") { $qossettings{'MINBWDTH'} = "1"; }
862 <td width='33%' align='center'>
863 <tr><td width='33%' align='right'>$Lang::tr{'guaranteed bandwith'}:
864 <td width='33%' align='left'><input type='text' size='20' name='MINBWDTH' maxlength='8' required='1' value="$qossettings{'MINBWDTH'}" />
865 <td width='33%' align='center'>
866 <tr><td width='33%' align='right'>$Lang::tr{'max bandwith'} <img src='/blob.gif' alt='*' />:
867 <td width='33%' align='left'><input type='text' size='20' name='MAXBWDTH' maxlength='8' required='1' value="$qossettings{'MAXBWDTH'}" />
868 <td width='33%' align='center'>
869 <tr><td width='33%' align='right'>Burst:
870 <td width='33%' align='left'><input type='text' size='20' name='BURST' maxlength='8' value="$qossettings{'BURST'}" />
871 <td width='33%' align='center'>
872 <tr><td width='33%' align='right'>Ceilburst:
873 <td width='33%' align='left'><input type='text' size='20' name='CBURST' maxlength='8' value="$qossettings{'CBURST'}" />
874 <td width='33%' align='center'>
875 <tr><td width='33%' align='right'>$Lang::tr{'remark'}:
876 <td width='66%' colspan='2' align='left'><input type='text' name='REMARK' size='40' maxlength='40' value="$qossettings{'REMARK'}" />
877 <tr><td width='33%' align='right'><img src='/blob.gif' alt='*' /> $Lang::tr{'required field'}
878 <td width='33%' align='left'>
879 <td width='33%' align='center'><input type='submit' name='DOCLASS' value='$Lang::tr{'save'}' /> <input type='reset' value='$Lang::tr{'reset'}' />
887 &Header
::openbox
('100%', 'center', $Lang::tr
{'Level7 Rule'});
889 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
893 if ( $message ne "" ) {
894 print "<tr><td colspan='3' align='center'><font color='red'>$message</font>";
897 <tr><td colspan='3' width='100%'>$Lang::tr{'current class'}: $qossettings{'CLASS'}
898 <tr><td width='100%' colspan='3'>$Lang::tr{'enter data'}
899 <tr><td width='33%' align='right'>$Lang::tr{'protocol'}:
900 <td width='33%' align='left'><select name='L7PROT'>
903 opendir( DIR
, "/etc/l7-protocols/protocols" );
904 foreach $direntry ( sort readdir(DIR
) )
906 next if $direntry eq ".";
907 next if $direntry eq "..";
908 next if -d
"/etc/l7-protocols/protocols/$direntry";
909 @proto = split( /\./, $direntry );
910 if ( $proto[0] eq $qossettings{'L7PROT'} ) {
911 print "<option value='$proto[0]' selected>$proto[0]</option>\n";
913 print "<option value='$proto[0]'>$proto[0]</option>\n";
918 </select><td width='33%' align='center'>
919 <tr><td width='33%' align='right'>$Lang::tr{'source ip'}:
920 <td width='33%' align='left'><input type='text' name='QIP' maxlength='31' value='$qossettings{'QIP'}' />
921 <td width='33%' align='center'>
922 <tr><td width='33%' align='right'>$Lang::tr{'destination ip'}:
923 <td width='33%' align='left'><input type='text' name='DIP' maxlength='31' value='$qossettings{'DIP'}' />
924 <td width='33%' align='center'><input type='hidden' name='CLASS' value='$qossettings{'CLASS'}' /><input type='submit' name='DOLEVEL7' value='$Lang::tr{'save'}' />
925 <tr><td colspan="3" align='center'><font color="red"><em>$Lang::tr{'qos warning'}</em></font>
933 &Header
::openbox
('100%', 'center', $Lang::tr
{'Add Port Rule'});
935 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
937 <tr><td width='100%' colspan='3'>$Lang::tr{'enter data'}
938 <tr><td width='33%' align='right'>$Lang::tr{'protocol'}:
939 <td width='33%' align='left'><select name='PPROT'>
942 open( FILE
, "< /etc/protocols" );
945 foreach $direntry (sort @proto)
947 @tmpline = split( /\ /, $direntry );
948 next if $tmpline[0] =~ "#";
949 if ( $tmpline[0] eq $qossettings{'PPROT'} ) {
950 print "<option value='$tmpline[0]' selected>$tmpline[0]</option>\n";
952 print "<option value='$tmpline[0]'>$tmpline[0]</option>\n";
956 </select><td width='33%' align='center'>
957 <tr><td width='33%' align='right'>$Lang::tr{'source port'}:
958 <td width='33%' align='left'><input type='text' name='QPORT' maxlength='11' value='$qossettings{'QPORT'}' />
959 <td width='33%' align='center'>
960 <tr><td width='33%' align='right'>$Lang::tr{'destination port'}:
961 <td width='33%' align='left'><input type='text' name='DPORT' maxlength='11' value='$qossettings{'DPORT'}' />
962 <td width='33%' align='center'>
963 <tr><td width='33%' align='right'>$Lang::tr{'source ip'}:
964 <td width='33%' align='left'><input type='text' name='QIP' maxlength='31' value='$qossettings{'QIP'}' />
965 <td width='33%' align='center'>
966 <tr><td width='33%' align='right'>$Lang::tr{'destination ip'}:
967 <td width='33%' align='left'><input type='text' name='DIP' maxlength='31' value='$qossettings{'DIP'}' />
968 <td width='33%' align='center'><input type='hidden' name='CLASS' value='$qossettings{'CLASS'}' /><input type='submit' name='DOPORT' value='$Lang::tr{'save'}' />
976 &Header
::openbox
('100%', 'center', $Lang::tr
{'TOS Rule'});
977 if ($qossettings{'TOS'}) {
978 $checked{$qossettings{'TOS'}} = "checked";
981 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
985 if ( $message ne "" ) {
986 print "<tr><td colspan='3' align='center'><font color='red'>$message</font>";
989 <tr><td colspan='2' width='100%'>$Lang::tr{'current class'}: $qossettings{'CLASS'}
990 <tr><td width='100%' colspan='2'>$Lang::tr{'Enter TOS'}
991 <tr><td width='50%' align='left'>$Lang::tr{'min delay'} (8) <td width='50%'><input type="radio" name="TOS" value="8" $checked[8] />
992 <tr><td width='50%' align='left'>$Lang::tr{'max throughput'} (4) <td width='50%'><input type="radio" name="TOS" value="4" $checked[4] />
993 <tr><td width='50%' align='left'>$Lang::tr{'max reliability'} (2) <td width='50%'><input type="radio" name="TOS" value="2" $checked[2] />
994 <tr><td width='50%' align='left'>$Lang::tr{'min costs'} (1) <td width='50%'><input type="radio" name="TOS" value="1" $checked[1] />
995 <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'}' />
1003 $qossettings{'DEV'} = shift;
1004 open( FILE
, "< $classfile" ) or die "Unable to read $classfile";
1008 open( FILE
, "< $level7file" ) or die "Unable to read $level7file";
1011 open( FILE
, "< $tosfile" ) or die "Unable to read $tosfile";
1014 open( FILE
, "< $portfile" ) or die "Unable to read $portfile";
1015 @portrules = <FILE
>;
1017 foreach $classentry (sort @classes)
1019 @classline = split( /\;/, $classentry );
1020 if ( $classline[0] eq $qossettings{'DEV'} )
1022 &Header
::openbox
('100%', 'center', "$Lang::tr{'Class'}: $classline[1] $classline[8]");
1024 <table border='0' width='100%' cellspacing='0'>
1025 <tr><td bgcolor='$color{'color20'}' width='10%' align='center'><b>$Lang::tr{'interface'}</b>
1026 <td bgcolor='$color{'color20'}' width='10%' align='center'><b>$Lang::tr{'Class'}</b>
1027 <td bgcolor='$color{'color20'}' width='10%' align='center'>$Lang::tr{'priority'}
1028 <td bgcolor='$color{'color20'}' width='10%' align='center'>$Lang::tr{'guaranteed bandwith'}
1029 <td bgcolor='$color{'color20'}' width='10%' align='center'>$Lang::tr{'max bandwith'}
1030 <td bgcolor='$color{'color20'}' width='10%' align='center'>Burst
1031 <td bgcolor='$color{'color20'}' width='10%' align='center'>Ceil Burst
1032 <td bgcolor='$color{'color20'}' width='10%' align='center'>TOS
1033 <td bgcolor='$color{'color20'}' width='20%' align='center'>$Lang::tr{'action'}
1034 <tr><td align='center' bgcolor='$color{'color22'}'>$classline[0]</td>
1035 <td align='center' bgcolor='$color{'color22'}'>$classline[1]</td>
1036 <td align='center' bgcolor='$color{'color22'}'>$classline[2]</td>
1037 <td align='center' bgcolor='$color{'color22'}'>$classline[3]</td>
1038 <td align='center' bgcolor='$color{'color22'}'>$classline[4]</td>
1039 <td align='center' bgcolor='$color{'color22'}'>$classline[5]</td>
1040 <td align='center' bgcolor='$color{'color22'}'>$classline[6]</td>
1041 <td align='center' bgcolor='$color{'color22'}'>$classline[7]</td>
1042 <td align='right' bgcolor='$color{'color22'}'>
1043 <table border='0'><tr>
1044 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1045 <input type='hidden' name='CLASS' value='$classline[1]' />
1046 <input type='hidden' name='ACTION' value='$Lang::tr{'Add Rule'}' />
1047 <input type='image' alt='$Lang::tr{'Add Rule'}' title='$Lang::tr{'Add Rule'}' src='/images/addgreen.gif' />
1049 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1050 <input type='hidden' name='CLASS' value='$classline[1]' />
1051 <input type='hidden' name='DOCLASS' value='$Lang::tr{'edit'}' />
1052 <input type='image' alt='$Lang::tr{'edit'}' title='$Lang::tr{'edit'}' src='/images/edit.gif' />
1054 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1055 <input type='hidden' name='CLASS' value='$classline[1]' />
1056 <input type='hidden' name='DOCLASS' value='$Lang::tr{'delete'}' />
1057 <input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/delete.gif' />
1061 <tr><td align='right' colspan='2'><b>$Lang::tr{'remark'}:</b>
1062 <td align='center' colspan='6'> $classline[8]
1063 <td align='right'><b>Queueing:</b> $classline[9]
1068 foreach $l7ruleentry (sort @l7rules)
1070 @l7ruleline = split( /\;/, $l7ruleentry );
1071 if ( $l7ruleline[0] eq $classline[1] )
1074 <tr><td align='right' colspan='2'><b>$Lang::tr{'Level7 Protocol'}:</b>
1075 <td align='center' colspan='6'>$l7ruleline[2]
1077 <table border='0'><tr>
1078 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1079 <input type='hidden' name='CLASS' value='$l7ruleline[0]' />
1080 <input type='hidden' name='L7PROT' value='$l7ruleline[2]' />
1081 <input type='hidden' name='DOLEVEL7' value='$Lang::tr{'edit'}' />
1082 <input type='image' alt='$Lang::tr{'edit'}' title='$Lang::tr{'edit'}' src='/images/edit.gif' />
1084 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1085 <input type='hidden' name='CLASS' value='$l7ruleline[0]' />
1086 <input type='hidden' name='L7PROT' value='$l7ruleline[2]' />
1087 <input type='hidden' name='DOLEVEL7' value='$Lang::tr{'delete'}' />
1088 <input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/delete.gif' />
1093 if (($l7ruleline[3] ne "") || ($l7ruleline[4] ne "")){
1095 <tr><td align='center'>
1096 <td align='right' colspan='3'><b>$Lang::tr{'source ip'}:</b> $l7ruleline[3]
1097 <td align='right' colspan='3'><b>$Lang::tr{'destination ip'}:</b> $l7ruleline[4]
1111 foreach $portruleentry (sort @portrules)
1113 @portruleline = split( /\;/, $portruleentry );
1114 if ( $portruleline[0] eq $classline[1] )
1117 <tr><td align='right' colspan='2'><b>$Lang::tr{'Port Rule'}:</b>
1118 <td align='center'>($portruleline[2])
1119 <td align='center' colspan='2'>
1122 if ($portruleline[4]) {
1124 <i>$Lang::tr{'source port'}:</i> $portruleline[4]
1128 print "<td align='center' colspan='2'>";
1129 if ($portruleline[6]) {
1131 <i>$Lang::tr{'destination port'}:</i> $portruleline[6]
1138 <table border='0'><tr>
1139 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1140 <input type='hidden' name='CLASS' value='$portruleline[0]' />
1141 <input type='hidden' name='PPROT' value='$portruleline[2]' />
1142 <input type='hidden' name='QIP' value='$portruleline[3]' />
1143 <input type='hidden' name='QPORT' value='$portruleline[4]' />
1144 <input type='hidden' name='DIP' value='$portruleline[5]' />
1145 <input type='hidden' name='DPORT' value='$portruleline[6]' />
1146 <input type='hidden' name='DOPORT' value='$Lang::tr{'edit'}' />
1147 <input type='image' alt='$Lang::tr{'edit'}' title='$Lang::tr{'edit'}' src='/images/edit.gif' />
1149 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1150 <input type='hidden' name='CLASS' value='$portruleline[0]' />
1151 <input type='hidden' name='PPROT' value='$portruleline[2]' />
1152 <input type='hidden' name='QIP' value='$portruleline[3]' />
1153 <input type='hidden' name='QPORT' value='$portruleline[4]' />
1154 <input type='hidden' name='DIP' value='$portruleline[5]' />
1155 <input type='hidden' name='DPORT' value='$portruleline[6]' />
1156 <input type='hidden' name='DOPORT' value='$Lang::tr{'delete'}' />
1157 <input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/delete.gif' />
1162 if (($portruleline[3] ne "") || ($portruleline[5] ne "")){
1164 <tr><td align='center'>
1165 <td align='right' colspan='3'><b>$Lang::tr{'source ip'}:</b> $portruleline[3]
1166 <td align='right' colspan='3'><b>$Lang::tr{'destination ip'}:</b> $portruleline[5]
1175 foreach $tosruleentry (sort @tosrules)
1177 @tosruleline = split( /\;/, $tosruleentry );
1178 if ( $tosruleline[0] eq $classline[1] )
1181 <tr><td align='right' colspan='2'>
1182 <b>TOS Bit matches:</b>
1183 <td colspan='6' align='center'>
1186 if ( $tosruleline[2] eq "8") {
1187 print "$Lang::tr{'min delay'}\n";
1188 } elsif ( $tosruleline[2] eq "4") {
1189 print "$Lang::tr{'max throughput'}\n";
1190 } elsif ( $tosruleline[2] eq "2") {
1191 print "$Lang::tr{'max reliability'}\n";
1192 } elsif ( $tosruleline[2] eq "1") {
1193 print "$Lang::tr{'min costs'}\n";
1194 } else { print " \n"; }
1199 <table border='0'><tr>
1200 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1201 <input type='hidden' name='CLASS' value='$tosruleline[0]' />
1202 <input type='hidden' name='DEV' value='$tosruleline[1]' />
1203 <input type='hidden' name='TOS' value='$tosruleline[2]' />
1204 <input type='hidden' name='DOTOS' value='$Lang::tr{'edit'}' />
1205 <input type='image' alt='$Lang::tr{'edit'}' title='$Lang::tr{'edit'}' src='/images/edit.gif' />
1207 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1208 <input type='hidden' name='CLASS' value='$tosruleline[0]' />
1209 <input type='hidden' name='DEV' value='$tosruleline[1]' />
1210 <input type='hidden' name='TOS' value='$tosruleline[2]' />
1211 <input type='hidden' name='DOTOS' value='$Lang::tr{'delete'}' />
1212 <input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/delete.gif' />
1226 &Header
::closebox
();
1232 if ( $qossettings{'VALID'} eq 'yes' ) {
1233 if ( $qossettings{'DEVICE'} eq $qossettings{'RED_DEV'} ) {
1234 $qossettings{'SPD'} = $qossettings{'OUT_SPD'};
1235 } elsif ( $qossettings{'DEVICE'} eq $qossettings{'IMQ_DEV'} ) {
1236 $qossettings{'SPD'} = $qossettings{'INC_SPD'};
1238 unless ( ( $qossettings{'MINBWDTH'} >= 1 ) && ( $qossettings{'MINBWDTH'} <= $qossettings{'SPD'} ) ) {
1239 $qossettings{'VALID'} = 'no';
1240 $message = "$Lang::tr{'false min bandwith'}";
1242 $qossettings{'SPD'} = '';
1247 if ( $qossettings{'VALID'} eq 'yes' ) {
1248 if ( $qossettings{'DEVICE'} eq $qossettings{'RED_DEV'} ) {
1249 $qossettings{'SPD'} = $qossettings{'OUT_SPD'};
1250 } elsif ( $qossettings{'DEVICE'} eq $qossettings{'IMQ_DEV'} ) {
1251 $qossettings{'SPD'} = $qossettings{'INC_SPD'};
1253 unless ( ( $qossettings{'MAXBDWTH'} >= 0 ) && ($qossettings{'MAXBDWTH'} >= $qossettings{'MINBDWTH'}) &&( $qossettings{'MAXBDWTH'} <= $qossettings{'SPD'} ) ) {
1254 $qossettings{'VALID'} = 'no';
1255 $message = "$Lang::tr{'false max bandwith'}";
1257 $qossettings{'SPD'} = '';
1262 if ( $qossettings{'VALID'} eq 'yes' ) {
1263 if ( $qossettings{'DEVICE'} eq $qossettings{'RED_DEV'} ) {
1264 if ($qossettings{'CLASS'} lt 100 || $qossettings{'CLASS'} ge 121) {
1265 $qossettings{'VALID'} = 'no';
1266 $message = "$Lang::tr{'false classnumber'}";
1268 } elsif ( $qossettings{'DEVICE'} eq $qossettings{'IMQ_DEV'} ) {
1269 if ($qossettings{'CLASS'} lt 200 || $qossettings{'CLASS'} ge 221) {
1270 $qossettings{'VALID'} = 'no';
1271 $message = "$Lang::tr{'The class number does not match the specified interface.'}";
1274 open( FILE
, "< $classfile" ) or die "Unable to read $classfile";
1277 foreach $classentry (sort @tmp)
1279 @tmpline = split( /\;/, $classentry );
1280 if ( $tmpline[1] eq $qossettings{'CLASS'} )
1282 $qossettings{'VALID'} = 'no';
1283 $message = "$Lang::tr{'false classnumber'}";