]>
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 Michael Tremer & Christian Schmidt #
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 = "";
41 my $subclassentry = "";
43 my $portruleentry = "";
44 my $tosruleentry = "";
53 my @subclassline = ();
55 my @portruleline = ();
60 my $classfile = "/var/ipfire/qos/classes";
61 my $subclassfile = "/var/ipfire/qos/subclasses";
62 my $level7file = "/var/ipfire/qos/level7config";
63 my $portfile = "/var/ipfire/qos/portconfig";
64 my $tosfile = "/var/ipfire/qos/tosconfig";
65 &General
::readhash
("${General::swroot}/ethernet/settings", \
%netsettings);
67 &Header
::showhttpheaders
();
69 $qossettings{'ENABLED'} = 'off';
70 $qossettings{'EDIT'} = 'no';
71 $qossettings{'OUT_SPD'} = '';
72 $qossettings{'INC_SPD'} = '';
73 $qossettings{'DEF_OUT_SPD'} = '';
74 $qossettings{'DEF_INC_SPD'} = '';
75 $qossettings{'DEFCLASS_INC'} = '';
76 $qossettings{'DEFCLASS_OUT'} = '';
77 $qossettings{'ACK'} = '';
78 $qossettings{'MTU'} = '1492';
79 $qossettings{'SFQ_PERTUB'} = '10';
80 $qossettings{'QLENGTH'} = '30';
81 $qossettings{'RED_DEV'} = `cat /var/ipfire/red/iface`;
82 $qossettings{'IMQ_DEV'} = 'imq0';
83 $qossettings{'VALID'} = 'yes';
84 ### Values that have to be initialized
85 $qossettings{'ACTION'} = '';
86 $qossettings{'ACTIONDEF'} = '';
87 $qossettings{'ACTIONBW'} = '';
88 $qossettings{'RED_DEV_SEL'} = '';
89 $qossettings{'IMQ_DEV_SEL'} = '';
90 $qossettings{'PRIO'} = '';
91 $qossettings{'SPD'} = '';
92 $qossettings{'CLASS'} = '';
93 $qossettings{'SCLASS'} = '';
94 $qossettings{'QPORT'} = '';
95 $qossettings{'DPORT'} = '';
96 $qossettings{'QIP'} = '';
97 $qossettings{'DIP'} = '';
98 $qossettings{'PPROT'} = '';
99 $qossettings{'L7PROT'} = '';
100 $qossettings{'DEVICE'} = '';
101 $qossettings{'MINBWDTH'} = '';
102 $qossettings{'MAXBWDTH'} = '';
103 $qossettings{'BURST'} = '';
104 $qossettings{'CBURST'} = '';
105 $qossettings{'DOCLASS'} = '';
106 $qossettings{'DOSCLASS'} = '';
107 $qossettings{'DOLEVEL7'} = '';
108 $qossettings{'DOPORT'} = '';
109 $qossettings{'CLASS'} = '';
110 $qossettings{'CLASSPRFX'} = '';
111 $qossettings{'DEV'} = '';
112 $qossettings{'TOS'} = '';
115 &General
::readhash
("${General::swroot}/qos/settings", \
%qossettings);
116 &Header
::getcgihash
(\
%qossettings);
119 my %mainsettings = ();
120 &General
::readhash
("${General::swroot}/main/settings", \
%mainsettings);
121 &General
::readhash
("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \
%color);
123 &Header
::openpage
('QoS', 1, '');
124 &Header
::openbigbox
('100%', 'left', '', $errormessage);
126 ############################################################################################################################
127 ############################################################################################################################
129 if ($qossettings{'DOCLASS'} eq $Lang::tr
{'save'})
134 if ( $qossettings{'VALID'} eq 'yes' ) {
135 open( FILE
, ">> $classfile" ) or die "Unable to write $classfile";
137 $qossettings{'DEVICE'};$qossettings{'CLASS'};$qossettings{'PRIO'};$qossettings{'MINBWDTH'};$qossettings{'MAXBWDTH'};$qossettings{'BURST'};$qossettings{'CBURST'};$qossettings{'TOS'};$qossettings{'REMARK'};
142 $qossettings{'ACTION'} = 'Parentklasse hinzufuegen';
145 elsif ($qossettings{'DOCLASS'} eq 'Bearbeiten')
147 open( FILE
, "< $classfile" ) or die "Unable to read $classfile";
150 open( FILE
, "> $classfile" ) or die "Unable to write $classfile";
151 foreach $classentry (sort @classes)
153 @classline = split( /\;/, $classentry );
154 if ( $classline[1] ne $qossettings{'CLASS'} ) {
155 print FILE
$classentry;
157 $qossettings{'DEVICE'} = $classline[0];
158 $qossettings{'PRIO'} = $classline[2];
159 $qossettings{'MINBWDTH'} = $classline[3];
160 $qossettings{'MAXBWDTH'} = $classline[4];
161 $qossettings{'BURST'} = $classline[5];
162 $qossettings{'CBURST'} = $classline[6];
163 $qossettings{'TOS'} = $classline[7];
164 $qossettings{'REMARK'} = $classline[8];
165 $qossettings{'EDIT'} = 'yes';
170 &Header
::closebigbox
();
171 &Header
::closepage
();
174 elsif ($qossettings{'DOCLASS'} eq 'Loeschen')
176 open( FILE
, "< $classfile" ) or die "Unable to read $classfile";
179 open( FILE
, "> $classfile" ) or die "Unable to write $classfile";
180 foreach $classentry (sort @tmp)
182 @tmpline = split( /\;/, $classentry );
183 if ( $tmpline[1] ne $qossettings{'CLASS'} )
185 print FILE
$classentry;
189 open( FILE
, "< $subclassfile" ) or die "Unable to read $classfile";
192 open( FILE
, "> $subclassfile" ) or die "Unable to write $classfile";
193 foreach $subclassentry (sort @tmp)
195 @tmpline = split( /\;/, $subclassentry );
196 if ( $tmpline[1] ne $qossettings{'CLASS'} )
198 print FILE
$subclassentry;
202 $message = "$Lang::tr{'Class'} $qossettings{'CLASS'} $Lang::tr{'Class was deleted'}";
205 ############################################################################################################################
206 ############################################################################################################################
208 if ($qossettings{'DOSCLASS'} eq $Lang::tr
{'save'})
212 if ( $qossettings{'VALID'} eq 'yes' ) {
213 open( FILE
, ">> $subclassfile" ) or die "Unable to write $subclassfile";
215 $qossettings{'DEVICE'};$qossettings{'CLASS'};$qossettings{'SCLASS'};$qossettings{'PRIO'};$qossettings{'MINBWDTH'};$qossettings{'MAXBWDTH'};$qossettings{'BURST'};$qossettings{'CBURST'};$qossettings{'TOS'};
220 $qossettings{'ACTION'} = 'Unterklasse hinzufuegen';
222 } elsif ($qossettings{'DOSCLASS'} eq 'Loeschen')
224 open( FILE
, "< $subclassfile" ) or die "Unable to read $classfile";
227 open( FILE
, "> $subclassfile" ) or die "Unable to write $classfile";
228 foreach $subclassentry (sort @tmp)
230 @tmpline = split( /\;/, $subclassentry );
231 if ( $tmpline[2] ne $qossettings{'CLASS'} )
233 print FILE
$subclassentry;
237 $message = "$Lang::tr{'Subclass'} $qossettings{'CLASS'} $Lang::tr{'was deleted'}.";
240 ############################################################################################################################
241 ############################################################################################################################
243 if ($qossettings{'DOLEVEL7'} eq $Lang::tr
{'save'})
245 if ( $qossettings{'QIP'} ne '' ) {
246 unless ( &General
::validip
($qossettings{'QIP'}) ) {
247 $qossettings{'VALID'} = 'no';
248 $message = "Die Quell-IP-Adresse ist ungueltig.";
251 if ( $qossettings{'DIP'} ne '' ) {
252 unless ( &General
::validip
($qossettings{'DIP'}) ) {
253 $qossettings{'VALID'} = 'no';
254 $message = "Die Ziel-IP-Adresse ist ungueltig.";
257 if ($qossettings{'CLASS'} >= 100 && $qossettings{'CLASS'} < 121) {
258 $qossettings{'DEVICE'} = $qossettings{'RED_DEV'};
259 } elsif ($qossettings{'CLASS'} >= 1000 && $qossettings{'CLASS'} < 1021) {
260 $qossettings{'DEVICE'} = $qossettings{'RED_DEV'};
261 } elsif ($qossettings{'CLASS'} >= 200 && $qossettings{'CLASS'} < 221) {
262 $qossettings{'DEVICE'} = $qossettings{'IMQ_DEV'};
263 } elsif ($qossettings{'CLASS'} >= 2000 && $qossettings{'CLASS'} < 2021) {
264 $qossettings{'DEVICE'} = $qossettings{'IMQ_DEV'};
266 if ( $qossettings{'VALID'} eq 'yes' ) {
267 open( FILE
, ">> $level7file" ) or die "Unable to write $level7file";
269 $qossettings{'CLASS'};$qossettings{'DEVICE'};$qossettings{'L7PROT'};$qossettings{'QIP'};$qossettings{'DIP'};
274 $qossettings{'ACTION'} = 'Level7-Regel hinzufuegen';
276 } elsif ($qossettings{'DOLEVEL7'} eq 'Loeschen')
278 open( FILE
, "< $level7file" ) or die "Unable to read $level7file";
281 system("rm $level7file");
282 foreach $l7ruleentry (sort @l7rules)
284 @l7ruleline = split( /\;/, $l7ruleentry );
285 if ( ($l7ruleline[0] eq $qossettings{'CLASS'}) && ($l7ruleline[2] eq $qossettings{'L7PROT'}))
286 {$message = "Level7-Regel ($qossettings{'CLASS'} - $qossettings{'L7PROT'}) wurde geloescht.";}
288 { open( FILE
, ">> $level7file" ) or die "Unable to read $level7file";
289 print FILE
$l7ruleentry;
293 open( FILE
, "< $level7file" ) or system("touch $level7file");close FILE
;
294 } elsif ($qossettings{'DOLEVEL7'} eq 'Bearbeiten')
296 open( FILE
, "< $level7file" ) or die "Unable to read $level7file";
299 system("rm $level7file");
300 foreach $l7ruleentry (sort @l7rules)
302 @l7ruleline = split( /\;/, $l7ruleentry );
303 if ( ($l7ruleline[0] eq $qossettings{'CLASS'}) && ($l7ruleline[2] eq $qossettings{'L7PROT'}))
304 {$qossettings{'QIP'} = $l7ruleline[3];$qossettings{'DIP'} = $l7ruleline[4];}
306 open( FILE
, ">> $level7file" ) or die "Unable to write $level7file";
307 print FILE
$l7ruleentry;
312 open( FILE
, "< $level7file" ) or system("touch $level7file");close FILE
;
315 ############################################################################################################################
316 ############################################################################################################################
318 if ($qossettings{'DOPORT'} eq $Lang::tr
{'save'})
320 if ( $qossettings{'QIP'} ne '' ) {
321 unless ( &General
::validip
($qossettings{'QIP'}) ) {
322 $qossettings{'VALID'} = 'no';
323 $message = "Die Quell-IP-Adresse ist ungueltig.";
326 if ( $qossettings{'DIP'} ne '' ) {
327 unless ( &General
::validip
($qossettings{'DIP'}) ) {
328 $qossettings{'VALID'} = 'no';
329 $message = "Die Ziel-IP-Adresse ist ungueltig.";
332 if ($qossettings{'CLASS'} >= 100 && $qossettings{'CLASS'} < 121) {
333 $qossettings{'DEVICE'} = $qossettings{'RED_DEV'};
334 } elsif ($qossettings{'CLASS'} >= 1000 && $qossettings{'CLASS'} < 1021) {
335 $qossettings{'DEVICE'} = $qossettings{'RED_DEV'};
336 } elsif ($qossettings{'CLASS'} >= 200 && $qossettings{'CLASS'} < 221) {
337 $qossettings{'DEVICE'} = $qossettings{'IMQ_DEV'};
338 } elsif ($qossettings{'CLASS'} >= 2000 && $qossettings{'CLASS'} < 2021) {
339 $qossettings{'DEVICE'} = $qossettings{'IMQ_DEV'};
341 if ( $qossettings{'VALID'} eq 'yes' ) {
342 open( FILE
, ">> $portfile" ) or die "Unable to write $portfile";
344 $qossettings{'CLASS'};$qossettings{'DEVICE'};$qossettings{'PPROT'};$qossettings{'QIP'};$qossettings{'QPORT'};$qossettings{'DIP'};$qossettings{'DPORT'};
349 $qossettings{'ACTION'} = 'Port-Regel hinzufuegen';
351 } elsif ($qossettings{'DOPORT'} eq 'Loeschen')
353 open( FILE
, "< $portfile" ) or die "Unable to read $portfile";
356 open( FILE
, "> $portfile" ) or die "Unable to read $portfile";
357 foreach $portruleentry (sort @portrules)
359 @portruleline = split( /\;/, $portruleentry );
360 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'}))
362 print FILE
$portruleentry;
366 $message = "$Lang::tr{'Port Rule'} ($qossettings{'CLASS'} - $qossettings{'PPROT'}) $Lang::tr{'was deleted'}.";
367 } elsif ($qossettings{'DOPORT'} eq 'Bearbeiten')
369 open( FILE
, "< $portfile" ) or die "Unable to read $portfile";
372 system("rm $portfile");
373 foreach $portruleentry (sort @portrules)
375 @portruleline = split( /\;/, $portruleentry );
376 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'}))
377 {$qossettings{'CLASS'}=$portruleline[0];$qossettings{'PPROT'}=$portruleline[2];$qossettings{'QIP'}=$portruleline[3];$qossettings{'QPORT'}=$portruleline[4];$qossettings{'DIP'}=$portruleline[5];$qossettings{'DPORT'}=$portruleline[6];}
379 open( FILE
, ">> $portfile" ) or die "Unable to write $portfile";
380 print FILE
$portruleentry;
385 open( FILE
, "< $portfile" ) or system("touch $portfile");close FILE
;
388 ############################################################################################################################
389 ############################################################################################################################
391 if ($qossettings{'DOTOS'} eq $Lang::tr
{'save'})
393 if ($qossettings{'CLASS'} >= 100 && $qossettings{'CLASS'} < 121) {
394 $qossettings{'DEVICE'} = $qossettings{'RED_DEV'};
395 } elsif ($qossettings{'CLASS'} >= 1000 && $qossettings{'CLASS'} < 1021) {
396 $qossettings{'DEVICE'} = $qossettings{'RED_DEV'};
397 } elsif ($qossettings{'CLASS'} >= 200 && $qossettings{'CLASS'} < 221) {
398 $qossettings{'DEVICE'} = $qossettings{'IMQ_DEV'};
399 } elsif ($qossettings{'CLASS'} >= 2000 && $qossettings{'CLASS'} < 2021) {
400 $qossettings{'DEVICE'} = $qossettings{'IMQ_DEV'};
402 open( FILE
, ">> $tosfile" ) or die "Unable to write $tosfile";
404 $qossettings{'CLASS'};$qossettings{'DEVICE'};$qossettings{'TOS'};
409 elsif ($qossettings{'DOTOS'} eq 'Loeschen')
411 open( FILE
, "< $tosfile" ) or die "Unable to read $tosfile";
414 open( FILE
, "> $tosfile" ) or die "Unable to read $tosfile";
415 foreach $tosruleentry (sort @tosrules)
417 @tosruleline = split( /\;/, $tosruleentry );
418 unless ( ($tosruleline[0] eq $qossettings{'CLASS'}) && ($tosruleline[2] eq $qossettings{'TOS'}))
420 print FILE
$tosruleentry;
424 $message = "$Lang::tr{'TOS Rule'} ($qossettings{'CLASS'} - $qossettings{'TOS'}) $Lang::tr{'was deleted'}.";
425 } elsif ($qossettings{'DOTOS'} eq 'Bearbeiten')
427 open( FILE
, "< $tosfile" ) or die "Unable to read $tosfile";
430 open( FILE
, "> $tosfile" ) or die "Unable to write $tosfile";
431 foreach $tosruleentry (sort @tosrules)
433 @tosruleline = split( /\;/, $tosruleentry );
434 if (( $tosruleline[0] eq $qossettings{'CLASS'} ) && ( $tosruleline[2] eq $qossettings{'TOS'} )) {
435 $qossettings{'DEVICE'} = $tosruleline[1];
436 $qossettings{'CLASS'} = $tosruleline[0];
437 $qossettings{'TOS'} = $tosruleline[2];
438 $qossettings{'EDIT'} = 'yes';
440 print FILE
$tosruleentry;
445 &Header
::closebigbox
();
446 &Header
::closepage
();
450 ############################################################################################################################
451 ############################################################################################################################
453 if ($qossettings{'ACTION'} eq 'Start')
455 $qossettings{'ENABLED'} = 'on';
456 &General
::writehash
("${General::swroot}/qos/settings", \
%qossettings);
457 system("/usr/local/bin/qosctrl generate >/dev/null 2>&1");
458 system("/usr/bin/touch /var/ipfire/qos/enable");
459 system("/usr/local/bin/qosctrl start >/dev/null 2>&1");
460 system("logger -t ipfire 'QoS started'");
462 elsif ($qossettings{'ACTION'} eq 'Stop')
464 system("/usr/local/bin/qosctrl stop >/dev/null 2>&1");
465 unlink "/var/ipfire/qos/bin/qos.sh";
466 unlink "/var/ipfire/qos/enable";
467 system("logger -t ipfire 'QoS stopped'");
468 $qossettings{'ENABLED'} = 'off';
469 &General
::writehash
("${General::swroot}/qos/settings", \
%qossettings);
471 elsif ($qossettings{'ACTION'} eq 'Neustart')
473 if ($qossettings{'ENABLED'} eq 'on'){
474 system("/usr/local/bin/qosctrl stop >/dev/null 2>&1");
475 system("/usr/local/bin/qosctrl generate >/dev/null 2>&1");
476 system("/usr/local/bin/qosctrl start >/dev/null 2>&1");
477 system("logger -t ipfire 'QoS restarted'");
480 elsif ($qossettings{'ACTION'} eq $Lang::tr
{'save'})
482 if ($qossettings{'DEF_INC_SPD'} eq '') {
483 $qossettings{'DEF_INC_SPD'} = int($qossettings{'INC_SPD'} * 0.9);
485 if ($qossettings{'DEF_OUT_SPD'} eq '') {
486 $qossettings{'DEF_OUT_SPD'} = int($qossettings{'OUT_SPD'} * 0.9);
488 &General
::writehash
("${General::swroot}/qos/settings", \
%qossettings);
490 elsif ($qossettings{'ACTION'} eq $Lang::tr
{'template'} )
494 for(my $i = 1; $i <= 10; $i++) {
495 $UP[$i] = int($qossettings{'OUT_SPD'} / $i );
496 #print $i."=".$UP[$i]." ";
499 #print "<br /><br />Down<br />";
500 for(my $i = 1; $i <= 20; $i++) {
501 $DOWN[$i] = int($qossettings{'INC_SPD'} / $i);
502 #print $i."=".$DOWN[$i]." ";
504 open( FILE
, "> $classfile" ) or die "Unable to write $classfile";
506 imq0;200;1;$DOWN[10];$DOWN[1];;;8;VoIP;
507 imq0;203;4;$DOWN[20];$DOWN[1];;;0;VPN;
508 imq0;204;5;$DOWN[20];$DOWN[1];;;8;Webtraffic;
509 imq0;210;6;1;$DOWN[1];;;0;Default;
510 imq0;220;7;1;$DOWN[1];;;1;P2P;
511 $qossettings{'RED_DEV'};101;1;$UP[2];$UP[1];;;8;ACKs;
512 $qossettings{'RED_DEV'};102;2;$UP[3];$UP[1];;;8;VoIP;
513 $qossettings{'RED_DEV'};104;5;$UP[10];$UP[1];;;8;Webtraffic;
514 $qossettings{'RED_DEV'};110;6;1;$UP[1];;;0;Default;
515 $qossettings{'RED_DEV'};120;7;1;$UP[1];;;1;P2P;
516 $qossettings{'RED_DEV'};103;4;$UP[2];$UP[1];;;2;VPN;
520 open( FILE
, "> $level7file" ) or die "Unable to write $level7file";
522 102;$qossettings{'RED_DEV'};dns;;;
523 102;$qossettings{'RED_DEV'};sip;;;
524 102;$qossettings{'RED_DEV'};skypetoskype;;;
525 103;$qossettings{'RED_DEV'};ssh;;;
526 103;$qossettings{'RED_DEV'};rdp;;;
527 104;$qossettings{'RED_DEV'};http;;;
528 104;$qossettings{'RED_DEV'};ssl;;;
529 104;$qossettings{'RED_DEV'};pop3;;;
530 120;$qossettings{'RED_DEV'};applejuice;;;
531 120;$qossettings{'RED_DEV'};bittorrent;;;
532 200;imq0;skypetoskype;;;
538 220;imq0;applejuice;;;
539 220;imq0;bittorrent;;;
543 open( FILE
, "> $portfile" ) or die "Unable to write $portfile";
545 101;$qossettings{'RED_DEV'};icmp;;;;;
546 102;$qossettings{'RED_DEV'};tcp;;;;53;
547 102;$qossettings{'RED_DEV'};udp;;;;53;
548 103;$qossettings{'RED_DEV'};esp;;;;;
549 103;$qossettings{'RED_DEV'};tcp;;;;1194;
550 103;$qossettings{'RED_DEV'};udp;;;;1194;
551 103;$qossettings{'RED_DEV'};udp;;4500;;4500;
552 103;$qossettings{'RED_DEV'};udp;;500;;500;
553 104;$qossettings{'RED_DEV'};tcp;;;;80;
556 203;imq0;tcp;;;;1194;
557 203;imq0;udp;;;;1194;
558 203;imq0;udp;;4500;;4500;
559 203;imq0;udp;;500;;500;
564 if ($qossettings{'DEF_INC_SPD'} eq '') {
565 $qossettings{'DEF_INC_SPD'} = int($qossettings{'INC_SPD'} * 0.9);
567 if ($qossettings{'DEF_OUT_SPD'} eq '') {
568 $qossettings{'DEF_OUT_SPD'} = int($qossettings{'OUT_SPD'} * 0.9);
570 $qossettings{'DEFCLASS_INC'} = "210";
571 $qossettings{'DEFCLASS_OUT'} = "110";
572 $qossettings{'ACK'} ="101";
573 $qossettings{'ENABLED'} = 'on';
574 &General
::writehash
("${General::swroot}/qos/settings", \
%qossettings);
575 system("/usr/local/bin/qosctrl generate >/dev/null 2>&1");
576 system("/usr/bin/touch /var/ipfire/qos/enable");
577 system("/usr/local/bin/qosctrl start >/dev/null 2>&1");
578 system("logger -t ipfire 'QoS started'");
580 elsif ($qossettings{'ACTION'} eq "$Lang::tr{'status'}" )
582 &Header
::openbox
('100%', 'left', 'QoS Status');
583 if ($qossettings{'ENABLED'} eq 'on'){
585 $output = `/usr/local/bin/qosctrl status`;
586 $output = &Header
::cleanhtml
($output,"y");
587 print "<pre>$output</pre>\n";
588 } else { print "$Lang::tr{'QoS not enabled'}"; }
590 &Header
::closebigbox
();
591 &Header
::closepage
();
594 elsif ($qossettings{'ACTION'} eq "$Lang::tr{'parentclass add'}" )
597 &Header
::closebigbox
();
598 &Header
::closepage
();
601 elsif ($qossettings{'ACTION'} eq 'Unterklasse hinzufuegen')
604 &Header
::closebigbox
();
605 &Header
::closepage
();
608 elsif ($qossettings{'ACTION'} eq 'Regel hinzufuegen')
610 &Header
::openbox
('100%', 'center', $Lang::tr
{'Add Rule'});
613 <tr><td align='center'>$Lang::tr{'Choose Rule'}
614 <tr><td align='center'>
615 <input type="button" onClick="swapVisibility('l7rule')" value='Level7-Regel' />
616 <input type="button" onClick="swapVisibility('portrule')" value='Port-Regel' />
617 <input type="button" onClick="swapVisibility('tosrule')" value='TOS-Regel' />
623 <div id='l7rule' style='display: none'>
629 <div id='portrule' style='display: none'>
635 <div id='tosrule' style='display: none'>
643 &Header
::closebigbox
();
644 &Header
::closepage
();
647 elsif ($qossettings{'ACTION'} eq "$Lang::tr{'urlfilter advanced settings'}" )
650 &Header
::closebigbox
();
651 &Header
::closepage
();
654 if ($qossettings{'ACTIONBW'} eq "$Lang::tr{'modify'}" )
657 &Header
::closebigbox
();
658 &Header
::closepage
();
661 if ($qossettings{'ACTIONDEF'} eq "$Lang::tr{'modify'}" )
664 &Header
::closebigbox
();
665 &Header
::closepage
();
669 &General
::readhash
("${General::swroot}/qos/settings", \
%qossettings);
671 my $status = $Lang::tr
{'stopped'};
672 my $statuscolor = '#993333';
673 if ( $qossettings{'ENABLED'} eq 'on' ) {
674 $status = $Lang::tr
{'running'};
675 $statuscolor = '#339933';
678 if ( $netsettings{'RED_TYPE'} ne 'PPPOE' ) {
679 $qossettings{'RED_DEV'} = $netsettings{'RED_DEV'};
683 &Header
::openbox
('100%', 'left', $Lang::tr
{'error messages'});
684 print "<class name='base'>$errormessage\n";
685 print " </class>\n";
689 ############################################################################################################################
690 ############################################################################################################################
692 &Header
::openbox
('100%', 'center', 'Quality of Service');
695 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
699 if ( $message ne "" ) {
700 print "<tr><td colspan='2' align='center'><font color='red'>$message</font>";
703 <tr><td width='50%' align='left'><b>Quality of Service:</b>
704 <td width='50%' align='center' bgcolor='$statuscolor'><font color='white'>$status</font>
705 <tr><td width='100%' align='center' colspan='2'>
706 <input type='submit' name='ACTION' value="Start" />
707 <input type='submit' name='ACTION' value="Stop" />
708 <input type='submit' name='ACTION' value="$Lang::tr{'restart'}" /></table></form>
711 if (($qossettings{'OUT_SPD'} ne '') && ($qossettings{'INC_SPD'} ne '')) {
713 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
715 <tr><td colspan='3'>
716 <tr><td width='50%' align='right'>$Lang::tr{'downlink speed'}: <td width='30%' align='left'>$qossettings{'INC_SPD'}
717 <td width='20%' rowspan='2' align='center' valign='middle'><input type='submit' name='ACTIONBW' value='$Lang::tr{'modify'}' />
718 <tr><td width='50%' align='right'>$Lang::tr{'uplink speed'}: <td width='30%' align='left'>$qossettings{'OUT_SPD'}
723 if (($qossettings{'DEFCLASS_OUT'} ne '') && ($qossettings{'DEFCLASS_INC'} ne '')&& ($qossettings{'ACK'} ne '')) {
725 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
727 <tr><td colspan='3'><hr />
728 <tr><td width='50%' align='right'>$Lang::tr{'downlink std class'}: <td width='30%' align='left'>$qossettings{'DEFCLASS_INC'}
729 <td width='20%' rowspan='3' align='center' valign='middle'><input type='submit' name='ACTIONDEF' value='$Lang::tr{'modify'}' />
730 <tr><td width='50%' align='right'>$Lang::tr{'uplink std class'}: <td width='30%' align='left'>$qossettings{'DEFCLASS_OUT'}
731 <tr><td width='50%' align='right'>ACKs: <td width='30%' align='left'>$qossettings{'ACK'}
732 <tr><td colspan='3' width='100%'><hr />
733 <tr><td colspan='3' width='100%' align='center'>
736 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
737 <table border='0' cellpadding='0' cellspacing='0'>
738 <tr><td><input type='submit' name='ACTION' value='$Lang::tr{'parentclass add'}' />
739 <td><input type='submit' name='ACTION' value='$Lang::tr{'urlfilter advanced settings'}' />
740 <td><input type='submit' name='ACTION' value='$Lang::tr{'status'}' />
748 if ( ($qossettings{'OUT_SPD'} eq '') || ($qossettings{'INC_SPD'} eq '') ) {
750 &Header
::closebigbox
();
751 &Header
::closepage
();
755 if ( ($qossettings{'DEFCLASS_INC'} eq '') || ($qossettings{'DEFCLASS_OUT'} eq '') || ($qossettings{'ACK'} eq '') ) {
757 &Header
::closebigbox
();
758 &Header
::closepage
();
762 &Header
::openbox
('100%', 'center', $Lang::tr
{'info'});
763 &Graphs
::overviewgraph
("3240",$qossettings{'RED_DEV'});
764 &Graphs
::overviewgraph
("3240",$qossettings{'IMQ_DEV'});
767 <tr><td colspan='9' align='center' valign='middle'><img alt="" src='/images/addblue.gif' /> $Lang::tr{'add subclass'} | <img alt="" src='/images/addgreen.gif' /> $Lang::tr{'Add Rule'} | <img alt="" src='/images/edit.gif' /> $Lang::tr{'edit'} | <img alt="" src='/images/delete.gif' /> $Lang::tr{'delete'}
768 <tr><td colspan='9' align='right' valign='middle'><b>$Lang::tr{'TOS Bits'}:</b> <b>0</b> - $Lang::tr{'disabled'} | <b>8</b> - $Lang::tr{'min delay'} | <b>4</b> - $Lang::tr{'max throughput'} | <b>2</b> - $Lang::tr{'max reliability'} | <b>1</b> - $Lang::tr{'min costs'}
771 if (( -e
"/srv/web/ipfire/html/graphs/qos-graph-$qossettings{'RED_DEV'}-3240.png") && ( -e
"/srv/web/ipfire/html/graphs/qos-graph-$qossettings{'IMQ_DEV'}-3240.png")) {
773 <tr><td colspan='9' align='center'><a href='/cgi-bin/qosgraph.cgi?graph=$qossettings{'RED_DEV'}'><img alt="" src="/graphs/qos-graph-$qossettings{'RED_DEV'}-3240.png" border='0' /></a></td></tr>
774 <tr><td colspan='9' align='center'><a href='/cgi-bin/qosgraph.cgi?graph=$qossettings{'IMQ_DEV'}'><img alt="" src="/graphs/qos-graph-$qossettings{'IMQ_DEV'}-3240.png" border='0' /></a></td></tr>
779 print "\t</table><br />".$Lang::tr
{'no information available'};
785 &showclasses
($qossettings{'RED_DEV'});
786 &showclasses
($qossettings{'IMQ_DEV'});
788 &Header
::closebigbox
();
789 &Header
::closepage
();
791 ############################################################################################################################
792 ############################################################################################################################
794 sub changedefclasses
{
795 &Header
::openbox
('100%', 'center', $Lang::tr
{'std classes'});
797 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
799 <tr><td width='100%' colspan='3'>$Lang::tr{'no filter pass'}
800 <tr><td width='33%' align='right'>Download:<td width='33%' align='left'><select name='DEFCLASS_INC'>
803 for ( $c = 200 ; $c <= 220 ; $c++ )
805 if ( $qossettings{'DEFCLASS_INC'} ne $c )
806 { print "<option value='$c'>$c</option>\n"; }
807 else { print "<option selected value='$c'>$c</option>\n"; }
810 </select><td width='33%' align='center'>
811 <tr><td width='33%' align='right'>Upload:<td width='33%' align='left'><select name='DEFCLASS_OUT'>
814 for ( $c = 100 ; $c <= 120 ; $c++ )
816 if ( $qossettings{'DEFCLASS_OUT'} ne $c )
817 { print "<option value='$c'>$c</option>\n"; }
818 else { print "<option selected value='$c'>$c</option>\n"; }
821 </select><td width='33%' align='center'>
825 <tr><td width='100%' colspan='3'>$Lang::tr{'enter ack class'}
826 <tr><td width='33%' align='right'>ACKs:<td width='33%' align='left'><select name='ACK'>
829 for ( $c = 100 ; $c <= 120 ; $c++ )
831 if ( $qossettings{'ACK'} ne $c )
832 { print "<option value='$c'>$c</option>\n"; }
833 else { print "<option selected value='$c'>$c</option>\n"; }
836 </select><td width='33%' align='center'><input type='submit' name='ACTION' value="$Lang::tr{'save'}" />
844 sub changebandwidth
{
845 &Header
::openbox
('100%', 'center', $Lang::tr
{'bandwithsettings'});
846 if ($qossettings{'ENABLED'} eq 'on') {
847 print "$Lang::tr{'bandwitherror'}";
848 print "<a href='/cgi-bin/qos.cgi'>$Lang::tr{'back'}</a>";
851 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
852 <input type='hidden' name='DEF_OUT_SPD' value='' /><input type='hidden' name='DEF_INC_SPD' value='' />
854 <tr><td width='100%' colspan='3'>$Lang::tr{'down and up speed'}</td></tr>
855 <tr><td width='50%' align='right'>$Lang::tr{'downlink speed'}:</td>
856 <td width='30%' align='left'><input type='text' name='INC_SPD' maxlength='8' value="$qossettings{'INC_SPD'}" /></td>
857 <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>
858 <tr><td width='50%' align='right'>$Lang::tr{'uplink speed'}:</td>
859 <td width='30%' align='left'><input type='text' name='OUT_SPD' maxlength='8' value="$qossettings{'OUT_SPD'}" /></td></tr>
862 <font color='red'>$Lang::tr{'template warning'}</font>
870 &Header
::openbox
('100%', 'center', $Lang::tr
{'parentclass'});
872 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
876 if ( $message ne "" ) {
877 print "<tr><td colspan='3' align='center'>$message";
879 if ( $qossettings{'EDIT'} eq 'yes' ) {
880 print "<input type='hidden' name='CLASS' value='$qossettings{'CLASS'}' />";
881 print "<input type='hidden' name='DEVICE' value='$qossettings{'DEVICE'}' />";
884 <tr><td width='100%' colspan='3'>$Lang::tr{'enter data'}
885 <tr><td width='33%' align='right'>$Lang::tr{'interface'}:
886 <td width='33%' align='left'>
889 if ( $qossettings{'EDIT'} eq 'yes' ) {
890 print "<select name='DEVICE' disabled>";
892 print "<select name='DEVICE'>";
894 if ( $qossettings{'DEVICE'} eq $qossettings{'RED_DEV'} ) {
895 $qossettings{'RED_DEV_SEL'} = 'selected';
896 } elsif ( $qossettings{'DEVICE'} eq $qossettings{'IMQ_DEV'} ) {
897 $qossettings{'IMQ_DEV_SEL'} = 'selected';
900 <option value='$qossettings{'RED_DEV'}' $qossettings{'RED_DEV_SEL'}>$qossettings{'RED_DEV'}</option>
901 <option value='$qossettings{'IMQ_DEV'}' $qossettings{'IMQ_DEV_SEL'}>$qossettings{'IMQ_DEV'}</option></select>
902 <td width='33%' align='center'>
903 <tr><td width='33%' align='right'>$Lang::tr{'Class'}:<td width='33%' align='left'>
906 if ( $qossettings{'EDIT'} eq 'yes' ) {
907 print "<select name='CLASS' disabled>";
909 print "<select name='CLASS'>";
911 for ( $c = 100 ; $c <= 120 ; $c++ )
913 if ( $qossettings{'CLASS'} ne $c )
914 { print "<option value='$c'>$c</option>\n"; }
915 else { print "<option selected value='$c'>$c</option>\n"; }
917 for ( $c = 200 ; $c <= 220 ; $c++ )
919 if ( $qossettings{'CLASS'} ne $c )
920 { print "<option value='$c'>$c</option>\n"; }
921 else { print "<option selected value='$c'>$c</option>\n"; }
925 <td width='33%' align='center'>
926 <tr><td width='33%' align='right'>$Lang::tr{'priority'}:<td width='33%' align='left'><select name='PRIO'>
929 for ( $c = 1 ; $c <= 7 ; $c++ )
931 if ( $qossettings{'PRIO'} ne $c )
932 { print "<option value='$c'>$c</option>\n"; }
933 else { print "<option selected value='$c'>$c</option>\n"; }
935 if ($qossettings{'MINBWDTH'} eq "") { $qossettings{'MINBWDTH'} = "1"; }
938 <td width='33%' align='center'>
939 <tr><td width='33%' align='right'>$Lang::tr{'guaranteed bandwith'}:
940 <td width='33%' align='left'><input type='text' size='20' name='MINBWDTH' maxlength='8' required='1' value="$qossettings{'MINBWDTH'}" />
941 <td width='33%' align='center'>
942 <tr><td width='33%' align='right'>$Lang::tr{'max bandwith'}:
943 <td width='33%' align='left'><input type='text' size='20' name='MAXBWDTH' maxlength='8' required='1' value="$qossettings{'MAXBWDTH'}" />
944 <td width='33%' align='center'>
945 <tr><td width='33%' align='right'>Burst:
946 <td width='33%' align='left'><input type='text' size='20' name='BURST' maxlength='8' value="$qossettings{'BURST'}" />
947 <td width='33%' align='center'>
948 <tr><td width='33%' align='right'>Ceilburst:
949 <td width='33%' align='left'><input type='text' size='20' name='CBURST' maxlength='8' value="$qossettings{'CBURST'}" />
950 <td width='33%' align='center'>
953 $selected{'TOS'}{$qossettings{'TOS'}} = "selected='selected'";
955 <tr><td width='33%' align='right'>TOS-Bit:
956 <td width='33%' align='left'><select name='TOS'>
957 <option value='0' $selected{'TOS'}{'0'}>$Lang::tr{'disabled'} (0)</option>
958 <option value='8' $selected{'TOS'}{'8'}>$Lang::tr{'min delay'} (8)</option>
959 <option value='4' $selected{'TOS'}{'4'}>$Lang::tr{'max throughput'} (4)</option>
960 <option value='2' $selected{'TOS'}{'2'}>$Lang::tr{'max reliability'} (2)</option>
961 <option value='1' $selected{'TOS'}{'1'}>$Lang::tr{'min costs'} (1)</option></select>
962 <td width='33%' align='center'>
963 <tr><td width='33%' align='right'>$Lang::tr{'remark'}:
964 <td width='66%' colspan='2' align='left'><input type='text' name='REMARK' size='40' maxlength='40' value="$qossettings{'REMARK'}" /> <img alt="" alt='blob' src='/blob.gif' />
965 <tr><td width='33%' align='right'>
966 <td width='33%' align='left'>
967 <td width='33%' align='center'><input type='submit' name='DOCLASS' value='$Lang::tr{'save'}' /> <input type='reset' value='$Lang::tr{'reset'}' />
975 &Header
::openbox
('100%', 'center', $Lang::tr
{'Subclass'});
977 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
981 if ( $message ne "" ) {
982 print "<tr><td colspan='3' align='center'>$message";
985 <tr><td colspan='3' width='100%'>$Lang::tr{'current class'}: $qossettings{'CLASS'}
986 <tr><td width='100%' colspan='3'>$Lang::tr{'enter data'}
987 <tr><td width='33%' align='right'>$Lang::tr{'Subclass'}:<td width='33%' align='left'><select name='SCLASS'>
990 if ($qossettings{'CLASS'} >= 100 && $qossettings{'CLASS'} < 121) {
991 $qossettings{'DEVICE'} = $qossettings{'RED_DEV'};
992 for ( $c = 1000 ; $c <= 1020 ; $c++ )
994 if ( $qossettings{'SCLASS'} ne $c )
995 { print "<option value='$c'>$c</option>\n"; }
996 else { print "<option selected value='$c'>$c</option>\n"; }
998 } elsif ($qossettings{'CLASS'} >= 200 && $qossettings{'CLASS'} < 221) {
999 $qossettings{'DEVICE'} = $qossettings{'IMQ_DEV'};
1000 for ( $c = 2000 ; $c <= 2020 ; $c++ )
1002 if ( $qossettings{'SCLASS'} ne $c )
1003 { print "<option value='$c'>$c</option>\n"; }
1004 else { print "<option selected value='$c'>$c</option>\n"; }
1009 <td width='33%' align='center'>
1010 <tr><td width='33%' align='right'>$Lang::tr{'priority'}:<td width='33%' align='left'><select name='PRIO'>
1013 for ( $c = 1 ; $c <= 7 ; $c++ )
1015 if ( $qossettings{'PRIO'} ne $c )
1016 { print "<option value='$c'>$c</option>\n"; }
1017 else { print "<option selected value='$c'>$c</option>\n"; }
1020 <td width='33%' align='center'>
1021 <tr><td width='33%' align='right'>$Lang::tr{'guaranteed bandwith'}:
1022 <td width='33%' align='left'><input type='text' name='MINBWDTH' maxlength='8' required='1' value="$qossettings{'MINBWDTH'}" />
1023 <td width='33%' align='center'>
1024 <tr><td width='33%' align='right'>$Lang::tr{'max bandwith'}:
1025 <td width='33%' align='left'><input type='text' name='MAXBWDTH' maxlength='8' required='1' value="$qossettings{'MAXBWDTH'}" />
1026 <td width='33%' align='center'>
1027 <tr><td width='33%' align='right'>Burst:
1028 <td width='33%' align='left'><input type='text' name='BURST' maxlength='8' value="$qossettings{'BURST'}" />
1029 <td width='33%' align='center'>
1030 <tr><td width='33%' align='right'>Ceilburst:
1031 <td width='33%' align='left'><input type='text' name='CBURST' maxlength='8' value="$qossettings{'CBURST'}" />
1032 <td width='33%' align='center'>
1033 <tr><td width='33%' align='right'>TOS-Bit:
1034 <td width='33%' align='left'><select name='TOS'>
1035 <option value='0'>$Lang::tr{'disabled'} (0)</option>
1036 <option value='8'>$Lang::tr{'min delay'} (8)</option>
1037 <option value='4'>$Lang::tr{'max throughput'} (4)</option>
1038 <option value='2'>$Lang::tr{'max reliability'} (2)</option>
1039 <option value='1'>$Lang::tr{'min costs'} (1)</option></select>
1040 <td width='33%' align='center'><input type='hidden' name='CLASS' value="$qossettings{'CLASS'}" />
1041 <input type='hidden' name='DEVICE' value="$qossettings{'DEVICE'}" />
1042 <input type='submit' name='DOSCLASS' value='$Lang::tr{'save'}' /> <input type='reset' value='$Lang::tr{'reset'}' />
1046 &Header
::closebox
();
1050 &Header
::openbox
('100%', 'center', $Lang::tr
{'Level7 Rule'});
1052 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
1056 if ( $message ne "" ) {
1057 print "<tr><td colspan='3' align='center'><font color='red'>$message</font>";
1060 <tr><td colspan='3' width='100%'>$Lang::tr{'current class'}: $qossettings{'CLASS'}
1061 <tr><td width='100%' colspan='3'>$Lang::tr{'enter data'}
1062 <tr><td width='33%' align='right'>$Lang::tr{'protocol'}:
1063 <td width='33%' align='left'><select name='L7PROT'>
1066 opendir( DIR
, "/etc/l7-protocols/protocols" );
1067 foreach $direntry ( sort readdir(DIR
) )
1069 next if $direntry eq ".";
1070 next if $direntry eq "..";
1071 next if -d
"/etc/l7-protocols/protocols/$direntry";
1072 @proto = split( /\./, $direntry );
1073 if ( $proto[0] eq $qossettings{'L7PROT'} ) {
1074 print "<option value='$proto[0]' selected>$proto[0]</option>\n";
1076 print "<option value='$proto[0]'>$proto[0]</option>\n";
1081 </select><td width='33%' align='center'>
1082 <tr><td width='33%' align='right'>$Lang::tr{'source ip'}:
1083 <td width='33%' align='left'><input type='text' name='QIP' maxlength='15' value='$qossettings{'QIP'}' />
1084 <td width='33%' align='center'>
1085 <tr><td width='33%' align='right'>$Lang::tr{'destination ip'}:
1086 <td width='33%' align='left'><input type='text' name='DIP' maxlength='15' value='$qossettings{'DIP'}' />
1087 <td width='33%' align='center'><input type='hidden' name='CLASS' value='$qossettings{'CLASS'}' /><input type='submit' name='DOLEVEL7' value='$Lang::tr{'save'}' />
1091 &Header
::closebox
();
1095 &Header
::openbox
('100%', 'center', $Lang::tr
{'Add Port Rule'});
1097 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
1099 <tr><td width='100%' colspan='3'>$Lang::tr{'enter data'}
1100 <tr><td width='33%' align='right'>$Lang::tr{'protocol'}:
1101 <td width='33%' align='left'><select name='PPROT'>
1104 open( FILE
, "< /etc/protocols" );
1107 foreach $direntry (sort @proto)
1109 @tmpline = split( /\ /, $direntry );
1110 next if $tmpline[0] =~ "#";
1111 if ( $tmpline[0] eq $qossettings{'PPROT'} ) {
1112 print "<option value='$tmpline[0]' selected>$tmpline[0]</option>\n";
1114 print "<option value='$tmpline[0]'>$tmpline[0]</option>\n";
1118 </select><td width='33%' align='center'>
1119 <tr><td width='33%' align='right'>$Lang::tr{'source port'}:
1120 <td width='33%' align='left'><input type='text' name='QPORT' maxlength='5' value='$qossettings{'QPORT'}' />
1121 <td width='33%' align='center'>
1122 <tr><td width='33%' align='right'>$Lang::tr{'destination port'}:
1123 <td width='33%' align='left'><input type='text' name='DPORT' maxlength='5' value='$qossettings{'DPORT'}' />
1124 <td width='33%' align='center'>
1125 <tr><td width='33%' align='right'>$Lang::tr{'source ip'}:
1126 <td width='33%' align='left'><input type='text' name='QIP' maxlength='15' value='$qossettings{'QIP'}' />
1127 <td width='33%' align='center'>
1128 <tr><td width='33%' align='right'>$Lang::tr{'destination ip'}:
1129 <td width='33%' align='left'><input type='text' name='DIP' maxlength='15' value='$qossettings{'DIP'}' />
1130 <td width='33%' align='center'><input type='hidden' name='CLASS' value='$qossettings{'CLASS'}' /><input type='submit' name='DOPORT' value='$Lang::tr{'save'}' />
1134 &Header
::closebox
();
1138 &Header
::openbox
('100%', 'center', $Lang::tr
{'TOS Rule'});
1139 if ($qossettings{'TOS'}) {
1140 $checked{$qossettings{'TOS'}} = "checked";
1143 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
1147 if ( $message ne "" ) {
1148 print "<tr><td colspan='3' align='center'><font color='red'>$message</font>";
1151 <tr><td colspan='2' width='100%'>$Lang::tr{'current class'}: $qossettings{'CLASS'}
1152 <tr><td width='100%' colspan='2'>$Lang::tr{'Enter TOS'}
1153 <tr><td width='50%' align='left'>$Lang::tr{'min delay'} (8) <td width='50%'><input type="radio" name="TOS" value="8" $checked[8] />
1154 <tr><td width='50%' align='left'>$Lang::tr{'max throughput'} (4) <td width='50%'><input type="radio" name="TOS" value="4" $checked[4] />
1155 <tr><td width='50%' align='left'>$Lang::tr{'max reliability'} (2) <td width='50%'><input type="radio" name="TOS" value="2" $checked[2] />
1156 <tr><td width='50%' align='left'>$Lang::tr{'min costs'} (1) <td width='50%'><input type="radio" name="TOS" value="1" $checked[1] />
1157 <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'}' />
1161 &Header
::closebox
();
1165 $qossettings{'DEV'} = shift;
1166 open( FILE
, "< $classfile" ) or die "Unable to read $classfile";
1170 open( FILE
, "< $subclassfile" ) or die "Unable to read $subclassfile";
1171 @subclasses = <FILE
>;
1173 open( FILE
, "< $level7file" ) or die "Unable to read $level7file";
1176 open( FILE
, "< $tosfile" ) or die "Unable to read $tosfile";
1179 open( FILE
, "< $portfile" ) or die "Unable to read $portfile";
1180 @portrules = <FILE
>;
1182 foreach $classentry (sort @classes)
1184 @classline = split( /\;/, $classentry );
1185 if ( $classline[0] eq $qossettings{'DEV'} )
1187 &Header
::openbox
('100%', 'center', "Klasse: $classline[1]");
1189 <table border='0' width='100%' cellspacing='0'>
1190 <tr><td bgcolor='$color{'color20'}' width='10%' align='center'><b>$Lang::tr{'interface'}</b>
1191 <td bgcolor='$color{'color20'}' width='10%' align='center'><b>$Lang::tr{'Class'}</b>
1192 <td bgcolor='$color{'color20'}' width='10%' align='center'>$Lang::tr{'priority'}
1193 <td bgcolor='$color{'color20'}' width='10%' align='center'>$Lang::tr{'guaranteed bandwith'}
1194 <td bgcolor='$color{'color20'}' width='10%' align='center'>$Lang::tr{'max bandwith'}
1195 <td bgcolor='$color{'color20'}' width='10%' align='center'>Burst
1196 <td bgcolor='$color{'color20'}' width='10%' align='center'>Ceil Burst
1197 <td bgcolor='$color{'color20'}' width='10%' align='center'>TOS
1198 <td bgcolor='$color{'color20'}' width='20%' align='center'>$Lang::tr{'action'}
1199 <tr><td align='center' bgcolor='$color{'color22'}'>$classline[0]</td>
1200 <td align='center' bgcolor='$color{'color22'}'>$classline[1]</td>
1201 <td align='center' bgcolor='$color{'color22'}'>$classline[2]</td>
1202 <td align='center' bgcolor='$color{'color22'}'>$classline[3]</td>
1203 <td align='center' bgcolor='$color{'color22'}'>$classline[4]</td>
1204 <td align='center' bgcolor='$color{'color22'}'>$classline[5]</td>
1205 <td align='center' bgcolor='$color{'color22'}'>$classline[6]</td>
1206 <td align='center' bgcolor='$color{'color22'}'>$classline[7]</td>
1207 <td align='right' bgcolor='$color{'color22'}'>
1208 <table border='0'><tr>
1209 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1210 <input type='hidden' name='CLASS' value='$classline[1]' />
1211 <input type='hidden' name='ACTION' value='Unterklasse hinzufuegen' />
1212 <input type='image' alt='$Lang::tr{'add subclass'}' src='/images/addblue.gif' />
1214 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1215 <input type='hidden' name='CLASS' value='$classline[1]' />
1216 <input type='hidden' name='ACTION' value='Regel hinzufuegen' />
1217 <input type='image' alt='$Lang::tr{'Add Rule'}' src='/images/addgreen.gif' />
1219 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1220 <input type='hidden' name='CLASS' value='$classline[1]' />
1221 <input type='hidden' name='DOCLASS' value='Bearbeiten' />
1222 <input type='image' alt='$Lang::tr{'edit'}' src='/images/edit.gif' />
1224 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1225 <input type='hidden' name='CLASS' value='$classline[1]' />
1226 <input type='hidden' name='DOCLASS' value='Loeschen' />
1227 <input type='image' alt='$Lang::tr{'delete'}' src='/images/delete.gif' />
1231 <tr><td align='right' colspan='2'><b>$Lang::tr{'remark'}:</b>
1232 <td align='center' colspan='6'> $classline[8]
1233 <td align='right'><b>Queueing:</b> $classline[9]
1238 foreach $l7ruleentry (sort @l7rules)
1240 @l7ruleline = split( /\;/, $l7ruleentry );
1241 if ( $l7ruleline[0] eq $classline[1] )
1244 <tr><td align='right' colspan='2'><b>$Lang::tr{'Level7 Protocol'}:</b>
1245 <td align='center' colspan='6'>$l7ruleline[2]
1247 <table border='0'><tr>
1248 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1249 <input type='hidden' name='CLASS' value='$l7ruleline[0]' />
1250 <input type='hidden' name='L7PROT' value='$l7ruleline[2]' />
1251 <input type='hidden' name='DOLEVEL7' value='Bearbeiten' />
1252 <input type='image' alt='Bearbeiten' src='/images/edit.gif' />
1254 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1255 <input type='hidden' name='CLASS' value='$l7ruleline[0]' />
1256 <input type='hidden' name='L7PROT' value='$l7ruleline[2]' />
1257 <input type='hidden' name='DOLEVEL7' value='Loeschen' />
1258 <input type='image' alt='Loeschen' src='/images/delete.gif' />
1263 if (($l7ruleline[3] ne "") || ($l7ruleline[4] ne "")){
1265 <tr><td align='center'>
1266 <td align='right' colspan='3'><b>$Lang::tr{'source ip'}:</b> $l7ruleline[3]
1267 <td align='right' colspan='3'><b>$Lang::tr{'destination ip'}:</b> $l7ruleline[4]
1281 foreach $portruleentry (sort @portrules)
1283 @portruleline = split( /\;/, $portruleentry );
1284 if ( $portruleline[0] eq $classline[1] )
1287 <tr><td align='right' colspan='2'><b>$Lang::tr{'Port Rule'}:</b>
1288 <td align='center'>($portruleline[2])
1289 <td align='center' colspan='2'>
1292 if ($portruleline[4]) {
1294 <i>$Lang::tr{'source port'}:</i> $portruleline[4]
1298 print "<td align='center' colspan='2'>";
1299 if ($portruleline[6]) {
1301 <i>$Lang::tr{'destination port'}:</i> $portruleline[6]
1308 <table border='0'><tr>
1309 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1310 <input type='hidden' name='CLASS' value='$portruleline[0]' />
1311 <input type='hidden' name='PPROT' value='$portruleline[2]' />
1312 <input type='hidden' name='QIP' value='$portruleline[3]' />
1313 <input type='hidden' name='QPORT' value='$portruleline[4]' />
1314 <input type='hidden' name='DIP' value='$portruleline[5]' />
1315 <input type='hidden' name='DPORT' value='$portruleline[6]' />
1316 <input type='hidden' name='DOPORT' value='Bearbeiten' />
1317 <input type='image' alt='$Lang::tr{'edit'}' src='/images/edit.gif' />
1319 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1320 <input type='hidden' name='CLASS' value='$portruleline[0]' />
1321 <input type='hidden' name='PPROT' value='$portruleline[2]' />
1322 <input type='hidden' name='QIP' value='$portruleline[3]' />
1323 <input type='hidden' name='QPORT' value='$portruleline[4]' />
1324 <input type='hidden' name='DIP' value='$portruleline[5]' />
1325 <input type='hidden' name='DPORT' value='$portruleline[6]' />
1326 <input type='hidden' name='DOPORT' value='Loeschen' />
1327 <input type='image' alt='$Lang::tr{'delete'}' src='/images/delete.gif' />
1332 if (($portruleline[3] ne "") || ($portruleline[5] ne "")){
1334 <tr><td align='center'>
1335 <td align='right' colspan='3'><b>$Lang::tr{'source ip'}:</b> $portruleline[3]
1336 <td align='right' colspan='3'><b>$Lang::tr{'destination ip'}:</b> $portruleline[5]
1345 foreach $tosruleentry (sort @tosrules)
1347 @tosruleline = split( /\;/, $tosruleentry );
1348 if ( $tosruleline[0] eq $classline[1] )
1351 <tr><td align='right' colspan='2'>
1352 <b>TOS Bit matches:</b>
1353 <td colspan='6' align='center'>
1356 if ( $tosruleline[2] eq "8") {
1357 print "$Lang::tr{'min delay'}\n";
1358 } elsif ( $tosruleline[2] eq "4") {
1359 print "$Lang::tr{'max throughput'}\n";
1360 } elsif ( $tosruleline[2] eq "2") {
1361 print "$Lang::tr{'max reliability'}\n";
1362 } elsif ( $tosruleline[2] eq "1") {
1363 print "$Lang::tr{'min costs'}\n";
1364 } else { print " \n"; }
1369 <table border='0'><tr>
1370 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1371 <input type='hidden' name='CLASS' value='$tosruleline[0]' />
1372 <input type='hidden' name='DEV' value='$tosruleline[1]' />
1373 <input type='hidden' name='TOS' value='$tosruleline[2]' />
1374 <input type='hidden' name='DOTOS' value='Bearbeiten' />
1375 <input type='image' alt='$Lang::tr{'edit'}' src='/images/edit.gif' />
1377 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1378 <input type='hidden' name='CLASS' value='$tosruleline[0]' />
1379 <input type='hidden' name='DEV' value='$tosruleline[1]' />
1380 <input type='hidden' name='TOS' value='$tosruleline[2]' />
1381 <input type='hidden' name='DOTOS' value='Loeschen' />
1382 <input type='image' alt='$Lang::tr{'delete'}' src='/images/delete.gif' />
1392 foreach $subclassentry (sort @subclasses)
1394 @subclassline = split( /\;/, $subclassentry );
1395 if ( $subclassline[1] eq $classline[1] ) {
1397 <tr><td align='center' bgcolor='#FAFAFA'>$Lang::tr{'Subclass'}:
1398 <td align='center' bgcolor='#FAFAFA'>$subclassline[2]
1399 <td align='center' bgcolor='#FAFAFA'>$subclassline[3]
1400 <td align='center' bgcolor='#FAFAFA'>$subclassline[4]
1401 <td align='center' bgcolor='#FAFAFA'>$subclassline[5]
1402 <td align='center' bgcolor='#FAFAFA'>$subclassline[6]
1403 <td align='center' bgcolor='#FAFAFA'>$subclassline[7]
1404 <td align='center' bgcolor='#FAFAFA'>$subclassline[8]
1405 <td align='right' bgcolor='#FAFAFA'>
1406 <table border='0'><tr>
1407 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1408 <input type='hidden' name='CLASS' value='$subclassline[2]' />
1409 <input type='hidden' name='ACTION' value='Regel hinzufuegen' />
1410 <input type='image' alt='$Lang::tr{'Add Rule'}' src='/images/addgreen.gif' />
1412 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1413 <input type='hidden' name='CLASS' value='$subclassline[2]' />
1414 <input type='hidden' name='DOSCLASS' value='Bearbeiten' />
1415 <input type='image' alt='$Lang::tr{'edit'}' src='/images/edit.gif' />
1417 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1418 <input type='hidden' name='CLASS' value='$subclassline[2]' />
1419 <input type='hidden' name='DOSCLASS' value='Loeschen' />
1420 <input type='image' alt='$Lang::tr{'delete'}' src='/images/delete.gif' />
1431 &Header
::closebox
();
1439 &Header
::openbox
('100%', 'center', $Lang::tr
{'expertoptions'});
1441 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
1443 <tr><td width='33%' align='right'>MTU:<td width='33%' align='left'>
1444 <input type='text' name='MTU' maxlength='8' required='4' value='$qossettings{'MTU'}' />
1445 <td width='33%' align='center'>$Lang::tr{'mtu QoS'}
1446 <tr><td width='33%' align='right'>$Lang::tr{'Queuelenght'}:<td width='33%' align='left'>
1447 <input type='text' name='QLENGTH' maxlength='8' required='2' value='$qossettings{'QLENGTH'}' />
1448 <td width='33%' align='center'>
1449 <tr><td width='33%' align='right'>SFQ Perturb:<td width='33%' align='left'>
1450 <input type='text' name='SFQ_PERTUB' maxlength='8' required='1' value='$qossettings{'SFQ_PERTUB'}' />
1451 <td width='33%' align='center'><input type='submit' name='ACTION' value='$Lang::tr{'save'}' />
1456 &Header
::closebox
();
1460 if ( $qossettings{'VALID'} eq 'yes' ) {
1461 if ( $qossettings{'DEVICE'} eq $qossettings{'RED_DEV'} ) {
1462 $qossettings{'SPD'} = $qossettings{'OUT_SPD'};
1463 } elsif ( $qossettings{'DEVICE'} eq $qossettings{'IMQ_DEV'} ) {
1464 $qossettings{'SPD'} = $qossettings{'INC_SPD'};
1466 unless ( ( $qossettings{'MINBWDTH'} >= 1 ) && ( $qossettings{'MINBWDTH'} <= $qossettings{'SPD'} ) ) {
1467 $qossettings{'VALID'} = 'no';
1468 $message = "$Lang::tr{'false min bandwith'}";
1470 $qossettings{'SPD'} = '';
1475 if ( $qossettings{'VALID'} eq 'yes' ) {
1476 if ( $qossettings{'DEVICE'} eq $qossettings{'RED_DEV'} ) {
1477 $qossettings{'SPD'} = $qossettings{'OUT_SPD'};
1478 } elsif ( $qossettings{'DEVICE'} eq $qossettings{'IMQ_DEV'} ) {
1479 $qossettings{'SPD'} = $qossettings{'INC_SPD'};
1481 unless ( ( $qossettings{'MAXBDWTH'} >= 0 ) && ($qossettings{'MAXBDWTH'} >= $qossettings{'MINBDWTH'}) &&( $qossettings{'MAXBDWTH'} <= $qossettings{'SPD'} ) ) {
1482 $qossettings{'VALID'} = 'no';
1483 $message = "$Lang::tr{'false max bandwith'}";
1485 $qossettings{'SPD'} = '';
1490 if ( $qossettings{'VALID'} eq 'yes' ) {
1491 if ( $qossettings{'DEVICE'} eq $qossettings{'RED_DEV'} ) {
1492 if ($qossettings{'CLASS'} lt 100 || $qossettings{'CLASS'} ge 121) {
1493 $qossettings{'VALID'} = 'no';
1494 $message = "$Lang::tr{'false classnumber'}";
1496 } elsif ( $qossettings{'DEVICE'} eq $qossettings{'IMQ_DEV'} ) {
1497 if ($qossettings{'CLASS'} lt 200 || $qossettings{'CLASS'} ge 221) {
1498 $qossettings{'VALID'} = 'no';
1499 $message = "Die Klassennummer passt nicht zum angegebenen Interface.";
1502 open( FILE
, "< $classfile" ) or die "Unable to read $classfile";
1505 foreach $classentry (sort @tmp)
1507 @tmpline = split( /\;/, $classentry );
1508 if ( $tmpline[1] eq $qossettings{'CLASS'} )
1510 $qossettings{'VALID'} = 'no';
1511 $message = "$Lang::tr{'false classnumber'}";
1519 if ( $qossettings{'VALID'} eq 'yes' ) {
1520 open( FILE
, "< $subclassfile" ) or die "Unable to read $subclassfile";
1523 foreach $subclassentry (sort @tmp)
1525 @tmpline = split( /\;/, $subclassentry );
1526 if ( $tmpline[2] eq $qossettings{'SCLASS'} )
1528 $qossettings{'VALID'} = 'no';
1529 $message = "$Lang::tr{'class in use'}";