]>
git.ipfire.org Git - people/teissler/ipfire-2.x.git/blob - html/cgi-bin/qos.cgi
5 # This code is distributed under the terms of the GPL
12 # enable only the following on debugging purpose
14 use CGI
:: Carp
'fatalsToBrowser' ;
16 require '/var/ipfire/general-functions.pl' ;
17 require "${General::swroot}/lang.pl" ;
18 require "${General::swroot}/header.pl" ;
24 my $errormessage = "" ;
28 my $subclassentry = "" ;
30 my $portruleentry = "" ;
31 my $tosruleentry = "" ;
40 my @subclassline = ();
42 my @portruleline = ();
47 my $classfile = "/var/ipfire/qos/classes" ;
48 my $subclassfile = "/var/ipfire/qos/subclasses" ;
49 my $level7file = "/var/ipfire/qos/level7config" ;
50 my $portfile = "/var/ipfire/qos/portconfig" ;
51 my $tosfile = "/var/ipfire/qos/tosconfig" ;
52 & General
:: readhash
( "${General::swroot}/ethernet/settings" , \
%netsettings );
54 & Header
:: showhttpheaders
();
56 $qossettings { 'ENABLED' } = 'off' ;
57 $qossettings { 'EDIT' } = 'no' ;
58 $qossettings { 'OUT_SPD' } = '' ;
59 $qossettings { 'INC_SPD' } = '' ;
60 $qossettings { 'DEF_OUT_SPD' } = '' ;
61 $qossettings { 'DEF_INC_SPD' } = '' ;
62 $qossettings { 'DEFCLASS_INC' } = '' ;
63 $qossettings { 'DEFCLASS_OUT' } = '' ;
64 $qossettings { 'ACK' } = '' ;
65 $qossettings { 'MTU' } = '1492' ;
66 $qossettings { 'SFQ_PERTUB' } = '10' ;
67 $qossettings { 'QLENGTH' } = '30' ;
68 $qossettings { 'RED_DEV' } = `cat /var/ipfire/red/iface` ;
69 $qossettings { 'IMQ_DEV' } = 'imq0' ;
70 $qossettings { 'VALID' } = 'yes' ;
71 ### Values that have to be initialized
72 $qossettings { 'ACTION' } = '' ;
73 $qossettings { 'ACTIONDEF' } = '' ;
74 $qossettings { 'ACTIONBW' } = '' ;
75 $qossettings { 'RED_DEV_SEL' } = '' ;
76 $qossettings { 'IMQ_DEV_SEL' } = '' ;
77 $qossettings { 'PRIO' } = '' ;
78 $qossettings { 'SPD' } = '' ;
79 $qossettings { 'CLASS' } = '' ;
80 $qossettings { 'SCLASS' } = '' ;
81 $qossettings { 'QPORT' } = '' ;
82 $qossettings { 'DPORT' } = '' ;
83 $qossettings { 'QIP' } = '' ;
84 $qossettings { 'DIP' } = '' ;
85 $qossettings { 'PPROT' } = '' ;
86 $qossettings { 'L7PROT' } = '' ;
87 $qossettings { 'DEVICE' } = '' ;
88 $qossettings { 'MINBWDTH' } = '' ;
89 $qossettings { 'MAXBWDTH' } = '' ;
90 $qossettings { 'BURST' } = '' ;
91 $qossettings { 'CBURST' } = '' ;
92 $qossettings { 'DOCLASS' } = '' ;
93 $qossettings { 'DOSCLASS' } = '' ;
94 $qossettings { 'DOLEVEL7' } = '' ;
95 $qossettings { 'DOPORT' } = '' ;
96 $qossettings { 'CLASS' } = '' ;
97 $qossettings { 'CLASSPRFX' } = '' ;
98 $qossettings { 'DEV' } = '' ;
99 $qossettings { 'TOS' } = '' ;
102 & General
:: readhash
( "${General::swroot}/qos/settings" , \
%qossettings );
103 & Header
:: getcgihash
( \
%qossettings );
106 my %mainsettings = ();
107 & General
:: readhash
( "${General::swroot}/main/settings" , \
%mainsettings );
108 & General
:: readhash
( "/srv/web/ipfire/html/themes/" . $mainsettings { 'THEME' }. "/include/colors.txt" , \
%color );
110 & Header
:: openpage
( 'QoS' , 1 , '' );
111 & Header
:: openbigbox
( '100%' , 'left' , '' , $errormessage );
113 ############################################################################################################################
114 ############################################################################################################################
116 if ( $qossettings { 'DOCLASS' } eq $Lang :: tr
{ 'save' })
121 if ( $qossettings { 'VALID' } eq 'yes' ) {
122 open ( FILE
, ">> $classfile " ) or die "Unable to write $classfile " ;
124 $qossettings {'DEVICE'}; $qossettings {'CLASS'}; $qossettings {'PRIO'}; $qossettings {'MINBWDTH'}; $qossettings {'MAXBWDTH'}; $qossettings {'BURST'}; $qossettings {'CBURST'}; $qossettings {'TOS'}; $qossettings {'REMARK'};
129 $qossettings { 'ACTION' } = 'Parentklasse hinzufuegen' ;
132 elsif ( $qossettings { 'DOCLASS' } eq 'Bearbeiten' )
134 open ( FILE
, "< $classfile " ) or die "Unable to read $classfile " ;
137 open ( FILE
, "> $classfile " ) or die "Unable to write $classfile " ;
138 foreach $classentry ( sort @classes )
140 @classline = split ( /\;/ , $classentry );
141 if ( $classline [ 1 ] ne $qossettings { 'CLASS' } ) {
142 print FILE
$classentry ;
144 $qossettings { 'DEVICE' } = $classline [ 0 ];
145 $qossettings { 'PRIO' } = $classline [ 2 ];
146 $qossettings { 'MINBWDTH' } = $classline [ 3 ];
147 $qossettings { 'MAXBWDTH' } = $classline [ 4 ];
148 $qossettings { 'BURST' } = $classline [ 5 ];
149 $qossettings { 'CBURST' } = $classline [ 6 ];
150 $qossettings { 'TOS' } = $classline [ 7 ];
151 $qossettings { 'REMARK' } = $classline [ 8 ];
152 $qossettings { 'EDIT' } = 'yes' ;
157 & Header
:: closebigbox
();
158 & Header
:: closepage
();
161 elsif ( $qossettings { 'DOCLASS' } eq 'Loeschen' )
163 open ( FILE
, "< $classfile " ) or die "Unable to read $classfile " ;
166 open ( FILE
, "> $classfile " ) or die "Unable to write $classfile " ;
167 foreach $classentry ( sort @tmp )
169 @tmpline = split ( /\;/ , $classentry );
170 if ( $tmpline [ 1 ] ne $qossettings { 'CLASS' } )
172 print FILE
$classentry ;
176 open ( FILE
, "< $subclassfile " ) or die "Unable to read $classfile " ;
179 open ( FILE
, "> $subclassfile " ) or die "Unable to write $classfile " ;
180 foreach $subclassentry ( sort @tmp )
182 @tmpline = split ( /\;/ , $subclassentry );
183 if ( $tmpline [ 1 ] ne $qossettings { 'CLASS' } )
185 print FILE
$subclassentry ;
189 $message = "Klasse $qossettings {'CLASS'} wurde mit eventuell vorhandenen Unterklassen geloescht." ;
192 ############################################################################################################################
193 ############################################################################################################################
195 if ( $qossettings { 'DOSCLASS' } eq $Lang :: tr
{ 'save' })
199 if ( $qossettings { 'VALID' } eq 'yes' ) {
200 open ( FILE
, ">> $subclassfile " ) or die "Unable to write $subclassfile " ;
202 $qossettings {'DEVICE'}; $qossettings {'CLASS'}; $qossettings {'SCLASS'}; $qossettings {'PRIO'}; $qossettings {'MINBWDTH'}; $qossettings {'MAXBWDTH'}; $qossettings {'BURST'}; $qossettings {'CBURST'}; $qossettings {'TOS'};
207 $qossettings { 'ACTION' } = 'Unterklasse hinzufuegen' ;
209 } elsif ( $qossettings { 'DOSCLASS' } eq 'Loeschen' )
211 open ( FILE
, "< $subclassfile " ) or die "Unable to read $classfile " ;
214 open ( FILE
, "> $subclassfile " ) or die "Unable to write $classfile " ;
215 foreach $subclassentry ( sort @tmp )
217 @tmpline = split ( /\;/ , $subclassentry );
218 if ( $tmpline [ 2 ] ne $qossettings { 'CLASS' } )
220 print FILE
$subclassentry ;
224 $message = "Unterklasse $qossettings {'CLASS'} wurde geloescht." ;
227 ############################################################################################################################
228 ############################################################################################################################
230 if ( $qossettings { 'DOLEVEL7' } eq $Lang :: tr
{ 'save' })
232 if ( $qossettings { 'QIP' } ne '' ) {
233 unless ( & General
:: validip
( $qossettings { 'QIP' }) ) {
234 $qossettings { 'VALID' } = 'no' ;
235 $message = "Die Quell-IP-Adresse ist ungueltig." ;
238 if ( $qossettings { 'DIP' } ne '' ) {
239 unless ( & General
:: validip
( $qossettings { 'DIP' }) ) {
240 $qossettings { 'VALID' } = 'no' ;
241 $message = "Die Ziel-IP-Adresse ist ungueltig." ;
244 if ( $qossettings { 'CLASS' } >= 100 && $qossettings { 'CLASS' } < 121 ) {
245 $qossettings { 'DEVICE' } = $qossettings { 'RED_DEV' };
246 } elsif ( $qossettings { 'CLASS' } >= 1000 && $qossettings { 'CLASS' } < 1021 ) {
247 $qossettings { 'DEVICE' } = $qossettings { 'RED_DEV' };
248 } elsif ( $qossettings { 'CLASS' } >= 200 && $qossettings { 'CLASS' } < 221 ) {
249 $qossettings { 'DEVICE' } = $qossettings { 'IMQ_DEV' };
250 } elsif ( $qossettings { 'CLASS' } >= 2000 && $qossettings { 'CLASS' } < 2021 ) {
251 $qossettings { 'DEVICE' } = $qossettings { 'IMQ_DEV' };
253 if ( $qossettings { 'VALID' } eq 'yes' ) {
254 open ( FILE
, ">> $level7file " ) or die "Unable to write $level7file " ;
256 $qossettings {'CLASS'}; $qossettings {'DEVICE'}; $qossettings {'L7PROT'}; $qossettings {'QIP'}; $qossettings {'DIP'};
261 $qossettings { 'ACTION' } = 'Level7-Regel hinzufuegen' ;
264 elsif ( $qossettings { 'DOLEVEL7' } eq 'Loeschen' )
266 open ( FILE
, "< $level7file " ) or die "Unable to read $level7file " ;
269 open ( FILE
, "> $level7file " ) or die "Unable to read $level7file " ;
270 foreach $l7ruleentry ( sort @l7rules )
272 @l7ruleline = split ( /\;/ , $l7ruleentry );
273 if ( ( $l7ruleline [ 0 ] ne $qossettings { 'CLASS' }) && ( $l7ruleline [ 2 ] ne $qossettings { 'L7PROT' }))
275 print FILE
$l7ruleentry ;
279 $message = "Level7-Regel ( $qossettings {'CLASS'} - $qossettings {'L7PROT'}) wurde geloescht." ;
282 ############################################################################################################################
283 ############################################################################################################################
285 if ( $qossettings { 'DOPORT' } eq $Lang :: tr
{ 'save' })
287 if ( $qossettings { 'QIP' } ne '' ) {
288 unless ( & General
:: validip
( $qossettings { 'QIP' }) ) {
289 $qossettings { 'VALID' } = 'no' ;
290 $message = "Die Quell-IP-Adresse ist ungueltig." ;
293 if ( $qossettings { 'DIP' } ne '' ) {
294 unless ( & General
:: validip
( $qossettings { 'DIP' }) ) {
295 $qossettings { 'VALID' } = 'no' ;
296 $message = "Die Ziel-IP-Adresse ist ungueltig." ;
299 if ( $qossettings { 'CLASS' } >= 100 && $qossettings { 'CLASS' } < 121 ) {
300 $qossettings { 'DEVICE' } = $qossettings { 'RED_DEV' };
301 } elsif ( $qossettings { 'CLASS' } >= 1000 && $qossettings { 'CLASS' } < 1021 ) {
302 $qossettings { 'DEVICE' } = $qossettings { 'RED_DEV' };
303 } elsif ( $qossettings { 'CLASS' } >= 200 && $qossettings { 'CLASS' } < 221 ) {
304 $qossettings { 'DEVICE' } = $qossettings { 'IMQ_DEV' };
305 } elsif ( $qossettings { 'CLASS' } >= 2000 && $qossettings { 'CLASS' } < 2021 ) {
306 $qossettings { 'DEVICE' } = $qossettings { 'IMQ_DEV' };
308 if ( $qossettings { 'VALID' } eq 'yes' ) {
309 open ( FILE
, ">> $portfile " ) or die "Unable to write $portfile " ;
311 $qossettings {'CLASS'}; $qossettings {'DEVICE'}; $qossettings {'PPROT'}; $qossettings {'QIP'}; $qossettings {'QPORT'}; $qossettings {'DIP'}; $qossettings {'DPORT'};
316 $qossettings { 'ACTION' } = 'Port-Regel hinzufuegen' ;
318 } elsif ( $qossettings { 'DOPORT' } eq 'Loeschen' )
320 open ( FILE
, "< $portfile " ) or die "Unable to read $portfile " ;
323 open ( FILE
, "> $portfile " ) or die "Unable to read $portfile " ;
324 foreach $portruleentry ( sort @portrules )
326 @portruleline = split ( /\;/ , $portruleentry );
327 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' }))
329 print FILE
$portruleentry ;
333 $message = "Port-Regel ( $qossettings {'CLASS'} - $qossettings {'PPROT'}) wurde geloescht." ;
336 ############################################################################################################################
337 ############################################################################################################################
339 if ( $qossettings { 'DOTOS' } eq $Lang :: tr
{ 'save' })
341 if ( $qossettings { 'CLASS' } >= 100 && $qossettings { 'CLASS' } < 121 ) {
342 $qossettings { 'DEVICE' } = $qossettings { 'RED_DEV' };
343 } elsif ( $qossettings { 'CLASS' } >= 1000 && $qossettings { 'CLASS' } < 1021 ) {
344 $qossettings { 'DEVICE' } = $qossettings { 'RED_DEV' };
345 } elsif ( $qossettings { 'CLASS' } >= 200 && $qossettings { 'CLASS' } < 221 ) {
346 $qossettings { 'DEVICE' } = $qossettings { 'IMQ_DEV' };
347 } elsif ( $qossettings { 'CLASS' } >= 2000 && $qossettings { 'CLASS' } < 2021 ) {
348 $qossettings { 'DEVICE' } = $qossettings { 'IMQ_DEV' };
350 open ( FILE
, ">> $tosfile " ) or die "Unable to write $tosfile " ;
352 $qossettings {'CLASS'}; $qossettings {'DEVICE'}; $qossettings {'TOS'};
357 elsif ( $qossettings { 'DOTOS' } eq 'Loeschen' )
359 open ( FILE
, "< $tosfile " ) or die "Unable to read $tosfile " ;
362 open ( FILE
, "> $tosfile " ) or die "Unable to read $tosfile " ;
363 foreach $tosruleentry ( sort @tosrules )
365 @tosruleline = split ( /\;/ , $tosruleentry );
366 unless ( ( $tosruleline [ 0 ] eq $qossettings { 'CLASS' }) && ( $tosruleline [ 2 ] eq $qossettings { 'TOS' }))
368 print FILE
$tosruleentry ;
372 $message = "TOS-Regel ( $qossettings {'CLASS'} - $qossettings {'TOS'}) wurde geloescht." ;
373 } elsif ( $qossettings { 'DOTOS' } eq 'Bearbeiten' )
375 open ( FILE
, "< $tosfile " ) or die "Unable to read $tosfile " ;
378 open ( FILE
, "> $tosfile " ) or die "Unable to write $tosfile " ;
379 foreach $tosruleentry ( sort @tosrules )
381 @tosruleline = split ( /\;/ , $tosruleentry );
382 if (( $tosruleline [ 0 ] eq $qossettings { 'CLASS' } ) && ( $tosruleline [ 2 ] eq $qossettings { 'TOS' } )) {
383 $qossettings { 'DEVICE' } = $tosruleline [ 1 ];
384 $qossettings { 'CLASS' } = $tosruleline [ 0 ];
385 $qossettings { 'TOS' } = $tosruleline [ 2 ];
386 $qossettings { 'EDIT' } = 'yes' ;
388 print FILE
$tosruleentry ;
393 & Header
:: closebigbox
();
394 & Header
:: closepage
();
398 ############################################################################################################################
399 ############################################################################################################################
401 if ( $qossettings { 'ACTION' } eq 'Start' )
403 system ( "/usr/local/bin/qosctrl generate >/dev/null 2>&1" );
404 system ( "/usr/bin/touch /var/ipfire/qos/enable" );
405 system ( "/usr/local/bin/qosctrl start >/dev/null 2>&1" );
406 system ( "logger -t ipfire 'QoS started'" );
407 $qossettings { 'ENABLED' } = 'on' ;
408 & General
:: writehash
( "${General::swroot}/qos/settings" , \
%qossettings );
410 elsif ( $qossettings { 'ACTION' } eq 'Stop' )
412 system ( "/usr/local/bin/qosctrl stop >/dev/null 2>&1" );
413 unlink "/var/ipfire/qos/bin/qos.sh" ;
414 unlink "/var/ipfire/qos/enable" ;
415 system ( "logger -t ipfire 'QoS stopped'" );
416 $qossettings { 'ENABLED' } = 'off' ;
417 & General
:: writehash
( "${General::swroot}/qos/settings" , \
%qossettings );
419 elsif ( $qossettings { 'ACTION' } eq 'Neustart' )
421 if ( $qossettings { 'ENABLED' } eq 'on' ){
422 system ( "/usr/local/bin/qosctrl stop >/dev/null 2>&1" );
423 system ( "/usr/local/bin/qosctrl generate >/dev/null 2>&1" );
424 system ( "/usr/local/bin/qosctrl start >/dev/null 2>&1" );
425 system ( "logger -t ipfire 'QoS restarted'" );
428 elsif ( $qossettings { 'ACTION' } eq $Lang :: tr
{ 'save' })
430 if ( $qossettings { 'DEF_INC_SPD' } eq '' ) {
431 $qossettings { 'DEF_INC_SPD' } = int ( $qossettings { 'INC_SPD' } * 0.9 );
433 if ( $qossettings { 'DEF_OUT_SPD' } eq '' ) {
434 $qossettings { 'DEF_OUT_SPD' } = int ( $qossettings { 'OUT_SPD' } * 0.9 );
436 & General
:: writehash
( "${General::swroot}/qos/settings" , \
%qossettings );
438 elsif ( $qossettings { 'ACTION' } eq 'Statusinformationen' )
440 & Header
:: openbox
( '100%' , 'left' , 'QoS Status' );
441 if ( $qossettings { 'ENABLED' } eq 'on' ){
443 $output = `/usr/local/bin/qosctrl status` ;
444 $output = & Header
:: cleanhtml
( $output , "y" );
445 print "<pre> $output </pre> \n " ;
446 } else { print "QoS ist nicht aktiviert!" ; }
448 & Header
:: closebigbox
();
449 & Header
:: closepage
();
452 elsif ( $qossettings { 'ACTION' } eq 'Grafische Auswertung' )
454 open ( FILE
, "< $classfile " ) or die "Unable to read $classfile " ;
457 open ( FILE
, "< $subclassfile " ) or die "Unable to read $subclassfile " ;
458 @subclasses = < FILE
>;
460 & Header
:: openbox
( '100%' , 'left' , 'QoS Graphen' );
462 <table width='100%'> <tr><td align='center'><font color='red'>Diese Seite braucht je nach Geschwindigkeit des Computers laenger zum Laden.</font>
463 <tr><td align='center'><b>Klasse:</b>
466 foreach $classentry ( sort @classes )
468 @classline = split ( /\;/ , $classentry );
469 $qossettings { 'CLASS' }= $classline [ 1 ];
471 <input type="button" onClick="swapVisibility(' $qossettings {'CLASS'}')" value=' $qossettings {'CLASS'}' />
480 foreach $classentry ( sort @classes )
482 @classline = split ( /\;/ , $classentry );
483 $qossettings { 'DEV' }= $classline [ 0 ];
484 $qossettings { 'CLASS' }= $classline [ 1 ];
485 & gengraph
( $qossettings { 'DEV' }, $qossettings { 'CLASS' });
486 print "<div id=' $qossettings {'CLASS'}' style='display: none'>" ;
487 & Header
:: openbox
( '100%' , 'center' , " $qossettings {'CLASS'} ( $qossettings {'DEV'})" );
490 <tr><td colspan='2' align='center'><img src='/graphs/class_ $qossettings {'CLASSPRFX'}- $qossettings {'CLASS'}_ $qossettings {'DEV'}-packets.png' />
491 <tr><td colspan='2' align='center'><img src='/graphs/class_ $qossettings {'CLASSPRFX'}- $qossettings {'CLASS'}_ $qossettings {'DEV'}-borrowed.png' />
492 <tr><td colspan='2' align='center'><img src='/graphs/class_ $qossettings {'CLASSPRFX'}- $qossettings {'CLASS'}_ $qossettings {'DEV'}-bytes.png' />
495 foreach $subclassentry ( sort @subclasses )
497 @subclassline = split ( /\;/ , $subclassentry );
498 if ( $subclassline [ 1 ] eq $classline [ 1 ]) {
499 $qossettings { 'DEV' }= $subclassline [ 0 ];
500 $qossettings { 'SCLASS' }= $subclassline [ 2 ];
501 & gengraph
( $qossettings { 'DEV' }, $qossettings { 'SCLASS' });
503 <tr><td colspan='2' align='center'><img src='/graphs/class_ $qossettings {'CLASSPRFX'}- $qossettings {'SCLASS'}_ $qossettings {'DEV'}-packets.png' />
504 <tr><td colspan='2' align='center'><img src='/graphs/class_ $qossettings {'CLASSPRFX'}- $qossettings {'SCLASS'}_ $qossettings {'DEV'}-borrowed.png' />
505 <tr><td colspan='2' align='center'><img src='/graphs/class_ $qossettings {'CLASSPRFX'}- $qossettings {'SCLASS'}_ $qossettings {'DEV'}-bytes.png' />
510 print " \t\t </table>" ;
518 & Header
:: closebigbox
();
519 & Header
:: closepage
();
522 elsif ( $qossettings { 'ACTION' } eq 'Parentklasse hinzufuegen' )
525 & Header
:: closebigbox
();
526 & Header
:: closepage
();
529 elsif ( $qossettings { 'ACTION' } eq 'Unterklasse hinzufuegen' )
532 & Header
:: closebigbox
();
533 & Header
:: closepage
();
536 elsif ( $qossettings { 'ACTION' } eq 'Regel hinzufuegen' )
538 & Header
:: openbox
( '100%' , 'center' , 'Regel hinzufuegen' );
541 <tr><td align='center'>Waehlen sie <u>eine</u> der untenstehenden Regeln aus.
542 <tr><td align='center'>
543 <input type="button" onClick="swapVisibility('l7rule')" value='Level7-Regel' />
544 <input type="button" onClick="swapVisibility('portrule')" value='Port-Regel' />
545 <input type="button" onClick="swapVisibility('tosrule')" value='TOS-Regel' />
551 <div id='l7rule' style='display: none'>
557 <div id='portrule' style='display: none'>
563 <div id='tosrule' style='display: none'>
571 & Header
:: closebigbox
();
572 & Header
:: closepage
();
575 elsif ( $qossettings { 'ACTION' } eq 'Erweiterte Einstellungen' )
578 & Header
:: closebigbox
();
579 & Header
:: closepage
();
582 if ( $qossettings { 'ACTIONBW' } eq 'Andern' )
585 & Header
:: closebigbox
();
586 & Header
:: closepage
();
589 if ( $qossettings { 'ACTIONDEF' } eq 'Andern' )
592 & Header
:: closebigbox
();
593 & Header
:: closepage
();
597 & General
:: readhash
( "${General::swroot}/qos/settings" , \
%qossettings );
599 my $status = $Lang :: tr
{ 'stopped' };
600 my $statuscolor = '#993333' ;
601 if ( $qossettings { 'ENABLED' } eq 'on' ) {
602 $status = $Lang :: tr
{ 'running' };
603 $statuscolor = '#339933' ;
606 if ( $netsettings { 'RED_TYPE' } ne 'PPPOE' ) {
607 $qossettings { 'RED_DEV' } = $netsettings { 'RED_DEV' };
611 & Header
:: openbox
( '100%' , 'left' , $Lang :: tr
{ 'error messages' });
612 print "<class name='base'> $errormessage \n " ;
613 print " </class> \n " ;
617 ############################################################################################################################
618 ############################################################################################################################
620 & Header
:: openbox
( '100%' , 'center' , 'Quality of Service' );
623 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
627 if ( $message ne "" ) {
628 print "<tr><td colspan='2' align='center'><font color='red'> $message </font>" ;
631 <tr><td width='50%' align='left'><b>Quality of Service:</b>
632 <td width='50%' align='center' bgcolor=' $statuscolor '><font color='white'> $status </font>
633 <tr><td width='100%' align='center' colspan='2'>
634 <input type='submit' name='ACTION' value="Start" />
635 <input type='submit' name='ACTION' value="Stop" />
636 <input type='submit' name='ACTION' value=" $Lang ::tr{'restart'}" /></table></form>
639 if (( $qossettings { 'OUT_SPD' } ne '' ) && ( $qossettings { 'INC_SPD' } ne '' )) {
641 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
643 <tr><td colspan='3'>
644 <tr><td width='40%' align='right'>Downloadgeschwindigkeit: <td width='40%' align='left'> $qossettings {'INC_SPD'} kbps
645 <td width='20%' rowspan='2' align='center' valign='middle'><input type='submit' name='ACTIONBW' value='Andern' />
646 <tr><td width='40%' align='right'>Uploadgeschwindigkeit: <td width='40%' align='left'> $qossettings {'OUT_SPD'} kbps
651 if (( $qossettings { 'DEFCLASS_OUT' } ne '' ) && ( $qossettings { 'DEFCLASS_INC' } ne '' )&& ( $qossettings { 'ACK' } ne '' )) {
653 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
655 <tr><td colspan='3'><hr />
656 <tr><td width='40%' align='right'>Downloadstandardklasse: <td width='40%' align='left'> $qossettings {'DEFCLASS_INC'}
657 <td width='20%' rowspan='3' align='center' valign='middle'><input type='submit' name='ACTIONDEF' value='Andern' />
658 <tr><td width='40%' align='right'>Uploadstandardklasse: <td width='40%' align='left'> $qossettings {'DEFCLASS_OUT'}
659 <tr><td width='40%' align='right'>ACKs: <td width='40%' align='left'> $qossettings {'ACK'}
660 <tr><td colspan='3' width='100%'><hr />
661 <tr><td colspan='3' width='100%' align='center'>
664 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
665 <table border='0' cellpadding='0' cellspacing='0'>
666 <tr><td><input type='submit' name='ACTION' value='Parentklasse hinzufuegen' />
667 <td><input type='submit' name='ACTION' value='Erweiterte Einstellungen' />
668 <tr><td><input type='submit' name='ACTION' value='Statusinformationen' />
669 <td><input type='submit' name='ACTION' value='Grafische Auswertung' />
677 if ( ( $qossettings { 'OUT_SPD' } eq '' ) || ( $qossettings { 'INC_SPD' } eq '' ) ) {
679 & Header
:: closebigbox
();
680 & Header
:: closepage
();
684 if ( ( $qossettings { 'DEFCLASS_INC' } eq '' ) || ( $qossettings { 'DEFCLASS_OUT' } eq '' ) || ( $qossettings { 'ACK' } eq '' ) ) {
686 & Header
:: closebigbox
();
687 & Header
:: closepage
();
691 & Header
:: openbox
( '100%' , 'center' , $Lang :: tr
{ 'info' });
692 & overviewgraph
( $qossettings { 'RED_DEV' });
693 & overviewgraph
( $qossettings { 'IMQ_DEV' });
696 <tr><td colspan='9' align='center' valign='middle'><img alt="" src='/images/addblue.gif' /> Unterklasse hinzufuegen | <img alt="" src='/images/addgreen.gif' /> Regel hinzufuegen | <img alt="" src='/images/edit.gif' /> Bearbeiten | <img alt="" src='/images/delete.gif' /> Loeschen
697 <tr><td colspan='9' align='right' valign='middle'><b>TOS-Bits:</b> <b>0</b> - Deaktiviert | <b>8</b> - Minimale Verzoegerung | <b>4</b> - Maximaler Durchsatz | <b>2</b> - Maximale Zuverlaessigkeit | <b>1</b> - Minimale Kosten
700 if (( - e
"/srv/web/ipfire/html/graphs/qos-graph- $qossettings {'RED_DEV'}.png" ) && ( - e
"/srv/web/ipfire/html/graphs/qos-graph- $qossettings {'IMQ_DEV'}.png" )) {
702 <tr><td colspan='9' align='center'><img alt="" src="/graphs/qos-graph- $qossettings {'RED_DEV'}.png" />
703 <tr><td colspan='9' align='center'><img alt="" src="/graphs/qos-graph- $qossettings {'IMQ_DEV'}.png" />
710 & showclasses
( $qossettings { 'RED_DEV' });
711 & showclasses
( $qossettings { 'IMQ_DEV' });
713 & Header
:: closebigbox
();
714 & Header
:: closepage
();
716 ############################################################################################################################
717 ############################################################################################################################
719 sub changedefclasses
{
720 & Header
:: openbox
( '100%' , 'center' , 'Standardklassen:' );
722 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
724 <tr><td width='100%' colspan='3'>Legen sie hier die Standardklassen fest durch die nicht-gefilterte Pakete gehen.
725 <tr><td width='33%' align='right'>Download:<td width='33%' align='left'><select name='DEFCLASS_INC'>
728 for ( $c = 200 ; $c <= 220 ; $c ++ )
730 if ( $qossettings { 'DEFCLASS_INC' } ne $c )
731 { print "<option value=' $c '> $c </option> \n " ; }
732 else { print "<option selected value=' $c '> $c </option> \n " ; }
735 </select><td width='33%' align='center'>
736 <tr><td width='33%' align='right'>Upload:<td width='33%' align='left'><select name='DEFCLASS_OUT'>
739 for ( $c = 100 ; $c <= 120 ; $c ++ )
741 if ( $qossettings { 'DEFCLASS_OUT' } ne $c )
742 { print "<option value=' $c '> $c </option> \n " ; }
743 else { print "<option selected value=' $c '> $c </option> \n " ; }
746 </select><td width='33%' align='center'>
750 <tr><td width='100%' colspan='3'>Legen sie hier die ACK-Klasse fest <br /> und klicken Sie danach auf <i>Speichern</i>.
751 <tr><td width='33%' align='right'>ACKs:<td width='33%' align='left'><select name='ACK'>
754 for ( $c = 100 ; $c <= 120 ; $c ++ )
756 if ( $qossettings { 'ACK' } ne $c )
757 { print "<option value=' $c '> $c </option> \n " ; }
758 else { print "<option selected value=' $c '> $c </option> \n " ; }
761 </select><td width='33%' align='center'><input type='submit' name='ACTION' value=" $Lang ::tr{'save'}" />
769 sub changebandwidth
{
770 & Header
:: openbox
( '100%' , 'center' , 'Bandbreiteneinstellungen' );
771 if ( $qossettings { 'ENABLED' } eq 'on' ) {
772 print "Sie koennen die Bandbreiteneinstellungen nicht bearbeiten, wenn QoS eingeschaltet ist. Schalten sie es zuerst dazu aus.<p>" ;
773 print "<a href='/cgi-bin/qos.cgi'>Zurueck</a>" ;
776 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
777 <input type='hidden' name='DEF_OUT_SPD' value='' /><input type='hidden' name='DEF_INC_SPD' value='' />
779 <tr><td width='100%' colspan='3'>Geben Sie bitte hier ihre Download- bzw. Upload-Geschwindigkeit ein <br /> und klicken Sie danach auf <i>Speichern</i>.
780 <tr><td width='33%' align='right'>Download-Geschwindigkeit:
781 <td width='33%' align='left'><input type='text' name='INC_SPD' maxlength='8' value=" $qossettings {'INC_SPD'}" /> kbps
782 <td width='33%' align='center'>
783 <tr><td width='33%' align='right'>Upload-Geschwindigkeit:
784 <td width='33%' align='left'><input type='text' name='OUT_SPD' maxlength='8' value=" $qossettings {'OUT_SPD'}" /> kbps
785 <td width='33%' align='center'><input type='submit' name='ACTION' value=" $Lang ::tr{'save'}" /> <input type='reset' name='ACTION' value=" $Lang ::tr{'reset'}" />
795 & Header
:: openbox
( '100%' , 'center' , 'Parentklasse' );
797 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
801 if ( $message ne "" ) {
802 print "<tr><td colspan='3' align='center'> $message " ;
804 if ( $qossettings { 'EDIT' } eq 'yes' ) {
805 print "<input type='hidden' name='CLASS' value= $qossettings {'CLASS'} />" ;
806 print "<input type='hidden' name='DEVICE' value= $qossettings {'DEVICE'} />" ;
809 <tr><td width='100%' colspan='3'>Geben sie die Daten ein <br /> und klicken Sie danach auf <i>Speichern</i>.
810 <tr><td width='33%' align='right'>Interface:
811 <td width='33%' align='left'>
814 if ( $qossettings { 'EDIT' } eq 'yes' ) {
815 print "<select name='DEVICE' disabled>" ;
817 print "<select name='DEVICE'>" ;
819 if ( $qossettings { 'DEVICE' } eq $qossettings { 'RED_DEV' } ) {
820 $qossettings { 'RED_DEV_SEL' } = 'selected' ;
821 } elsif ( $qossettings { 'DEVICE' } eq $qossettings { 'IMQ_DEV' } ) {
822 $qossettings { 'IMQ_DEV_SEL' } = 'selected' ;
825 <option value= $qossettings {'RED_DEV'} $qossettings {'RED_DEV_SEL'}> $qossettings {'RED_DEV'}</option>
826 <option value= $qossettings {'IMQ_DEV'} $qossettings {'IMQ_DEV_SEL'}> $qossettings {'IMQ_DEV'}</option></select>
827 <td width='33%' align='center'>
828 <tr><td width='33%' align='right'>Klasse:<td width='33%' align='left'>
831 if ( $qossettings { 'EDIT' } eq 'yes' ) {
832 print "<select name='CLASS' disabled>" ;
834 print "<select name='CLASS'>" ;
836 for ( $c = 100 ; $c <= 120 ; $c ++ )
838 if ( $qossettings { 'CLASS' } ne $c )
839 { print "<option value=' $c '> $c </option> \n " ; }
840 else { print "<option selected value=' $c '> $c </option> \n " ; }
842 for ( $c = 200 ; $c <= 220 ; $c ++ )
844 if ( $qossettings { 'CLASS' } ne $c )
845 { print "<option value=' $c '> $c </option> \n " ; }
846 else { print "<option selected value=' $c '> $c </option> \n " ; }
850 <td width='33%' align='center'>
851 <tr><td width='33%' align='right'>Prioritaet:<td width='33%' align='left'><select name='PRIO'>
854 for ( $c = 1 ; $c <= 7 ; $c ++ )
856 if ( $qossettings { 'PRIO' } ne $c )
857 { print "<option value=' $c '> $c </option> \n " ; }
858 else { print "<option selected value=' $c '> $c </option> \n " ; }
860 if ( $qossettings { 'MINBWDTH' } eq "" ) { $qossettings { 'MINBWDTH' } = "1" ; }
863 <td width='33%' align='center'>
864 <tr><td width='33%' align='right'>Garantierte Bandbreite:
865 <td width='33%' align='left'><input type='text' size='20' name='MINBWDTH' maxlength='8' required='1' value=" $qossettings {'MINBWDTH'}" />
866 <td width='33%' align='center'>
867 <tr><td width='33%' align='right'>Maximale Bandbreite:
868 <td width='33%' align='left'><input type='text' size='20' name='MAXBWDTH' maxlength='8' required='1' value=" $qossettings {'MAXBWDTH'}" />
869 <td width='33%' align='center'>
870 <tr><td width='33%' align='right'>Burst:
871 <td width='33%' align='left'><input type='text' size='20' name='BURST' maxlength='8' value=" $qossettings {'BURST'}" />
872 <td width='33%' align='center'>
873 <tr><td width='33%' align='right'>Ceilburst:
874 <td width='33%' align='left'><input type='text' size='20' name='CBURST' maxlength='8' value=" $qossettings {'CBURST'}" />
875 <td width='33%' align='center'>
876 <tr><td width='33%' align='right'>TOS-Bit:
877 <td width='33%' align='left'><select name='TOS'>
878 <option value='0'>Ausgeschaltet (0)</option>
879 <option value='8'>Minimale Verzoegerung (8)</option>
880 <option value='4'>Maximaler Durchsatz (4)</option>
881 <option value='2'>Maximale Zuverlaessigkeit (2)</option>
882 <option value='1'>Minimale Kosten (1)</option></select>
883 <td width='33%' align='center'>
884 <tr><td width='33%' align='right'> $Lang ::tr{'remark'}:
885 <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' />
886 <tr><td width='33%' align='right'>
887 <td width='33%' align='left'>
888 <td width='33%' align='center'><input type='submit' name='DOCLASS' value= $Lang ::tr{'save'} /> <input type='reset' value= $Lang ::tr{'reset'} />
896 & Header
:: openbox
( '100%' , 'center' , 'Unterklasse' );
898 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
902 if ( $message ne "" ) {
903 print "<tr><td colspan='3' align='center'> $message " ;
906 <tr><td colspan='3' width='100%'>Aktuelle Klasse: $qossettings {'CLASS'}
907 <tr><td width='100%' colspan='3'>Geben sie die Daten ein <br /> und klicken Sie danach auf <i>Speichern</i>.
908 <tr><td width='33%' align='right'>Unterklasse:<td width='33%' align='left'><select name='SCLASS'>
911 if ( $qossettings { 'CLASS' } >= 100 && $qossettings { 'CLASS' } < 121 ) {
912 $qossettings { 'DEVICE' } = $qossettings { 'RED_DEV' };
913 for ( $c = 1000 ; $c <= 1020 ; $c ++ )
915 if ( $qossettings { 'SCLASS' } ne $c )
916 { print "<option value=' $c '> $c </option> \n " ; }
917 else { print "<option selected value=' $c '> $c </option> \n " ; }
919 } elsif ( $qossettings { 'CLASS' } >= 200 && $qossettings { 'CLASS' } < 221 ) {
920 $qossettings { 'DEVICE' } = $qossettings { 'IMQ_DEV' };
921 for ( $c = 2000 ; $c <= 2020 ; $c ++ )
923 if ( $qossettings { 'SCLASS' } ne $c )
924 { print "<option value=' $c '> $c </option> \n " ; }
925 else { print "<option selected value=' $c '> $c </option> \n " ; }
930 <td width='33%' align='center'>
931 <tr><td width='33%' align='right'>Prioritaet:<td width='33%' align='left'><select name='PRIO'>
934 for ( $c = 1 ; $c <= 7 ; $c ++ )
936 if ( $qossettings { 'PRIO' } ne $c )
937 { print "<option value=' $c '> $c </option> \n " ; }
938 else { print "<option selected value=' $c '> $c </option> \n " ; }
941 <td width='33%' align='center'>
942 <tr><td width='33%' align='right'>Garantierte Bandbreite:
943 <td width='33%' align='left'><input type='text' name='MINBWDTH' maxlength='8' required='1' value=" $qossettings {'MINBWDTH'}" />
944 <td width='33%' align='center'>
945 <tr><td width='33%' align='right'>Maximale Bandbreite:
946 <td width='33%' align='left'><input type='text' name='MAXBWDTH' maxlength='8' required='1' value=" $qossettings {'MAXBWDTH'}" />
947 <td width='33%' align='center'>
948 <tr><td width='33%' align='right'>Burst:
949 <td width='33%' align='left'><input type='text' name='BURST' maxlength='8' value=" $qossettings {'BURST'}" />
950 <td width='33%' align='center'>
951 <tr><td width='33%' align='right'>Ceilburst:
952 <td width='33%' align='left'><input type='text' name='CBURST' maxlength='8' value=" $qossettings {'CBURST'}" />
953 <td width='33%' align='center'>
954 <tr><td width='33%' align='right'>TOS-Bit:
955 <td width='33%' align='left'><select name='TOS'>
956 <option value='0'>Ausgeschaltet (0)</option>
957 <option value='8'>Minimale Verzoegerung (8)</option>
958 <option value='4'>Maximaler Durchsatz (4)</option>
959 <option value='2'>Maximale Zuverlaessigkeit (2)</option>
960 <option value='1'>Minimale Kosten (1)</option></select>
961 <td width='33%' align='center'><input type='hidden' name='CLASS' value=" $qossettings {'CLASS'}" />
962 <input type='hidden' name='DEVICE' value=" $qossettings {'DEVICE'}" />
963 <input type='submit' name='DOSCLASS' value= $Lang ::tr{'save'} /> <input type='reset' value= $Lang ::tr{'reset'} />
971 & Header
:: openbox
( '100%' , 'center' , 'Level7-Regel' );
973 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
977 if ( $message ne "" ) {
978 print "<tr><td colspan='3' align='center'><font color='red'> $message </font>" ;
981 <tr><td colspan='3' width='100%'>Aktuelle Klasse: $qossettings {'CLASS'}
982 <tr><td width='100%' colspan='3'>Geben sie die Daten ein <br /> und klicken Sie danach auf <i>Speichern</i>.
983 <tr><td width='33%' align='right'>Protokoll:
984 <td width='33%' align='left'><select name='L7PROT'>
987 opendir ( DIR
, "/etc/l7-protocols/protocols" );
988 foreach $direntry ( sort readdir ( DIR
) )
990 next if $direntry eq "." ;
991 next if $direntry eq ".." ;
992 next if - d
"/etc/l7-protocols/protocols/ $direntry " ;
993 @proto = split ( /\./ , $direntry );
994 if ( $proto [ 0 ] eq $qossettings { 'L7PROT' } ) {
995 print "<option value=' $proto [0]' selected> $proto [0]</option> \n " ;
997 print "<option value=' $proto [0]'> $proto [0]</option> \n " ;
1002 </select><td width='33%' align='center'>
1003 <tr><td width='33%' align='right'>Quell-IP-Adresse:
1004 <td width='33%' align='left'><input type='text' name='QIP' maxlength='15' value= $qossettings {'QIP'} />
1005 <td width='33%' align='center'>
1006 <tr><td width='33%' align='right'>Ziel-IP-Adresse:
1007 <td width='33%' align='left'><input type='text' name='DIP' maxlength='15' value= $qossettings {'DIP'} />
1008 <td width='33%' align='center'><input type='hidden' name='CLASS' value= $qossettings {'CLASS'} /><input type='submit' name='DOLEVEL7' value= $Lang ::tr{'save'} />
1012 & Header
:: closebox
();
1016 & Header
:: openbox
( '100%' , 'center' , 'Port-Regel hinzufuegen' );
1018 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1020 <tr><td width='100%' colspan='3'>Geben sie die Daten ein <br /> und klicken Sie danach auf <i>Speichern</i>.
1021 <tr><td width='33%' align='right'>Protokoll:
1022 <td width='33%' align='left'><select name='PPROT'>
1025 open ( FILE
, "< /etc/protocols" );
1028 foreach $direntry ( sort @proto )
1030 @tmpline = split ( /\ / , $direntry );
1031 next if $tmpline [ 0 ] =~ "#" ;
1032 if ( $tmpline [ 0 ] eq $qossettings { 'PPROT' } ) {
1033 print "<option value=' $tmpline [0]' selected> $tmpline [0]</option> \n " ;
1035 print "<option value=' $tmpline [0]'> $tmpline [0]</option> \n " ;
1039 </select><td width='33%' align='center'>
1040 <tr><td width='33%' align='right'>Quell-Port:
1041 <td width='33%' align='left'><input type='text' name='QPORT' maxlength='5' value= $qossettings {'QPORT'} />
1042 <td width='33%' align='center'>
1043 <tr><td width='33%' align='right'>Ziel-Port:
1044 <td width='33%' align='left'><input type='text' name='DPORT' maxlength='5' value= $qossettings {'DPORT'} />
1045 <td width='33%' align='center'>
1046 <tr><td width='33%' align='right'>Quell-IP-Adresse:
1047 <td width='33%' align='left'><input type='text' name='QIP' maxlength='15' value= $qossettings {'QIP'} />
1048 <td width='33%' align='center'>
1049 <tr><td width='33%' align='right'>Ziel-IP-Adresse:
1050 <td width='33%' align='left'><input type='text' name='DIP' maxlength='15' value= $qossettings {'DIP'} />
1051 <td width='33%' align='center'><input type='hidden' name='CLASS' value=' $qossettings {'CLASS'}' /><input type='submit' name='DOPORT' value= $Lang ::tr{'save'} />
1055 & Header
:: closebox
();
1059 & Header
:: openbox
( '100%' , 'center' , 'TOS-Regel' );
1060 if ( $qossettings { 'TOS' }) {
1061 $checked [ $qossettings { 'TOS' }] = "checked" ;
1064 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1068 if ( $message ne "" ) {
1069 print "<tr><td colspan='3' align='center'><font color='red'> $message </font>" ;
1072 <tr><td colspan='2' width='100%'>Aktuelle Klasse: $qossettings {'CLASS'}
1073 <tr><td width='100%' colspan='2'>Aktivieren oder deaktivieren sie die TOS-Bits <br /> und klicken Sie danach auf <i>Speichern</i>.
1074 <tr><td width='50%' align='left'>Minimale Verzoegerung (8) <td width='50%'><input type="radio" name="TOS" value="8" $checked [8] />
1075 <tr><td width='50%' align='left'>Maximaler Durchsatz (4) <td width='50%'><input type="radio" name="TOS" value="4" $checked [4] />
1076 <tr><td width='50%' align='left'>Maximale Zuverlaessigkeit (2) <td width='50%'><input type="radio" name="TOS" value="2" $checked [2] />
1077 <tr><td width='50%' align='left'>Minimale Kosten (1) <td width='50%'><input type="radio" name="TOS" value="1" $checked [1] />
1078 <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'} />
1082 & Header
:: closebox
();
1086 $qossettings { 'DEV' } = shift ;
1087 open ( FILE
, "< $classfile " ) or die "Unable to read $classfile " ;
1091 open ( FILE
, "< $subclassfile " ) or die "Unable to read $subclassfile " ;
1092 @subclasses = < FILE
>;
1094 open ( FILE
, "< $level7file " ) or die "Unable to read $level7file " ;
1097 open ( FILE
, "< $tosfile " ) or die "Unable to read $tosfile " ;
1100 open ( FILE
, "< $portfile " ) or die "Unable to read $portfile " ;
1101 @portrules = < FILE
>;
1103 foreach $classentry ( sort @classes )
1105 @classline = split ( /\;/ , $classentry );
1106 if ( $classline [ 0 ] eq $qossettings { 'DEV' } )
1108 gengraph
( $qossettings { 'DEV' }, $classline [ 1 ]);
1109 & Header
:: openbox
( '100%' , 'center' , "Klasse: $classline [1]" );
1111 <table border='0' width='100%' cellspacing='0'>
1112 <tr><td bgcolor=' $color {'color20'}' width='10%' align='center'><b> $Lang ::tr{'interface'}</b>
1113 <td bgcolor=' $color {'color20'}' width='10%' align='center'><b>Klasse</b>
1114 <td bgcolor=' $color {'color20'}' width='10%' align='center'>Prioritaet
1115 <td bgcolor=' $color {'color20'}' width='10%' align='center'>Garantierte Bandbreite
1116 <td bgcolor=' $color {'color20'}' width='10%' align='center'>Maximale Bandbreite
1117 <td bgcolor=' $color {'color20'}' width='10%' align='center'>Burst
1118 <td bgcolor=' $color {'color20'}' width='10%' align='center'>Ceil Burst
1119 <td bgcolor=' $color {'color20'}' width='10%' align='center'>TOS
1120 <td bgcolor=' $color {'color20'}' width='20%' align='center'>Aktionen
1121 <tr><td align='center' bgcolor=' $color {'color22'}'> $classline [0]</td>
1122 <td align='center' bgcolor=' $color {'color22'}'> $classline [1]</td>
1123 <td align='center' bgcolor=' $color {'color22'}'> $classline [2]</td>
1124 <td align='center' bgcolor=' $color {'color22'}'> $classline [3]</td>
1125 <td align='center' bgcolor=' $color {'color22'}'> $classline [4]</td>
1126 <td align='center' bgcolor=' $color {'color22'}'> $classline [5]</td>
1127 <td align='center' bgcolor=' $color {'color22'}'> $classline [6]</td>
1128 <td align='center' bgcolor=' $color {'color22'}'> $classline [7]</td>
1129 <td align='right' bgcolor=' $color {'color22'}'>
1130 <table border='0'><tr>
1131 <td><form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1132 <input type='hidden' name='CLASS' value=' $classline [1]' />
1133 <input type='hidden' name='ACTION' value='Unterklasse hinzufuegen' />
1134 <input type='image' alt='Unterklasse hinzufuegen' src='/images/addblue.gif' />
1136 <td><form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1137 <input type='hidden' name='CLASS' value=' $classline [1]' />
1138 <input type='hidden' name='ACTION' value='Regel hinzufuegen' />
1139 <input type='image' alt='Regel hinzufuegen' src='/images/addgreen.gif' />
1141 <td><form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1142 <input type='hidden' name='CLASS' value=' $classline [1]' />
1143 <input type='hidden' name='DOCLASS' value='Bearbeiten' />
1144 <input type='image' alt='Bearbeiten' src='/images/edit.gif' />
1146 <td><form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1147 <input type='hidden' name='CLASS' value=' $classline [1]' />
1148 <input type='hidden' name='DOCLASS' value='Loeschen' />
1149 <input type='image' alt='Loeschen' src='/images/delete.gif' />
1153 <tr><td align='right' colspan='2'><b> $Lang ::tr{'remark'}:</b>
1154 <td align='center' colspan='6'> $classline [8]
1155 <td align='right'><b>Queueing:</b> $classline [9]
1160 foreach $l7ruleentry ( sort @l7rules )
1162 @l7ruleline = split ( /\;/ , $l7ruleentry );
1163 if ( $l7ruleline [ 0 ] eq $classline [ 1 ] )
1166 <tr><td align='right' colspan='2'><b>Level7-Protokoll:</b>
1167 <td align='center' colspan='6'> $l7ruleline [2]
1169 <table border='0'><tr>
1170 <td><form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1171 <input type='hidden' name='CLASS' value=' $l7ruleline [0]' />
1172 <input type='hidden' name='L7PROT' value=' $l7ruleline [2]' />
1173 <input type='hidden' name='DOLEVEL7' value='Bearbeiten' />
1174 <input type='image' alt='Bearbeiten' src='/images/edit.gif' />
1176 <td><form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1177 <input type='hidden' name='CLASS' value=' $l7ruleline [0]' />
1178 <input type='hidden' name='L7PROT' value=' $l7ruleline [2]' />
1179 <input type='hidden' name='DOLEVEL7' value='Loeschen' />
1180 <input type='image' alt='Loeschen' src='/images/delete.gif' />
1185 if (( $l7ruleline [ 3 ] ne "" ) || ( $l7ruleline [ 4 ] ne "" )){
1187 <tr><td align='center'>
1188 <td align='right' colspan='3'><b>Quell-IP:</b> $l7ruleline [3]
1189 <td align='right' colspan='3'><b>Ziel-IP:</b> $l7ruleline [4]
1203 foreach $portruleentry ( sort @portrules )
1205 @portruleline = split ( /\;/ , $portruleentry );
1206 if ( $portruleline [ 0 ] eq $classline [ 1 ] )
1209 <tr><td align='right' colspan='2'><b>Port-Regel:</b>
1210 <td align='center'>( $portruleline [2])
1211 <td align='center' colspan='2'>
1214 if ( $portruleline [ 4 ]) {
1216 <i>Quell-Port:</i> $portruleline [4]
1220 print "<td align='center' colspan='2'>" ;
1221 if ( $portruleline [ 6 ]) {
1223 <i>Ziel-Port:</i> $portruleline [6]
1230 <table border='0'><tr>
1231 <td><form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1232 <input type='hidden' name='CLASS' value=' $portruleline [0]' />
1233 <input type='hidden' name='PPROT' value=' $portruleline [2]' />
1234 <input type='hidden' name='QIP' value=' $portruleline [3]' />
1235 <input type='hidden' name='QPORT' value=' $portruleline [4]' />
1236 <input type='hidden' name='DIP' value=' $portruleline [5]' />
1237 <input type='hidden' name='DPORT' value=' $portruleline [6]' />
1238 <input type='hidden' name='DOPORT' value='Bearbeiten' />
1239 <input type='image' alt='Bearbeiten' src='/images/edit.gif' />
1241 <td><form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1242 <input type='hidden' name='CLASS' value=' $portruleline [0]' />
1243 <input type='hidden' name='PPROT' value=' $portruleline [2]' />
1244 <input type='hidden' name='QIP' value=' $portruleline [3]' />
1245 <input type='hidden' name='QPORT' value=' $portruleline [4]' />
1246 <input type='hidden' name='DIP' value=' $portruleline [5]' />
1247 <input type='hidden' name='DPORT' value=' $portruleline [6]' />
1248 <input type='hidden' name='DOPORT' value='Loeschen' />
1249 <input type='image' alt='Loeschen' src='/images/delete.gif' />
1254 if (( $portruleline [ 3 ] ne "" ) || ( $portruleline [ 5 ] ne "" )){
1256 <tr><td align='center'>
1257 <td align='right' colspan='3'><b>Quell-IP:</b> $portruleline [3]
1258 <td align='right' colspan='3'><b>Ziel-IP:</b> $portruleline [5]
1267 foreach $tosruleentry ( sort @tosrules )
1269 @tosruleline = split ( /\;/ , $tosruleentry );
1270 if ( $tosruleline [ 0 ] eq $classline [ 1 ] )
1273 <tr><td align='right' colspan='2'>
1274 <b>TOS Bit matches:</b>
1275 <td colspan='6' align='center'>
1278 if ( $tosruleline [ 2 ] eq "8" ) {
1279 print "Minimale Verzoegerung \n " ;
1280 } elsif ( $tosruleline [ 2 ] eq "4" ) {
1281 print "Maximaler Durchsatz \n " ;
1282 } elsif ( $tosruleline [ 2 ] eq "2" ) {
1283 print "Maximaler Durchsatz \n " ;
1284 } elsif ( $tosruleline [ 2 ] eq "1" ) {
1285 print "Minimale Kosten \n " ;
1286 } else { print " \n " ; }
1291 <table border='0'><tr>
1292 <td><form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1293 <input type='hidden' name='CLASS' value=' $tosruleline [0]' />
1294 <input type='hidden' name='DEV' value=' $tosruleline [1]' />
1295 <input type='hidden' name='TOS' value=' $tosruleline [2]' />
1296 <input type='hidden' name='DOTOS' value='Bearbeiten' />
1297 <input type='image' alt='Bearbeiten' src='/images/edit.gif' />
1299 <td><form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1300 <input type='hidden' name='CLASS' value=' $tosruleline [0]' />
1301 <input type='hidden' name='DEV' value=' $tosruleline [1]' />
1302 <input type='hidden' name='TOS' value=' $tosruleline [2]' />
1303 <input type='hidden' name='DOTOS' value='Loeschen' />
1304 <input type='image' alt='Loeschen' src='/images/delete.gif' />
1313 if ( - e
"/srv/web/ipfire/html/graphs/class_ $qossettings {'CLASSPRFX'}- $qossettings {'CLASS'}_ $qossettings {'DEV'}-packets.png" ) {
1315 <tr><td colspan='9' align='center'><img alt="" src='/graphs/class_ $qossettings {'CLASSPRFX'}- $qossettings {'CLASS'}_ $qossettings {'DEV'}-packets.png' />
1321 foreach $subclassentry ( sort @subclasses )
1323 @subclassline = split ( /\;/ , $subclassentry );
1324 if ( $subclassline [ 1 ] eq $classline [ 1 ] ) {
1326 <tr><td align='center' bgcolor='#FAFAFA'>Subklasse:
1327 <td align='center' bgcolor='#FAFAFA'> $subclassline [2]
1328 <td align='center' bgcolor='#FAFAFA'> $subclassline [3]
1329 <td align='center' bgcolor='#FAFAFA'> $subclassline [4]
1330 <td align='center' bgcolor='#FAFAFA'> $subclassline [5]
1331 <td align='center' bgcolor='#FAFAFA'> $subclassline [6]
1332 <td align='center' bgcolor='#FAFAFA'> $subclassline [7]
1333 <td align='center' bgcolor='#FAFAFA'> $subclassline [8]
1334 <td align='right' bgcolor='#FAFAFA'>
1335 <table border='0'><tr>
1336 <td><form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1337 <input type='hidden' name='CLASS' value=' $subclassline [2]' />
1338 <input type='hidden' name='ACTION' value='Regel hinzufuegen' />
1339 <input type='image' alt='Regel hinzufuegen' src='/images/addgreen.gif' />
1341 <td><form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1342 <input type='hidden' name='CLASS' value=' $subclassline [2]' />
1343 <input type='hidden' name='DOSCLASS' value='Bearbeiten' />
1344 <input type='image' alt='Bearbeiten' src='/images/edit.gif' />
1346 <td><form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1347 <input type='hidden' name='CLASS' value=' $subclassline [2]' />
1348 <input type='hidden' name='DOSCLASS' value='Loeschen' />
1349 <input type='image' alt='Loeschen' src='/images/delete.gif' />
1360 & Header
:: closebox
();
1368 & Header
:: openbox
( '100%' , 'center' , 'Expertenoptionen:' );
1370 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1372 <tr><td width='33%' align='right'>MTU:<td width='33%' align='left'>
1373 <input type='text' name='MTU' maxlength='8' required='4' value= $qossettings {'MTU'} />
1374 <td width='33%' align='center'>Diese Einstellung aendert die MTU nicht global sondern nur fuer das QoS.
1375 <tr><td width='33%' align='right'>Queue Laenge:<td width='33%' align='left'>
1376 <input type='text' name='QLENGTH' maxlength='8' required='2' value= $qossettings {'QLENGTH'} />
1377 <td width='33%' align='center'>
1378 <tr><td width='33%' align='right'>SFQ Perturb:<td width='33%' align='left'>
1379 <input type='text' name='SFQ_PERTUB' maxlength='8' required='1' value= $qossettings {'SFQ_PERTUB'} />
1380 <td width='33%' align='center'><input type='submit' name='ACTION' value= $Lang ::tr{'save'} />
1385 & Header
:: closebox
();
1389 if ( $qossettings { 'VALID' } eq 'yes' ) {
1390 if ( $qossettings { 'DEVICE' } eq $qossettings { 'RED_DEV' } ) {
1391 $qossettings { 'SPD' } = $qossettings { 'OUT_SPD' };
1392 } elsif ( $qossettings { 'DEVICE' } eq $qossettings { 'IMQ_DEV' } ) {
1393 $qossettings { 'SPD' } = $qossettings { 'INC_SPD' };
1395 unless ( ( $qossettings { 'MINBWDTH' } >= 1 ) && ( $qossettings { 'MINBWDTH' } <= $qossettings { 'SPD' } ) ) {
1396 $qossettings { 'VALID' } = 'no' ;
1397 $message = "Mindestbandbreite ist ungueltig." ;
1399 $qossettings { 'SPD' } = '' ;
1404 if ( $qossettings { 'VALID' } eq 'yes' ) {
1405 if ( $qossettings { 'DEVICE' } eq $qossettings { 'RED_DEV' } ) {
1406 $qossettings { 'SPD' } = $qossettings { 'OUT_SPD' };
1407 } elsif ( $qossettings { 'DEVICE' } eq $qossettings { 'IMQ_DEV' } ) {
1408 $qossettings { 'SPD' } = $qossettings { 'INC_SPD' };
1410 unless ( ( $qossettings { 'MAXBDWTH' } >= 0 ) && ( $qossettings { 'MAXBDWTH' } >= $qossettings { 'MINBDWTH' }) &&( $qossettings { 'MAXBDWTH' } <= $qossettings { 'SPD' } ) ) {
1411 $qossettings { 'VALID' } = 'no' ;
1412 $message = "Mamimalbandbreite ist ungueltig." ;
1414 $qossettings { 'SPD' } = '' ;
1419 if ( $qossettings { 'VALID' } eq 'yes' ) {
1420 if ( $qossettings { 'DEVICE' } eq $qossettings { 'RED_DEV' } ) {
1421 if ( $qossettings { 'CLASS' } lt 100 || $qossettings { 'CLASS' } ge 121 ) {
1422 $qossettings { 'VALID' } = 'no' ;
1423 $message = "Die Klassennummer passt nicht zum angegebenen Interface." ;
1425 } elsif ( $qossettings { 'DEVICE' } eq $qossettings { 'IMQ_DEV' } ) {
1426 if ( $qossettings { 'CLASS' } lt 200 || $qossettings { 'CLASS' } ge 221 ) {
1427 $qossettings { 'VALID' } = 'no' ;
1428 $message = "Die Klassennummer passt nicht zum angegebenen Interface." ;
1431 open ( FILE
, "< $classfile " ) or die "Unable to read $classfile " ;
1434 foreach $classentry ( sort @tmp )
1436 @tmpline = split ( /\;/ , $classentry );
1437 if ( $tmpline [ 1 ] eq $qossettings { 'CLASS' } )
1439 $qossettings { 'VALID' } = 'no' ;
1440 $message = "Die aktuelle Klasse wird bereits verwendet." ;
1448 if ( $qossettings { 'VALID' } eq 'yes' ) {
1449 open ( FILE
, "< $subclassfile " ) or die "Unable to read $subclassfile " ;
1452 foreach $subclassentry ( sort @tmp )
1454 @tmpline = split ( /\;/ , $subclassentry );
1455 if ( $tmpline [ 2 ] eq $qossettings { 'SCLASS' } )
1457 $qossettings { 'VALID' } = 'no' ;
1458 $message = "Die aktuelle Klasse wird bereits verwendet." ;
1466 $qossettings { 'DEV' } = shift ;
1467 $qossettings { 'CLASS' } = shift ;
1469 if ( $qossettings { 'DEV' } eq $qossettings { 'RED_DEV' } ) {
1470 $qossettings { 'CLASSPRFX' } = '1' ;
1472 $qossettings { 'CLASSPRFX' } = '2' ;
1474 my $color = random_hex_color
( 6 );
1476 RRDs
:: graph
( "/srv/web/ipfire/html/graphs/class_ $qossettings {'CLASSPRFX'}- $qossettings {'CLASS'}_ $qossettings {'DEV'}-packets.png" ,
1477 "--start" , "-3240" , "-aPNG" , "-i" , "-z" ,
1478 "--alt-y-grid" , "-w 600" , "-h 150" , "-r" ,
1479 "--color" , "SHADEA#EAE9EE" ,
1480 "--color" , "SHADEB#EAE9EE" ,
1481 "--color" , "BACK#FFFFFF" ,
1482 "-t $qossettings {'CLASS'} ( $qossettings {'DEV'})" ,
1483 "DEF:pkts=/var/log/rrd/class_ $qossettings {'CLASSPRFX'}- $qossettings {'CLASS'}_ $qossettings {'DEV'}.rrd:pkts:AVERAGE" ,
1484 "DEF:dropped=/var/log/rrd/class_ $qossettings {'CLASSPRFX'}- $qossettings {'CLASS'}_ $qossettings {'DEV'}.rrd:dropped:AVERAGE" ,
1485 "DEF:overlimits=/var/log/rrd/class_ $qossettings {'CLASSPRFX'}- $qossettings {'CLASS'}_ $qossettings {'DEV'}.rrd:overlimits:AVERAGE" ,
1486 "AREA:pkts $color :packets" ,
1487 "GPRINT:pkts:LAST:total packets \\ : %8 .3lf %s packets \\ j" ,
1488 "LINE3:dropped#FF0000:dropped" ,
1489 "GPRINT:dropped:LAST:dropped packets \\ : %8 .3lf %s packets \\ j" ,
1490 "LINE3:overlimits#0000FF:overlimits" ,
1491 "GPRINT:overlimits:LAST:overlimits \\ : %8 .3lf %s packets \\ j" ,
1493 $ERROR = RRDs
:: error
;
1498 $qossettings { 'DEV' } = shift ;
1499 if ( $qossettings { 'DEV' } eq $qossettings { 'RED_DEV' } ) {
1500 $qossettings { 'CLASSPRFX' } = '1' ;
1502 $qossettings { 'CLASSPRFX' } = '2' ;
1506 my $color = "#000000" ;
1507 my @command =( "/srv/web/ipfire/html/graphs/qos-graph- $qossettings {'DEV'}.png" ,
1508 "--start" , "-3240" , "-aPNG" , "-i" , "-z" ,
1509 "--alt-y-grid" , "-w 600" , "-h 150" , "-r" ,
1510 "--color" , "SHADEA#EAE9EE" ,
1511 "--color" , "SHADEB#EAE9EE" ,
1512 "--color" , "BACK#FFFFFF" ,
1513 "-t Auslastung auf ( $qossettings {'DEV'})"
1515 open ( FILE
, "< $classfile " ) or die "Unable to read $classfile " ;
1518 foreach $classentry ( sort @classes )
1520 @classline = split ( /\;/ , $classentry );
1521 if ( $classline [ 0 ] eq $qossettings { 'DEV' } )
1523 $color = random_hex_color
( 6 );
1524 push ( @command , "DEF: $classline [1]=/var/log/rrd/class_ $qossettings {'CLASSPRFX'}- $classline [1]_ $qossettings {'DEV'}.rrd:bits:AVERAGE" );
1526 if ( $count eq "1" ) {
1527 push ( @command , "AREA: $classline [1] $color :Klasse $classline [1] - $classline [8] \\ j" );
1529 push ( @command , "STACK: $classline [1] $color :Klasse $classline [1] - $classline [8] \\ j" );
1534 RRDs
:: graph
( @command );
1535 $ERROR = RRDs
:: error
;
1539 sub random_hex_color
{
1541 $size = 6 if $size !~ /^3|6$/ ;
1542 my @hex = ( 0 .. 9 , 'a' .. 'f' );
1544 push @color , @hex [ rand ( @hex )] for 1 .. $size ;
1545 return join ( '' , '#' , @color );