]>
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 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 system("/usr/local/bin/qosctrl generate >/dev/null 2>&1");
456 system("/usr/bin/touch /var/ipfire/qos/enable");
457 system("/usr/local/bin/qosctrl start >/dev/null 2>&1");
458 system("logger -t ipfire 'QoS started'");
459 $qossettings{'ENABLED'} = 'on';
460 &General
::writehash
("${General::swroot}/qos/settings", \
%qossettings);
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;Standardklasse;
510 imq0;220;7;1;$DOWN[1];;;1;P2P;
511 ppp0;101;1;$UP[2];$UP[1];;;8;ACKs oder so;
512 ppp0;102;2;$UP[3];$UP[1];;;8;VoIP;
513 ppp0;104;5;$UP[10];$UP[1];;;8;Webtraffic;
514 ppp0;110;6;1;$UP[1];;;0;Standardklasse;
515 ppp0;120;7;1;$UP[1];;;1;P2P;
516 ppp0;103;4;$UP[2];$UP[1];;;2;VPN;
520 open( FILE
, "> $level7file" ) or die "Unable to write $level7file";
524 102;ppp0;skypetoskype;;;
531 120;ppp0;applejuice;;;
532 120;ppp0;bittorrent;;;
533 200;imq0;skypetoskype;;;
539 220;imq0;applejuice;;;
540 220;imq0;bittorrent;;;
545 open( FILE
, "> $portfile" ) or die "Unable to write $portfile";
551 103;ppp0;tcp;;;;1194;
552 103;ppp0;udp;;4500;;4500;
553 103;ppp0;udp;;500;;500;
560 203;imq0;tcp;;;;1194;
561 203;imq0;udp;;4500;;4500;
562 203;imq0;udp;;500;;500;
567 if ($qossettings{'DEF_INC_SPD'} eq '') {
568 $qossettings{'DEF_INC_SPD'} = int($qossettings{'INC_SPD'} * 0.9);
570 if ($qossettings{'DEF_OUT_SPD'} eq '') {
571 $qossettings{'DEF_OUT_SPD'} = int($qossettings{'OUT_SPD'} * 0.9);
573 $qossettings{'DEFCLASS_INC'} = "210";
574 $qossettings{'DEFCLASS_OUT'} = "110";
575 $qossettings{'ACK'} ="101";
576 &General
::writehash
("${General::swroot}/qos/settings", \
%qossettings);
579 elsif ($qossettings{'ACTION'} eq 'Statusinformationen')
581 &Header
::openbox
('100%', 'left', 'QoS Status');
582 if ($qossettings{'ENABLED'} eq 'on'){
584 $output = `/usr/local/bin/qosctrl status`;
585 $output = &Header
::cleanhtml
($output,"y");
586 print "<pre>$output</pre>\n";
587 } else { print "$Lang::tr{'QoS not enabled'}"; }
589 &Header
::closebigbox
();
590 &Header
::closepage
();
593 elsif ($qossettings{'ACTION'} eq 'Parentklasse hinzufuegen')
596 &Header
::closebigbox
();
597 &Header
::closepage
();
600 elsif ($qossettings{'ACTION'} eq 'Unterklasse hinzufuegen')
603 &Header
::closebigbox
();
604 &Header
::closepage
();
607 elsif ($qossettings{'ACTION'} eq 'Regel hinzufuegen')
609 &Header
::openbox
('100%', 'center', $Lang::tr
{'Add Rule'});
612 <tr><td align='center'>$Lang::tr{'Choose Rule'}
613 <tr><td align='center'>
614 <input type="button" onClick="swapVisibility('l7rule')" value='Level7-Regel' />
615 <input type="button" onClick="swapVisibility('portrule')" value='Port-Regel' />
616 <input type="button" onClick="swapVisibility('tosrule')" value='TOS-Regel' />
622 <div id='l7rule' style='display: none'>
628 <div id='portrule' style='display: none'>
634 <div id='tosrule' style='display: none'>
642 &Header
::closebigbox
();
643 &Header
::closepage
();
646 elsif ($qossettings{'ACTION'} eq 'Erweiterte Einstellungen')
649 &Header
::closebigbox
();
650 &Header
::closepage
();
653 if ($qossettings{'ACTIONBW'} eq 'Andern')
656 &Header
::closebigbox
();
657 &Header
::closepage
();
660 if ($qossettings{'ACTIONDEF'} eq 'Andern')
663 &Header
::closebigbox
();
664 &Header
::closepage
();
668 &General
::readhash
("${General::swroot}/qos/settings", \
%qossettings);
670 my $status = $Lang::tr
{'stopped'};
671 my $statuscolor = '#993333';
672 if ( $qossettings{'ENABLED'} eq 'on' ) {
673 $status = $Lang::tr
{'running'};
674 $statuscolor = '#339933';
677 if ( $netsettings{'RED_TYPE'} ne 'PPPOE' ) {
678 $qossettings{'RED_DEV'} = $netsettings{'RED_DEV'};
682 &Header
::openbox
('100%', 'left', $Lang::tr
{'error messages'});
683 print "<class name='base'>$errormessage\n";
684 print " </class>\n";
688 ############################################################################################################################
689 ############################################################################################################################
691 &Header
::openbox
('100%', 'center', 'Quality of Service');
694 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
698 if ( $message ne "" ) {
699 print "<tr><td colspan='2' align='center'><font color='red'>$message</font>";
702 <tr><td width='50%' align='left'><b>Quality of Service:</b>
703 <td width='50%' align='center' bgcolor='$statuscolor'><font color='white'>$status</font>
704 <tr><td width='100%' align='center' colspan='2'>
705 <input type='submit' name='ACTION' value="Start" />
706 <input type='submit' name='ACTION' value="Stop" />
707 <input type='submit' name='ACTION' value="$Lang::tr{'restart'}" /></table></form>
710 if (($qossettings{'OUT_SPD'} ne '') && ($qossettings{'INC_SPD'} ne '')) {
712 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
714 <tr><td colspan='3'>
715 <tr><td width='50%' align='right'>$Lang::tr{'downlink speed'}: <td width='30%' align='left'>$qossettings{'INC_SPD'}
716 <td width='20%' rowspan='2' align='center' valign='middle'><input type='submit' name='ACTIONBW' value='Andern' />
717 <tr><td width='50%' align='right'>$Lang::tr{'uplink speed'}: <td width='30%' align='left'>$qossettings{'OUT_SPD'}
722 if (($qossettings{'DEFCLASS_OUT'} ne '') && ($qossettings{'DEFCLASS_INC'} ne '')&& ($qossettings{'ACK'} ne '')) {
724 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
726 <tr><td colspan='3'><hr />
727 <tr><td width='50%' align='right'>$Lang::tr{'downlink std class'}: <td width='30%' align='left'>$qossettings{'DEFCLASS_INC'}
728 <td width='20%' rowspan='3' align='center' valign='middle'><input type='submit' name='ACTIONDEF' value='Andern' />
729 <tr><td width='50%' align='right'>$Lang::tr{'uplink std class'}: <td width='30%' align='left'>$qossettings{'DEFCLASS_OUT'}
730 <tr><td width='50%' align='right'>ACKs: <td width='30%' align='left'>$qossettings{'ACK'}
731 <tr><td colspan='3' width='100%'><hr />
732 <tr><td colspan='3' width='100%' align='center'>
735 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
736 <table border='0' cellpadding='0' cellspacing='0'>
737 <tr><td><input type='submit' name='ACTION' value='Parentklasse hinzufuegen' />
738 <td><input type='submit' name='ACTION' value='Erweiterte Einstellungen' />
739 <td><input type='submit' name='ACTION' value='Statusinformationen' />
747 if ( ($qossettings{'OUT_SPD'} eq '') || ($qossettings{'INC_SPD'} eq '') ) {
749 &Header
::closebigbox
();
750 &Header
::closepage
();
754 if ( ($qossettings{'DEFCLASS_INC'} eq '') || ($qossettings{'DEFCLASS_OUT'} eq '') || ($qossettings{'ACK'} eq '') ) {
756 &Header
::closebigbox
();
757 &Header
::closepage
();
761 &Header
::openbox
('100%', 'center', $Lang::tr
{'info'});
762 &Graphs
::overviewgraph
("3240",$qossettings{'RED_DEV'});
763 &Graphs
::overviewgraph
("3240",$qossettings{'IMQ_DEV'});
766 <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'}
767 <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'}
770 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")) {
772 <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>
773 <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>
778 print "\t</table><br />".$Lang::tr
{'no information available'};
784 &showclasses
($qossettings{'RED_DEV'});
785 &showclasses
($qossettings{'IMQ_DEV'});
787 &Header
::closebigbox
();
788 &Header
::closepage
();
790 ############################################################################################################################
791 ############################################################################################################################
793 sub changedefclasses
{
794 &Header
::openbox
('100%', 'center', $Lang::tr
{'std classes'});
796 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
798 <tr><td width='100%' colspan='3'>$Lang::tr{'no filter pass'}
799 <tr><td width='33%' align='right'>Download:<td width='33%' align='left'><select name='DEFCLASS_INC'>
802 for ( $c = 200 ; $c <= 220 ; $c++ )
804 if ( $qossettings{'DEFCLASS_INC'} ne $c )
805 { print "<option value='$c'>$c</option>\n"; }
806 else { print "<option selected value='$c'>$c</option>\n"; }
809 </select><td width='33%' align='center'>
810 <tr><td width='33%' align='right'>Upload:<td width='33%' align='left'><select name='DEFCLASS_OUT'>
813 for ( $c = 100 ; $c <= 120 ; $c++ )
815 if ( $qossettings{'DEFCLASS_OUT'} ne $c )
816 { print "<option value='$c'>$c</option>\n"; }
817 else { print "<option selected value='$c'>$c</option>\n"; }
820 </select><td width='33%' align='center'>
824 <tr><td width='100%' colspan='3'>$Lang::tr{'enter ack class'}
825 <tr><td width='33%' align='right'>ACKs:<td width='33%' align='left'><select name='ACK'>
828 for ( $c = 100 ; $c <= 120 ; $c++ )
830 if ( $qossettings{'ACK'} ne $c )
831 { print "<option value='$c'>$c</option>\n"; }
832 else { print "<option selected value='$c'>$c</option>\n"; }
835 </select><td width='33%' align='center'><input type='submit' name='ACTION' value="$Lang::tr{'save'}" />
843 sub changebandwidth
{
844 &Header
::openbox
('100%', 'center', $Lang::tr
{'bandwithsettings'});
845 if ($qossettings{'ENABLED'} eq 'on') {
846 print "$Lang::tr{'bandwitherror'}";
847 print "<a href='/cgi-bin/qos.cgi'>$Lang::tr{'back'}</a>";
850 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
851 <input type='hidden' name='DEF_OUT_SPD' value='' /><input type='hidden' name='DEF_INC_SPD' value='' />
853 <tr><td width='100%' colspan='3'>$Lang::tr{'down and up speed'}</td></tr>
854 <tr><td width='50%' align='right'>$Lang::tr{'downlink speed'}:</td>
855 <td width='30%' align='left'><input type='text' name='INC_SPD' maxlength='8' value="$qossettings{'INC_SPD'}" /></td>
856 <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>
857 <tr><td width='50%' align='right'>$Lang::tr{'uplink speed'}:</td>
858 <td width='30%' align='left'><input type='text' name='OUT_SPD' maxlength='8' value="$qossettings{'OUT_SPD'}" /></td></tr>
861 <font color='red'>$Lang::tr{'template warning'}</font>
869 &Header
::openbox
('100%', 'center', $Lang::tr
{'parentclass'});
871 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
875 if ( $message ne "" ) {
876 print "<tr><td colspan='3' align='center'>$message";
878 if ( $qossettings{'EDIT'} eq 'yes' ) {
879 print "<input type='hidden' name='CLASS' value='$qossettings{'CLASS'}' />";
880 print "<input type='hidden' name='DEVICE' value='$qossettings{'DEVICE'}' />";
883 <tr><td width='100%' colspan='3'>$Lang::tr{'enter data'}
884 <tr><td width='33%' align='right'>$Lang::tr{'interface'}:
885 <td width='33%' align='left'>
888 if ( $qossettings{'EDIT'} eq 'yes' ) {
889 print "<select name='DEVICE' disabled>";
891 print "<select name='DEVICE'>";
893 if ( $qossettings{'DEVICE'} eq $qossettings{'RED_DEV'} ) {
894 $qossettings{'RED_DEV_SEL'} = 'selected';
895 } elsif ( $qossettings{'DEVICE'} eq $qossettings{'IMQ_DEV'} ) {
896 $qossettings{'IMQ_DEV_SEL'} = 'selected';
899 <option value='$qossettings{'RED_DEV'}' $qossettings{'RED_DEV_SEL'}>$qossettings{'RED_DEV'}</option>
900 <option value='$qossettings{'IMQ_DEV'}' $qossettings{'IMQ_DEV_SEL'}>$qossettings{'IMQ_DEV'}</option></select>
901 <td width='33%' align='center'>
902 <tr><td width='33%' align='right'>$Lang::tr{'Class'}:<td width='33%' align='left'>
905 if ( $qossettings{'EDIT'} eq 'yes' ) {
906 print "<select name='CLASS' disabled>";
908 print "<select name='CLASS'>";
910 for ( $c = 100 ; $c <= 120 ; $c++ )
912 if ( $qossettings{'CLASS'} ne $c )
913 { print "<option value='$c'>$c</option>\n"; }
914 else { print "<option selected value='$c'>$c</option>\n"; }
916 for ( $c = 200 ; $c <= 220 ; $c++ )
918 if ( $qossettings{'CLASS'} ne $c )
919 { print "<option value='$c'>$c</option>\n"; }
920 else { print "<option selected value='$c'>$c</option>\n"; }
924 <td width='33%' align='center'>
925 <tr><td width='33%' align='right'>$Lang::tr{'priority'}:<td width='33%' align='left'><select name='PRIO'>
928 for ( $c = 1 ; $c <= 7 ; $c++ )
930 if ( $qossettings{'PRIO'} ne $c )
931 { print "<option value='$c'>$c</option>\n"; }
932 else { print "<option selected value='$c'>$c</option>\n"; }
934 if ($qossettings{'MINBWDTH'} eq "") { $qossettings{'MINBWDTH'} = "1"; }
937 <td width='33%' align='center'>
938 <tr><td width='33%' align='right'>$Lang::tr{'guaranteed bandwith'}:
939 <td width='33%' align='left'><input type='text' size='20' name='MINBWDTH' maxlength='8' required='1' value="$qossettings{'MINBWDTH'}" />
940 <td width='33%' align='center'>
941 <tr><td width='33%' align='right'>$Lang::tr{'max bandwith'}:
942 <td width='33%' align='left'><input type='text' size='20' name='MAXBWDTH' maxlength='8' required='1' value="$qossettings{'MAXBWDTH'}" />
943 <td width='33%' align='center'>
944 <tr><td width='33%' align='right'>Burst:
945 <td width='33%' align='left'><input type='text' size='20' name='BURST' maxlength='8' value="$qossettings{'BURST'}" />
946 <td width='33%' align='center'>
947 <tr><td width='33%' align='right'>Ceilburst:
948 <td width='33%' align='left'><input type='text' size='20' name='CBURST' maxlength='8' value="$qossettings{'CBURST'}" />
949 <td width='33%' align='center'>
952 $selected{'TOS'}{$qossettings{'TOS'}} = "selected='selected'";
954 <tr><td width='33%' align='right'>TOS-Bit:
955 <td width='33%' align='left'><select name='TOS'>
956 <option value='0' $selected{'TOS'}{'0'}>$Lang::tr{'disabled'} (0)</option>
957 <option value='8' $selected{'TOS'}{'8'}>$Lang::tr{'min delay'} (8)</option>
958 <option value='4' $selected{'TOS'}{'4'}>$Lang::tr{'max throughput'} (4)</option>
959 <option value='2' $selected{'TOS'}{'2'}>$Lang::tr{'max reliability'} (2)</option>
960 <option value='1' $selected{'TOS'}{'1'}>$Lang::tr{'min costs'} (1)</option></select>
961 <td width='33%' align='center'>
962 <tr><td width='33%' align='right'>$Lang::tr{'remark'}:
963 <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' />
964 <tr><td width='33%' align='right'>
965 <td width='33%' align='left'>
966 <td width='33%' align='center'><input type='submit' name='DOCLASS' value='$Lang::tr{'save'}' /> <input type='reset' value='$Lang::tr{'reset'}' />
974 &Header
::openbox
('100%', 'center', $Lang::tr
{'Subclass'});
976 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
980 if ( $message ne "" ) {
981 print "<tr><td colspan='3' align='center'>$message";
984 <tr><td colspan='3' width='100%'>$Lang::tr{'current class'}: $qossettings{'CLASS'}
985 <tr><td width='100%' colspan='3'>$Lang::tr{'enter data'}
986 <tr><td width='33%' align='right'>$Lang::tr{'Subclass'}:<td width='33%' align='left'><select name='SCLASS'>
989 if ($qossettings{'CLASS'} >= 100 && $qossettings{'CLASS'} < 121) {
990 $qossettings{'DEVICE'} = $qossettings{'RED_DEV'};
991 for ( $c = 1000 ; $c <= 1020 ; $c++ )
993 if ( $qossettings{'SCLASS'} ne $c )
994 { print "<option value='$c'>$c</option>\n"; }
995 else { print "<option selected value='$c'>$c</option>\n"; }
997 } elsif ($qossettings{'CLASS'} >= 200 && $qossettings{'CLASS'} < 221) {
998 $qossettings{'DEVICE'} = $qossettings{'IMQ_DEV'};
999 for ( $c = 2000 ; $c <= 2020 ; $c++ )
1001 if ( $qossettings{'SCLASS'} ne $c )
1002 { print "<option value='$c'>$c</option>\n"; }
1003 else { print "<option selected value='$c'>$c</option>\n"; }
1008 <td width='33%' align='center'>
1009 <tr><td width='33%' align='right'>$Lang::tr{'priority'}:<td width='33%' align='left'><select name='PRIO'>
1012 for ( $c = 1 ; $c <= 7 ; $c++ )
1014 if ( $qossettings{'PRIO'} ne $c )
1015 { print "<option value='$c'>$c</option>\n"; }
1016 else { print "<option selected value='$c'>$c</option>\n"; }
1019 <td width='33%' align='center'>
1020 <tr><td width='33%' align='right'>$Lang::tr{'guaranteed bandwith'}:
1021 <td width='33%' align='left'><input type='text' name='MINBWDTH' maxlength='8' required='1' value="$qossettings{'MINBWDTH'}" />
1022 <td width='33%' align='center'>
1023 <tr><td width='33%' align='right'>$Lang::tr{'max bandwith'}:
1024 <td width='33%' align='left'><input type='text' name='MAXBWDTH' maxlength='8' required='1' value="$qossettings{'MAXBWDTH'}" />
1025 <td width='33%' align='center'>
1026 <tr><td width='33%' align='right'>Burst:
1027 <td width='33%' align='left'><input type='text' name='BURST' maxlength='8' value="$qossettings{'BURST'}" />
1028 <td width='33%' align='center'>
1029 <tr><td width='33%' align='right'>Ceilburst:
1030 <td width='33%' align='left'><input type='text' name='CBURST' maxlength='8' value="$qossettings{'CBURST'}" />
1031 <td width='33%' align='center'>
1032 <tr><td width='33%' align='right'>TOS-Bit:
1033 <td width='33%' align='left'><select name='TOS'>
1034 <option value='0'>$Lang::tr{'disabled'} (0)</option>
1035 <option value='8'>$Lang::tr{'min delay'} (8)</option>
1036 <option value='4'>$Lang::tr{'max throughput'} (4)</option>
1037 <option value='2'>$Lang::tr{'max reliability'} (2)</option>
1038 <option value='1'>$Lang::tr{'min costs'} (1)</option></select>
1039 <td width='33%' align='center'><input type='hidden' name='CLASS' value="$qossettings{'CLASS'}" />
1040 <input type='hidden' name='DEVICE' value="$qossettings{'DEVICE'}" />
1041 <input type='submit' name='DOSCLASS' value='$Lang::tr{'save'}' /> <input type='reset' value='$Lang::tr{'reset'}' />
1045 &Header
::closebox
();
1049 &Header
::openbox
('100%', 'center', $Lang::tr
{'Level7 Rule'});
1051 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
1055 if ( $message ne "" ) {
1056 print "<tr><td colspan='3' align='center'><font color='red'>$message</font>";
1059 <tr><td colspan='3' width='100%'>$Lang::tr{'current class'}: $qossettings{'CLASS'}
1060 <tr><td width='100%' colspan='3'>$Lang::tr{'enter data'}
1061 <tr><td width='33%' align='right'>$Lang::tr{'protocol'}:
1062 <td width='33%' align='left'><select name='L7PROT'>
1065 opendir( DIR
, "/etc/l7-protocols/protocols" );
1066 foreach $direntry ( sort readdir(DIR
) )
1068 next if $direntry eq ".";
1069 next if $direntry eq "..";
1070 next if -d
"/etc/l7-protocols/protocols/$direntry";
1071 @proto = split( /\./, $direntry );
1072 if ( $proto[0] eq $qossettings{'L7PROT'} ) {
1073 print "<option value='$proto[0]' selected>$proto[0]</option>\n";
1075 print "<option value='$proto[0]'>$proto[0]</option>\n";
1080 </select><td width='33%' align='center'>
1081 <tr><td width='33%' align='right'>$Lang::tr{'source ip'}:
1082 <td width='33%' align='left'><input type='text' name='QIP' maxlength='15' value='$qossettings{'QIP'}' />
1083 <td width='33%' align='center'>
1084 <tr><td width='33%' align='right'>$Lang::tr{'destination ip'}:
1085 <td width='33%' align='left'><input type='text' name='DIP' maxlength='15' value='$qossettings{'DIP'}' />
1086 <td width='33%' align='center'><input type='hidden' name='CLASS' value='$qossettings{'CLASS'}' /><input type='submit' name='DOLEVEL7' value='$Lang::tr{'save'}' />
1090 &Header
::closebox
();
1094 &Header
::openbox
('100%', 'center', $Lang::tr
{'Add Port Rule'});
1096 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
1098 <tr><td width='100%' colspan='3'>$Lang::tr{'enter data'}
1099 <tr><td width='33%' align='right'>$Lang::tr{'protocol'}:
1100 <td width='33%' align='left'><select name='PPROT'>
1103 open( FILE
, "< /etc/protocols" );
1106 foreach $direntry (sort @proto)
1108 @tmpline = split( /\ /, $direntry );
1109 next if $tmpline[0] =~ "#";
1110 if ( $tmpline[0] eq $qossettings{'PPROT'} ) {
1111 print "<option value='$tmpline[0]' selected>$tmpline[0]</option>\n";
1113 print "<option value='$tmpline[0]'>$tmpline[0]</option>\n";
1117 </select><td width='33%' align='center'>
1118 <tr><td width='33%' align='right'>$Lang::tr{'source port'}:
1119 <td width='33%' align='left'><input type='text' name='QPORT' maxlength='5' value='$qossettings{'QPORT'}' />
1120 <td width='33%' align='center'>
1121 <tr><td width='33%' align='right'>$Lang::tr{'destination port'}:
1122 <td width='33%' align='left'><input type='text' name='DPORT' maxlength='5' value='$qossettings{'DPORT'}' />
1123 <td width='33%' align='center'>
1124 <tr><td width='33%' align='right'>$Lang::tr{'source ip'}:
1125 <td width='33%' align='left'><input type='text' name='QIP' maxlength='15' value='$qossettings{'QIP'}' />
1126 <td width='33%' align='center'>
1127 <tr><td width='33%' align='right'>$Lang::tr{'destination ip'}:
1128 <td width='33%' align='left'><input type='text' name='DIP' maxlength='15' value='$qossettings{'DIP'}' />
1129 <td width='33%' align='center'><input type='hidden' name='CLASS' value='$qossettings{'CLASS'}' /><input type='submit' name='DOPORT' value='$Lang::tr{'save'}' />
1133 &Header
::closebox
();
1137 &Header
::openbox
('100%', 'center', $Lang::tr
{'TOS Rule'});
1138 if ($qossettings{'TOS'}) {
1139 $checked{$qossettings{'TOS'}} = "checked";
1142 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
1146 if ( $message ne "" ) {
1147 print "<tr><td colspan='3' align='center'><font color='red'>$message</font>";
1150 <tr><td colspan='2' width='100%'>$Lang::tr{'current class'}: $qossettings{'CLASS'}
1151 <tr><td width='100%' colspan='2'>$Lang::tr{'Enter TOS'}
1152 <tr><td width='50%' align='left'>$Lang::tr{'min delay'} (8) <td width='50%'><input type="radio" name="TOS" value="8" $checked[8] />
1153 <tr><td width='50%' align='left'>$Lang::tr{'max throughput'} (4) <td width='50%'><input type="radio" name="TOS" value="4" $checked[4] />
1154 <tr><td width='50%' align='left'>$Lang::tr{'max reliability'} (2) <td width='50%'><input type="radio" name="TOS" value="2" $checked[2] />
1155 <tr><td width='50%' align='left'$Lang::tr{'min costs'} (1) <td width='50%'><input type="radio" name="TOS" value="1" $checked[1] />
1156 <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'}' />
1160 &Header
::closebox
();
1164 $qossettings{'DEV'} = shift;
1165 open( FILE
, "< $classfile" ) or die "Unable to read $classfile";
1169 open( FILE
, "< $subclassfile" ) or die "Unable to read $subclassfile";
1170 @subclasses = <FILE
>;
1172 open( FILE
, "< $level7file" ) or die "Unable to read $level7file";
1175 open( FILE
, "< $tosfile" ) or die "Unable to read $tosfile";
1178 open( FILE
, "< $portfile" ) or die "Unable to read $portfile";
1179 @portrules = <FILE
>;
1181 foreach $classentry (sort @classes)
1183 @classline = split( /\;/, $classentry );
1184 if ( $classline[0] eq $qossettings{'DEV'} )
1186 &Header
::openbox
('100%', 'center', "Klasse: $classline[1]");
1188 <table border='0' width='100%' cellspacing='0'>
1189 <tr><td bgcolor='$color{'color20'}' width='10%' align='center'><b>$Lang::tr{'interface'}</b>
1190 <td bgcolor='$color{'color20'}' width='10%' align='center'><b>$Lang::tr{'Class'}</b>
1191 <td bgcolor='$color{'color20'}' width='10%' align='center'>$Lang::tr{'priority'}
1192 <td bgcolor='$color{'color20'}' width='10%' align='center'>$Lang::tr{'guaranteed bandwith'}
1193 <td bgcolor='$color{'color20'}' width='10%' align='center'>$Lang::tr{'max bandwith'}
1194 <td bgcolor='$color{'color20'}' width='10%' align='center'>Burst
1195 <td bgcolor='$color{'color20'}' width='10%' align='center'>Ceil Burst
1196 <td bgcolor='$color{'color20'}' width='10%' align='center'>TOS
1197 <td bgcolor='$color{'color20'}' width='20%' align='center'>$Lang::tr{'action'}
1198 <tr><td align='center' bgcolor='$color{'color22'}'>$classline[0]</td>
1199 <td align='center' bgcolor='$color{'color22'}'>$classline[1]</td>
1200 <td align='center' bgcolor='$color{'color22'}'>$classline[2]</td>
1201 <td align='center' bgcolor='$color{'color22'}'>$classline[3]</td>
1202 <td align='center' bgcolor='$color{'color22'}'>$classline[4]</td>
1203 <td align='center' bgcolor='$color{'color22'}'>$classline[5]</td>
1204 <td align='center' bgcolor='$color{'color22'}'>$classline[6]</td>
1205 <td align='center' bgcolor='$color{'color22'}'>$classline[7]</td>
1206 <td align='right' bgcolor='$color{'color22'}'>
1207 <table border='0'><tr>
1208 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1209 <input type='hidden' name='CLASS' value='$classline[1]' />
1210 <input type='hidden' name='ACTION' value='Unterklasse hinzufuegen' />
1211 <input type='image' alt='$Lang::tr{'add subclass'}' src='/images/addblue.gif' />
1213 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1214 <input type='hidden' name='CLASS' value='$classline[1]' />
1215 <input type='hidden' name='ACTION' value='Regel hinzufuegen' />
1216 <input type='image' alt='$Lang::tr{'Add Rule'}' src='/images/addgreen.gif' />
1218 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1219 <input type='hidden' name='CLASS' value='$classline[1]' />
1220 <input type='hidden' name='DOCLASS' value='Bearbeiten' />
1221 <input type='image' alt='$Lang::tr{'edit'}' src='/images/edit.gif' />
1223 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1224 <input type='hidden' name='CLASS' value='$classline[1]' />
1225 <input type='hidden' name='DOCLASS' value='Loeschen' />
1226 <input type='image' alt='$Lang::tr{'delete'}' src='/images/delete.gif' />
1230 <tr><td align='right' colspan='2'><b>$Lang::tr{'remark'}:</b>
1231 <td align='center' colspan='6'> $classline[8]
1232 <td align='right'><b>Queueing:</b> $classline[9]
1237 foreach $l7ruleentry (sort @l7rules)
1239 @l7ruleline = split( /\;/, $l7ruleentry );
1240 if ( $l7ruleline[0] eq $classline[1] )
1243 <tr><td align='right' colspan='2'><b>$Lang::tr{'Level7 Protocol'}:</b>
1244 <td align='center' colspan='6'>$l7ruleline[2]
1246 <table border='0'><tr>
1247 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1248 <input type='hidden' name='CLASS' value='$l7ruleline[0]' />
1249 <input type='hidden' name='L7PROT' value='$l7ruleline[2]' />
1250 <input type='hidden' name='DOLEVEL7' value='Bearbeiten' />
1251 <input type='image' alt='Bearbeiten' src='/images/edit.gif' />
1253 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1254 <input type='hidden' name='CLASS' value='$l7ruleline[0]' />
1255 <input type='hidden' name='L7PROT' value='$l7ruleline[2]' />
1256 <input type='hidden' name='DOLEVEL7' value='Loeschen' />
1257 <input type='image' alt='Loeschen' src='/images/delete.gif' />
1262 if (($l7ruleline[3] ne "") || ($l7ruleline[4] ne "")){
1264 <tr><td align='center'>
1265 <td align='right' colspan='3'><b>$Lang::tr{'source ip'}:</b> $l7ruleline[3]
1266 <td align='right' colspan='3'><b>$Lang::tr{'destination ip'}:</b> $l7ruleline[4]
1280 foreach $portruleentry (sort @portrules)
1282 @portruleline = split( /\;/, $portruleentry );
1283 if ( $portruleline[0] eq $classline[1] )
1286 <tr><td align='right' colspan='2'><b>$Lang::tr{'Port Rule'}:</b>
1287 <td align='center'>($portruleline[2])
1288 <td align='center' colspan='2'>
1291 if ($portruleline[4]) {
1293 <i>Quell-Port:</i> $portruleline[4]
1297 print "<td align='center' colspan='2'>";
1298 if ($portruleline[6]) {
1300 <i>Ziel-Port:</i> $portruleline[6]
1307 <table border='0'><tr>
1308 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1309 <input type='hidden' name='CLASS' value='$portruleline[0]' />
1310 <input type='hidden' name='PPROT' value='$portruleline[2]' />
1311 <input type='hidden' name='QIP' value='$portruleline[3]' />
1312 <input type='hidden' name='QPORT' value='$portruleline[4]' />
1313 <input type='hidden' name='DIP' value='$portruleline[5]' />
1314 <input type='hidden' name='DPORT' value='$portruleline[6]' />
1315 <input type='hidden' name='DOPORT' value='Bearbeiten' />
1316 <input type='image' alt='$Lang::tr{'edit'}' src='/images/edit.gif' />
1318 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1319 <input type='hidden' name='CLASS' value='$portruleline[0]' />
1320 <input type='hidden' name='PPROT' value='$portruleline[2]' />
1321 <input type='hidden' name='QIP' value='$portruleline[3]' />
1322 <input type='hidden' name='QPORT' value='$portruleline[4]' />
1323 <input type='hidden' name='DIP' value='$portruleline[5]' />
1324 <input type='hidden' name='DPORT' value='$portruleline[6]' />
1325 <input type='hidden' name='DOPORT' value='Loeschen' />
1326 <input type='image' alt='$Lang::tr{'delete'}' src='/images/delete.gif' />
1331 if (($portruleline[3] ne "") || ($portruleline[5] ne "")){
1333 <tr><td align='center'>
1334 <td align='right' colspan='3'><b>$Lang::tr{'source ip'}:</b> $portruleline[3]
1335 <td align='right' colspan='3'><b>$Lang::tr{'destination ip'}:</b> $portruleline[5]
1344 foreach $tosruleentry (sort @tosrules)
1346 @tosruleline = split( /\;/, $tosruleentry );
1347 if ( $tosruleline[0] eq $classline[1] )
1350 <tr><td align='right' colspan='2'>
1351 <b>TOS Bit matches:</b>
1352 <td colspan='6' align='center'>
1355 if ( $tosruleline[2] eq "8") {
1356 print "$Lang::tr{'min delay'}\n";
1357 } elsif ( $tosruleline[2] eq "4") {
1358 print "$Lang::tr{'max throughput'}\n";
1359 } elsif ( $tosruleline[2] eq "2") {
1360 print "$Lang::tr{'max reliability'}\n";
1361 } elsif ( $tosruleline[2] eq "1") {
1362 print "$Lang::tr{'min costs'}\n";
1363 } else { print " \n"; }
1368 <table border='0'><tr>
1369 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1370 <input type='hidden' name='CLASS' value='$tosruleline[0]' />
1371 <input type='hidden' name='DEV' value='$tosruleline[1]' />
1372 <input type='hidden' name='TOS' value='$tosruleline[2]' />
1373 <input type='hidden' name='DOTOS' value='Bearbeiten' />
1374 <input type='image' alt='$Lang::tr{'edit'}' src='/images/edit.gif' />
1376 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1377 <input type='hidden' name='CLASS' value='$tosruleline[0]' />
1378 <input type='hidden' name='DEV' value='$tosruleline[1]' />
1379 <input type='hidden' name='TOS' value='$tosruleline[2]' />
1380 <input type='hidden' name='DOTOS' value='Loeschen' />
1381 <input type='image' alt='$Lang::tr{'delete'}' src='/images/delete.gif' />
1391 foreach $subclassentry (sort @subclasses)
1393 @subclassline = split( /\;/, $subclassentry );
1394 if ( $subclassline[1] eq $classline[1] ) {
1396 <tr><td align='center' bgcolor='#FAFAFA'>$Lang::tr{'Subclass'}:
1397 <td align='center' bgcolor='#FAFAFA'>$subclassline[2]
1398 <td align='center' bgcolor='#FAFAFA'>$subclassline[3]
1399 <td align='center' bgcolor='#FAFAFA'>$subclassline[4]
1400 <td align='center' bgcolor='#FAFAFA'>$subclassline[5]
1401 <td align='center' bgcolor='#FAFAFA'>$subclassline[6]
1402 <td align='center' bgcolor='#FAFAFA'>$subclassline[7]
1403 <td align='center' bgcolor='#FAFAFA'>$subclassline[8]
1404 <td align='right' bgcolor='#FAFAFA'>
1405 <table border='0'><tr>
1406 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1407 <input type='hidden' name='CLASS' value='$subclassline[2]' />
1408 <input type='hidden' name='ACTION' value='Regel hinzufuegen' />
1409 <input type='image' alt='$Lang::tr{'Add Rule'}' src='/images/addgreen.gif' />
1411 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1412 <input type='hidden' name='CLASS' value='$subclassline[2]' />
1413 <input type='hidden' name='DOSCLASS' value='Bearbeiten' />
1414 <input type='image' alt='$Lang::tr{'edit'}' src='/images/edit.gif' />
1416 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1417 <input type='hidden' name='CLASS' value='$subclassline[2]' />
1418 <input type='hidden' name='DOSCLASS' value='Loeschen' />
1419 <input type='image' alt='$Lang::tr{'delete'}' src='/images/delete.gif' />
1430 &Header
::closebox
();
1438 &Header
::openbox
('100%', 'center', $Lang::tr
{'expertoptions'});
1440 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
1442 <tr><td width='33%' align='right'>MTU:<td width='33%' align='left'>
1443 <input type='text' name='MTU' maxlength='8' required='4' value='$qossettings{'MTU'}' />
1444 <td width='33%' align='center'>$Lang::tr{'mtu QoS'}
1445 <tr><td width='33%' align='right'>$Lang::tr{'Queuelenght'}:<td width='33%' align='left'>
1446 <input type='text' name='QLENGTH' maxlength='8' required='2' value='$qossettings{'QLENGTH'}' />
1447 <td width='33%' align='center'>
1448 <tr><td width='33%' align='right'>SFQ Perturb:<td width='33%' align='left'>
1449 <input type='text' name='SFQ_PERTUB' maxlength='8' required='1' value='$qossettings{'SFQ_PERTUB'}' />
1450 <td width='33%' align='center'><input type='submit' name='ACTION' value='$Lang::tr{'save'}' />
1455 &Header
::closebox
();
1459 if ( $qossettings{'VALID'} eq 'yes' ) {
1460 if ( $qossettings{'DEVICE'} eq $qossettings{'RED_DEV'} ) {
1461 $qossettings{'SPD'} = $qossettings{'OUT_SPD'};
1462 } elsif ( $qossettings{'DEVICE'} eq $qossettings{'IMQ_DEV'} ) {
1463 $qossettings{'SPD'} = $qossettings{'INC_SPD'};
1465 unless ( ( $qossettings{'MINBWDTH'} >= 1 ) && ( $qossettings{'MINBWDTH'} <= $qossettings{'SPD'} ) ) {
1466 $qossettings{'VALID'} = 'no';
1467 $message = "$Lang::tr{'false min bandwith'}";
1469 $qossettings{'SPD'} = '';
1474 if ( $qossettings{'VALID'} eq 'yes' ) {
1475 if ( $qossettings{'DEVICE'} eq $qossettings{'RED_DEV'} ) {
1476 $qossettings{'SPD'} = $qossettings{'OUT_SPD'};
1477 } elsif ( $qossettings{'DEVICE'} eq $qossettings{'IMQ_DEV'} ) {
1478 $qossettings{'SPD'} = $qossettings{'INC_SPD'};
1480 unless ( ( $qossettings{'MAXBDWTH'} >= 0 ) && ($qossettings{'MAXBDWTH'} >= $qossettings{'MINBDWTH'}) &&( $qossettings{'MAXBDWTH'} <= $qossettings{'SPD'} ) ) {
1481 $qossettings{'VALID'} = 'no';
1482 $message = "$Lang::tr{'false max bandwith'}";
1484 $qossettings{'SPD'} = '';
1489 if ( $qossettings{'VALID'} eq 'yes' ) {
1490 if ( $qossettings{'DEVICE'} eq $qossettings{'RED_DEV'} ) {
1491 if ($qossettings{'CLASS'} lt 100 || $qossettings{'CLASS'} ge 121) {
1492 $qossettings{'VALID'} = 'no';
1493 $message = "$Lang::tr{'false classnumber'}";
1495 } elsif ( $qossettings{'DEVICE'} eq $qossettings{'IMQ_DEV'} ) {
1496 if ($qossettings{'CLASS'} lt 200 || $qossettings{'CLASS'} ge 221) {
1497 $qossettings{'VALID'} = 'no';
1498 $message = "Die Klassennummer passt nicht zum angegebenen Interface.";
1501 open( FILE
, "< $classfile" ) or die "Unable to read $classfile";
1504 foreach $classentry (sort @tmp)
1506 @tmpline = split( /\;/, $classentry );
1507 if ( $tmpline[1] eq $qossettings{'CLASS'} )
1509 $qossettings{'VALID'} = 'no';
1510 $message = "$Lang::tr{'false classnumber'}";
1518 if ( $qossettings{'VALID'} eq 'yes' ) {
1519 open( FILE
, "< $subclassfile" ) or die "Unable to read $subclassfile";
1522 foreach $subclassentry (sort @tmp)
1524 @tmpline = split( /\;/, $subclassentry );
1525 if ( $tmpline[2] eq $qossettings{'SCLASS'} )
1527 $qossettings{'VALID'} = 'no';
1528 $message = "$Lang::tr{'class in use'}";