]>
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 );
105 & Header
:: openpage
( 'QoS' , 1 , '' );
106 & Header
:: openbigbox
( '100%' , 'left' , '' , $errormessage );
108 ############################################################################################################################
109 ############################################################################################################################
111 if ( $qossettings { 'DOCLASS' } eq $Lang :: tr
{ 'save' })
116 if ( $qossettings { 'VALID' } eq 'yes' ) {
117 open ( FILE
, ">> $classfile " ) or die "Unable to write $classfile " ;
119 $qossettings {'DEVICE'}; $qossettings {'CLASS'}; $qossettings {'PRIO'}; $qossettings {'MINBWDTH'}; $qossettings {'MAXBWDTH'}; $qossettings {'BURST'}; $qossettings {'CBURST'}; $qossettings {'TOS'}; $qossettings {'REMARK'};
124 $qossettings { 'ACTION' } = 'Parentklasse hinzufuegen' ;
127 elsif ( $qossettings { 'DOCLASS' } eq 'Bearbeiten' )
129 open ( FILE
, "< $classfile " ) or die "Unable to read $classfile " ;
132 open ( FILE
, "> $classfile " ) or die "Unable to write $classfile " ;
133 foreach $classentry ( sort @classes )
135 @classline = split ( /\;/ , $classentry );
136 if ( $classline [ 1 ] ne $qossettings { 'CLASS' } ) {
137 print FILE
$classentry ;
139 $qossettings { 'DEVICE' } = $classline [ 0 ];
140 $qossettings { 'PRIO' } = $classline [ 2 ];
141 $qossettings { 'MINBWDTH' } = $classline [ 3 ];
142 $qossettings { 'MAXBWDTH' } = $classline [ 4 ];
143 $qossettings { 'BURST' } = $classline [ 5 ];
144 $qossettings { 'CBURST' } = $classline [ 6 ];
145 $qossettings { 'TOS' } = $classline [ 7 ];
146 $qossettings { 'REMARK' } = $classline [ 8 ];
147 $qossettings { 'EDIT' } = 'yes' ;
152 & Header
:: closebigbox
();
153 & Header
:: closepage
();
156 elsif ( $qossettings { 'DOCLASS' } eq 'Loeschen' )
158 open ( FILE
, "< $classfile " ) or die "Unable to read $classfile " ;
161 open ( FILE
, "> $classfile " ) or die "Unable to write $classfile " ;
162 foreach $classentry ( sort @tmp )
164 @tmpline = split ( /\;/ , $classentry );
165 if ( $tmpline [ 1 ] ne $qossettings { 'CLASS' } )
167 print FILE
$classentry ;
171 open ( FILE
, "< $subclassfile " ) or die "Unable to read $classfile " ;
174 open ( FILE
, "> $subclassfile " ) or die "Unable to write $classfile " ;
175 foreach $subclassentry ( sort @tmp )
177 @tmpline = split ( /\;/ , $subclassentry );
178 if ( $tmpline [ 1 ] ne $qossettings { 'CLASS' } )
180 print FILE
$subclassentry ;
184 $message = "Klasse $qossettings {'CLASS'} wurde mit eventuell vorhandenen Unterklassen geloescht." ;
187 ############################################################################################################################
188 ############################################################################################################################
190 if ( $qossettings { 'DOSCLASS' } eq $Lang :: tr
{ 'save' })
194 if ( $qossettings { 'VALID' } eq 'yes' ) {
195 open ( FILE
, ">> $subclassfile " ) or die "Unable to write $subclassfile " ;
197 $qossettings {'DEVICE'}; $qossettings {'CLASS'}; $qossettings {'SCLASS'}; $qossettings {'PRIO'}; $qossettings {'MINBWDTH'}; $qossettings {'MAXBWDTH'}; $qossettings {'BURST'}; $qossettings {'CBURST'}; $qossettings {'TOS'};
202 $qossettings { 'ACTION' } = 'Unterklasse hinzufuegen' ;
204 } elsif ( $qossettings { 'DOSCLASS' } eq 'Loeschen' )
206 open ( FILE
, "< $subclassfile " ) or die "Unable to read $classfile " ;
209 open ( FILE
, "> $subclassfile " ) or die "Unable to write $classfile " ;
210 foreach $subclassentry ( sort @tmp )
212 @tmpline = split ( /\;/ , $subclassentry );
213 if ( $tmpline [ 2 ] ne $qossettings { 'CLASS' } )
215 print FILE
$subclassentry ;
219 $message = "Unterklasse $qossettings {'CLASS'} wurde geloescht." ;
222 ############################################################################################################################
223 ############################################################################################################################
225 if ( $qossettings { 'DOLEVEL7' } eq $Lang :: tr
{ 'save' })
227 if ( $qossettings { 'QIP' } ne '' ) {
228 unless ( & General
:: validip
( $qossettings { 'QIP' }) ) {
229 $qossettings { 'VALID' } = 'no' ;
230 $message = "Die Quell-IP-Adresse ist ungueltig." ;
233 if ( $qossettings { 'DIP' } ne '' ) {
234 unless ( & General
:: validip
( $qossettings { 'DIP' }) ) {
235 $qossettings { 'VALID' } = 'no' ;
236 $message = "Die Ziel-IP-Adresse ist ungueltig." ;
239 if ( $qossettings { 'CLASS' } >= 100 && $qossettings { 'CLASS' } < 121 ) {
240 $qossettings { 'DEVICE' } = $qossettings { 'RED_DEV' };
241 } elsif ( $qossettings { 'CLASS' } >= 1000 && $qossettings { 'CLASS' } < 1021 ) {
242 $qossettings { 'DEVICE' } = $qossettings { 'RED_DEV' };
243 } elsif ( $qossettings { 'CLASS' } >= 200 && $qossettings { 'CLASS' } < 221 ) {
244 $qossettings { 'DEVICE' } = $qossettings { 'IMQ_DEV' };
245 } elsif ( $qossettings { 'CLASS' } >= 2000 && $qossettings { 'CLASS' } < 2021 ) {
246 $qossettings { 'DEVICE' } = $qossettings { 'IMQ_DEV' };
248 if ( $qossettings { 'VALID' } eq 'yes' ) {
249 open ( FILE
, ">> $level7file " ) or die "Unable to write $level7file " ;
251 $qossettings {'CLASS'}; $qossettings {'DEVICE'}; $qossettings {'L7PROT'}; $qossettings {'QIP'}; $qossettings {'DIP'};
256 $qossettings { 'ACTION' } = 'Level7-Regel hinzufuegen' ;
259 elsif ( $qossettings { 'DOLEVEL7' } eq 'Loeschen' )
261 open ( FILE
, "< $level7file " ) or die "Unable to read $level7file " ;
264 open ( FILE
, "> $level7file " ) or die "Unable to read $level7file " ;
265 foreach $l7ruleentry ( sort @l7rules )
267 @l7ruleline = split ( /\;/ , $l7ruleentry );
268 if ( ( $l7ruleline [ 0 ] ne $qossettings { 'CLASS' }) && ( $l7ruleline [ 2 ] ne $qossettings { 'L7PROT' }))
270 print FILE
$l7ruleentry ;
274 $message = "Level7-Regel ( $qossettings {'CLASS'} - $qossettings {'L7PROT'}) wurde geloescht." ;
277 ############################################################################################################################
278 ############################################################################################################################
280 if ( $qossettings { 'DOPORT' } eq $Lang :: tr
{ 'save' })
282 if ( $qossettings { 'QIP' } ne '' ) {
283 unless ( & General
:: validip
( $qossettings { 'QIP' }) ) {
284 $qossettings { 'VALID' } = 'no' ;
285 $message = "Die Quell-IP-Adresse ist ungueltig." ;
288 if ( $qossettings { 'DIP' } ne '' ) {
289 unless ( & General
:: validip
( $qossettings { 'DIP' }) ) {
290 $qossettings { 'VALID' } = 'no' ;
291 $message = "Die Ziel-IP-Adresse ist ungueltig." ;
294 if ( $qossettings { 'CLASS' } >= 100 && $qossettings { 'CLASS' } < 121 ) {
295 $qossettings { 'DEVICE' } = $qossettings { 'RED_DEV' };
296 } elsif ( $qossettings { 'CLASS' } >= 1000 && $qossettings { 'CLASS' } < 1021 ) {
297 $qossettings { 'DEVICE' } = $qossettings { 'RED_DEV' };
298 } elsif ( $qossettings { 'CLASS' } >= 200 && $qossettings { 'CLASS' } < 221 ) {
299 $qossettings { 'DEVICE' } = $qossettings { 'IMQ_DEV' };
300 } elsif ( $qossettings { 'CLASS' } >= 2000 && $qossettings { 'CLASS' } < 2021 ) {
301 $qossettings { 'DEVICE' } = $qossettings { 'IMQ_DEV' };
303 if ( $qossettings { 'VALID' } eq 'yes' ) {
304 open ( FILE
, ">> $portfile " ) or die "Unable to write $portfile " ;
306 $qossettings {'CLASS'}; $qossettings {'DEVICE'}; $qossettings {'PPROT'}; $qossettings {'QIP'}; $qossettings {'QPORT'}; $qossettings {'DIP'}; $qossettings {'DPORT'};
311 $qossettings { 'ACTION' } = 'Port-Regel hinzufuegen' ;
313 } elsif ( $qossettings { 'DOPORT' } eq 'Loeschen' )
315 open ( FILE
, "< $portfile " ) or die "Unable to read $portfile " ;
318 open ( FILE
, "> $portfile " ) or die "Unable to read $portfile " ;
319 foreach $portruleentry ( sort @portrules )
321 @portruleline = split ( /\;/ , $portruleentry );
322 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' }))
324 print FILE
$portruleentry ;
328 $message = "Port-Regel ( $qossettings {'CLASS'} - $qossettings {'PPROT'}) wurde geloescht." ;
331 ############################################################################################################################
332 ############################################################################################################################
334 if ( $qossettings { 'DOTOS' } eq $Lang :: tr
{ 'save' })
336 if ( $qossettings { 'CLASS' } >= 100 && $qossettings { 'CLASS' } < 121 ) {
337 $qossettings { 'DEVICE' } = $qossettings { 'RED_DEV' };
338 } elsif ( $qossettings { 'CLASS' } >= 1000 && $qossettings { 'CLASS' } < 1021 ) {
339 $qossettings { 'DEVICE' } = $qossettings { 'RED_DEV' };
340 } elsif ( $qossettings { 'CLASS' } >= 200 && $qossettings { 'CLASS' } < 221 ) {
341 $qossettings { 'DEVICE' } = $qossettings { 'IMQ_DEV' };
342 } elsif ( $qossettings { 'CLASS' } >= 2000 && $qossettings { 'CLASS' } < 2021 ) {
343 $qossettings { 'DEVICE' } = $qossettings { 'IMQ_DEV' };
345 open ( FILE
, ">> $tosfile " ) or die "Unable to write $tosfile " ;
347 $qossettings {'CLASS'}; $qossettings {'DEVICE'}; $qossettings {'TOS'};
352 elsif ( $qossettings { 'DOTOS' } eq 'Loeschen' )
354 open ( FILE
, "< $tosfile " ) or die "Unable to read $tosfile " ;
357 open ( FILE
, "> $tosfile " ) or die "Unable to read $tosfile " ;
358 foreach $tosruleentry ( sort @tosrules )
360 @tosruleline = split ( /\;/ , $tosruleentry );
361 unless ( ( $tosruleline [ 0 ] eq $qossettings { 'CLASS' }) && ( $tosruleline [ 2 ] eq $qossettings { 'TOS' }))
363 print FILE
$tosruleentry ;
367 $message = "TOS-Regel ( $qossettings {'CLASS'} - $qossettings {'TOS'}) wurde geloescht." ;
368 } elsif ( $qossettings { 'DOTOS' } eq 'Bearbeiten' )
370 open ( FILE
, "< $tosfile " ) or die "Unable to read $tosfile " ;
373 open ( FILE
, "> $tosfile " ) or die "Unable to write $tosfile " ;
374 foreach $tosruleentry ( sort @tosrules )
376 @tosruleline = split ( /\;/ , $tosruleentry );
377 if (( $tosruleline [ 0 ] eq $qossettings { 'CLASS' } ) && ( $tosruleline [ 2 ] eq $qossettings { 'TOS' } )) {
378 $qossettings { 'DEVICE' } = $tosruleline [ 1 ];
379 $qossettings { 'CLASS' } = $tosruleline [ 0 ];
380 $qossettings { 'TOS' } = $tosruleline [ 2 ];
381 $qossettings { 'EDIT' } = 'yes' ;
383 print FILE
$tosruleentry ;
388 & Header
:: closebigbox
();
389 & Header
:: closepage
();
393 ############################################################################################################################
394 ############################################################################################################################
396 if ( $qossettings { 'ACTION' } eq 'Start' )
398 system ( "/usr/local/bin/qosctrl generate >/dev/null 2>&1" );
399 system ( "/bin/touch /var/ipfire/qos/enable" );
400 system ( "/usr/local/bin/qosctrl start >/dev/null 2>&1" );
401 system ( "logger -t ipfire 'QoS started'" );
402 $qossettings { 'ENABLED' } = 'on' ;
403 & General
:: writehash
( "${General::swroot}/qos/settings" , \
%qossettings );
405 elsif ( $qossettings { 'ACTION' } eq 'Stop' )
407 system ( "/usr/local/bin/qosctrl stop >/dev/null 2>&1" );
408 unlink "/var/ipfire/qos/bin/qos.sh" ;
409 unlink "/var/ipfire/qos/enable" ;
410 system ( "logger -t ipfire 'QoS stopped'" );
411 $qossettings { 'ENABLED' } = 'off' ;
412 & General
:: writehash
( "${General::swroot}/qos/settings" , \
%qossettings );
414 elsif ( $qossettings { 'ACTION' } eq 'Neustart' )
416 if ( $qossettings { 'ENABLED' } eq 'on' ){
417 system ( "/usr/local/bin/qosctrl stop >/dev/null 2>&1" );
418 system ( "/usr/local/bin/qosctrl generate >/dev/null 2>&1" );
419 system ( "/usr/local/bin/qosctrl start >/dev/null 2>&1" );
420 system ( "logger -t ipfire 'QoS restarted'" );
423 elsif ( $qossettings { 'ACTION' } eq $Lang :: tr
{ 'save' })
425 if ( $qossettings { 'DEF_INC_SPD' } eq '' ) {
426 $qossettings { 'DEF_INC_SPD' } = int ( $qossettings { 'INC_SPD' } * 0.9 );
428 if ( $qossettings { 'DEF_OUT_SPD' } eq '' ) {
429 $qossettings { 'DEF_OUT_SPD' } = int ( $qossettings { 'OUT_SPD' } * 0.9 );
431 & General
:: writehash
( "${General::swroot}/qos/settings" , \
%qossettings );
433 elsif ( $qossettings { 'ACTION' } eq 'Statusinformationen' )
435 & Header
:: openbox
( '100%' , 'left' , 'QoS Status' );
436 if ( $qossettings { 'ENABLED' } eq 'on' ){
438 $output = `/usr/local/bin/qosctrl status` ;
439 $output = & Header
:: cleanhtml
( $output , "y" );
440 print "<pre> $output </pre> \n " ;
441 } else { print "QoS ist nicht aktiviert!" ; }
443 & Header
:: closebigbox
();
444 & Header
:: closepage
();
447 elsif ( $qossettings { 'ACTION' } eq 'Grafische Auswertung' )
449 open ( FILE
, "< $classfile " ) or die "Unable to read $classfile " ;
452 open ( FILE
, "< $subclassfile " ) or die "Unable to read $subclassfile " ;
453 @subclasses = < FILE
>;
455 & Header
:: openbox
( '100%' , 'left' , 'QoS Graphen' );
457 <table width='100%'> <tr><td align='center'><font color='red'>Diese Seite braucht je nach Geschwindigkeit des Computers laenger zum Laden.</font>
458 <tr><td align='center'><b>Klasse:</b>
461 foreach $classentry ( sort @classes )
463 @classline = split ( /\;/ , $classentry );
464 $qossettings { 'CLASS' }= $classline [ 1 ];
466 <input type="button" onClick="swapVisibility(' $qossettings {'CLASS'}')" value=' $qossettings {'CLASS'}'>
475 foreach $classentry ( sort @classes )
477 @classline = split ( /\;/ , $classentry );
478 $qossettings { 'DEV' }= $classline [ 0 ];
479 $qossettings { 'CLASS' }= $classline [ 1 ];
480 & gengraph
( $qossettings { 'DEV' }, $qossettings { 'CLASS' });
481 print "<div id=' $qossettings {'CLASS'}' style='display: none'>" ;
482 & Header
:: openbox
( '100%' , 'center' , " $qossettings {'CLASS'} ( $qossettings {'DEV'})" );
485 <tr><td colspan='2' align='center'><img src='/graphs/class_ $qossettings {'CLASSPRFX'}- $qossettings {'CLASS'}_ $qossettings {'DEV'}-packets.png'>
486 <tr><td colspan='2' align='center'><img src='/graphs/class_ $qossettings {'CLASSPRFX'}- $qossettings {'CLASS'}_ $qossettings {'DEV'}-borrowed.png'>
487 <tr><td colspan='2' align='center'><img src='/graphs/class_ $qossettings {'CLASSPRFX'}- $qossettings {'CLASS'}_ $qossettings {'DEV'}-bytes.png'>
490 foreach $subclassentry ( sort @subclasses )
492 @subclassline = split ( /\;/ , $subclassentry );
493 if ( $subclassline [ 1 ] eq $classline [ 1 ]) {
494 $qossettings { 'DEV' }= $subclassline [ 0 ];
495 $qossettings { 'SCLASS' }= $subclassline [ 2 ];
496 & gengraph
( $qossettings { 'DEV' }, $qossettings { 'SCLASS' });
498 <tr><td colspan='2' align='center'><img src='/graphs/class_ $qossettings {'CLASSPRFX'}- $qossettings {'SCLASS'}_ $qossettings {'DEV'}-packets.png'>
499 <tr><td colspan='2' align='center'><img src='/graphs/class_ $qossettings {'CLASSPRFX'}- $qossettings {'SCLASS'}_ $qossettings {'DEV'}-borrowed.png'>
500 <tr><td colspan='2' align='center'><img src='/graphs/class_ $qossettings {'CLASSPRFX'}- $qossettings {'SCLASS'}_ $qossettings {'DEV'}-bytes.png'>
505 print " \t\t </table>" ;
514 & Header
:: closebigbox
();
515 & Header
:: closepage
();
518 elsif ( $qossettings { 'ACTION' } eq 'Parentklasse hinzufuegen' )
521 & Header
:: closebigbox
();
522 & Header
:: closepage
();
525 elsif ( $qossettings { 'ACTION' } eq 'Unterklasse hinzufuegen' )
528 & Header
:: closebigbox
();
529 & Header
:: closepage
();
532 elsif ( $qossettings { 'ACTION' } eq 'Regel hinzufuegen' )
534 & Header
:: openbox
( '100%' , 'center' , 'Regel hinzufuegen' );
537 <tr><td align='center'>Waehlen sie <u>eine</u> der untenstehenden Regeln aus.
538 <tr><td align='center'>
539 <input type="button" onClick="swapVisibility('l7rule')" value='Level7-Regel' />
540 <input type="button" onClick="swapVisibility('portrule')" value='Port-Regel' />
541 <input type="button" onClick="swapVisibility('tosrule')" value='TOS-Regel' />
547 <div id='l7rule' style='display: none'>
553 <div id='portrule' style='display: none'>
559 <div id='tosrule' style='display: none'>
567 & Header
:: closebigbox
();
568 & Header
:: closepage
();
571 elsif ( $qossettings { 'ACTION' } eq 'Erweiterte Einstellungen' )
574 & Header
:: closebigbox
();
575 & Header
:: closepage
();
578 if ( $qossettings { 'ACTIONBW' } eq 'Andern' )
581 & Header
:: closebigbox
();
582 & Header
:: closepage
();
585 if ( $qossettings { 'ACTIONDEF' } eq 'Andern' )
588 & Header
:: closebigbox
();
589 & Header
:: closepage
();
593 & General
:: readhash
( "${General::swroot}/qos/settings" , \
%qossettings );
595 my $status = $Lang :: tr
{ 'stopped' };
596 my $statuscolor = '#993333' ;
597 if ( $qossettings { 'ENABLED' } eq 'on' ) {
598 $status = $Lang :: tr
{ 'running' };
599 $statuscolor = '#339933' ;
602 if ( $netsettings { 'RED_TYPE' } ne 'PPPOE' ) {
603 $qossettings { 'RED_DEV' } = $netsettings { 'RED_DEV' };
607 & Header
:: openbox
( '100%' , 'left' , $Lang :: tr
{ 'error messages' });
608 print "<class name='base'> $errormessage \n " ;
609 print " </class> \n " ;
613 ############################################################################################################################
614 ############################################################################################################################
616 & Header
:: openbox
( '100%' , 'center' , 'Quality of Service' );
619 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
623 if ( $message ne "" ) {
624 print "<tr><td colspan='2' align='center'><font color='red'> $message </font>" ;
627 <tr><td width='50%' align='left'><b>Quality of Service:</b>
628 <td width='50%' align='center' bgcolor=' $statuscolor '><font color='white'> $status </font>
629 <tr><td width='100%' align='center' colspan='2'>
630 <input type='submit' name='ACTION' value="Start" />
631 <input type='submit' name='ACTION' value="Stop" />
632 <input type='submit' name='ACTION' value=" $Lang ::tr{'restart'}" />
635 if (( $qossettings { 'OUT_SPD' } ne '' ) && ( $qossettings { 'INC_SPD' } ne '' )) {
637 <tr><td colspan='3'>
638 <tr><td width='40%' align='right'>Downloadgeschwindigkeit: <td width='40%' align='left'> $qossettings {'INC_SPD'} kbps
639 <td width='20%' rowspan='2' align='center' valign='middle'><input type='submit' name='ACTIONBW' value='Andern'>
640 <tr><td width='40%' align='right'>Uploadgeschwindigkeit: <td width='40%' align='left'> $qossettings {'OUT_SPD'} kbps
644 if (( $qossettings { 'DEFCLASS_OUT' } ne '' ) && ( $qossettings { 'DEFCLASS_INC' } ne '' )&& ( $qossettings { 'ACK' } ne '' )) {
646 <tr><td colspan='3'><hr />
647 <tr><td width='40%' align='right'>Downloadstandardklasse: <td width='40%' align='left'> $qossettings {'DEFCLASS_INC'}
648 <td width='20%' rowspan='3' align='center' valign='middle'><input type='submit' name='ACTIONDEF' value='Andern'>
649 <tr><td width='40%' align='right'>Uploadstandardklasse: <td width='40%' align='left'> $qossettings {'DEFCLASS_OUT'}
650 <tr><td width='40%' align='right'>ACKs: <td width='40%' align='left'> $qossettings {'ACK'}
651 <tr><td colspan='3' width='100%'><hr />
652 <tr><td colspan='3' width='100%' align='center'>
653 <table boder='0' cellpadding='0' cellspacing='0'>
654 <tr><td><input type='submit' name='ACTION' value='Parentklasse hinzufuegen'>
655 <td><input type='submit' name='ACTION' value='Erweiterte Einstellungen'>
656 <tr><td><input type='submit' name='ACTION' value='Statusinformationen'>
657 <td><input type='submit' name='ACTION' value='Grafische Auswertung'>
666 if ( ( $qossettings { 'OUT_SPD' } eq '' ) || ( $qossettings { 'INC_SPD' } eq '' ) ) {
669 & Header
:: closebigbox
();
670 & Header
:: closepage
();
674 if ( ( $qossettings { 'DEFCLASS_INC' } eq '' ) || ( $qossettings { 'DEFCLASS_OUT' } eq '' ) || ( $qossettings { 'ACK' } eq '' ) ) {
676 & Header
:: closebigbox
();
677 & Header
:: closepage
();
681 & Header
:: openbox
( '100%' , 'center' , $Lang :: tr
{ 'info' });
682 & overviewgraph
( $qossettings { 'RED_DEV' });
683 & overviewgraph
( $qossettings { 'IMQ_DEV' });
686 <tr><td colspan='9' align='right' valign='middle'><img src='/images/addblue.gif'> Unterklasse hinzufuegen | <img src='/images/addgreen.gif'> Regel hinzufuegen | <img src='/images/edit.gif'> Bearbeiten | <img src='/images/delete.gif'> Loeschen
687 <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
690 if (( - e
"/home/httpd/html/graphs/qos-graph- $qossettings {'RED_DEV'}.png" ) && ( - e
"/home/httpd/html/graphs/qos-graph- $qossettings {'IMQ_DEV'}.png" )) {
692 <tr><td colspan='9' align='center'><img src="/graphs/qos-graph- $qossettings {'RED_DEV'}.png">
693 <tr><td colspan='9' align='center'><img src="/graphs/qos-graph- $qossettings {'IMQ_DEV'}.png">
700 & showclasses
( $qossettings { 'RED_DEV' });
701 & showclasses
( $qossettings { 'IMQ_DEV' });
703 & Header
:: closebigbox
();
704 & Header
:: closepage
();
706 ############################################################################################################################
707 ############################################################################################################################
709 sub changedefclasses
{
710 & Header
:: openbox
( '100%' , 'center' , 'Standardklassen:' );
712 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
714 <tr><td width='100%' colspan='3'>Legen sie hier die Standardklassen fest durch die nicht-gefilterte Pakete gehen.
715 <tr><td width='33%' align='right'>Download:<td width='33%' align='left'><select name='DEFCLASS_INC'>
718 for ( $c = 200 ; $c <= 220 ; $c ++ )
720 if ( $qossettings { 'DEFCLASS_INC' } ne $c )
721 { print "<option value=' $c '> $c </option> \n " ; }
722 else { print "<option selected value=' $c '> $c </option> \n " ; }
725 </select><td width='33%' align='center'>
726 <tr><td width='33%' align='right'>Upload:<td width='33%' align='left'><select name='DEFCLASS_OUT'>
729 for ( $c = 100 ; $c <= 120 ; $c ++ )
731 if ( $qossettings { 'DEFCLASS_OUT' } ne $c )
732 { print "<option value=' $c '> $c </option> \n " ; }
733 else { print "<option selected value=' $c '> $c </option> \n " ; }
736 </select><td width='33%' align='center'>
740 <tr><td width='100%' colspan='3'>Legen sie hier die ACK-Klasse fest <br /> und klicken Sie danach auf <i>Speichern</i>.
741 <tr><td width='33%' align='right'>ACKs:<td width='33%' align='left'><select name='ACK'>
744 for ( $c = 100 ; $c <= 120 ; $c ++ )
746 if ( $qossettings { 'ACK' } ne $c )
747 { print "<option value=' $c '> $c </option> \n " ; }
748 else { print "<option selected value=' $c '> $c </option> \n " ; }
751 </select><td width='33%' align='center'><input type='submit' name='ACTION' value=" $Lang ::tr{'save'}" />
759 sub changebandwidth
{
760 & Header
:: openbox
( '100%' , 'center' , 'Bandbreiteneinstellungen' );
761 if ( $qossettings { 'ENABLED' } eq 'on' ) {
762 print "Sie koennen die Bandbreiteneinstellungen nicht bearbeiten, wenn QoS eingeschaltet ist. Schalten sie es zuerst dazu aus.<p>" ;
763 print "<a href='/cgi-bin/qos.cgi'>Zurueck</a>" ;
766 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
767 <input type='hidden' name='DEF_OUT_SPD' value='' /><input type='hidden' name='DEF_INC_SPD' value='' />
769 <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>.
770 <tr><td width='33%' align='right'>Download-Geschwindigkeit:
771 <td width='33%' align='left'><input type='text' name='INC_SPD' maxlength='8' value=" $qossettings {'INC_SPD'}" /> kbps
772 <td width='33%' align='center'>
773 <tr><td width='33%' align='right'>Upload-Geschwindigkeit:
774 <td width='33%' align='left'><input type='text' name='OUT_SPD' maxlength='8' value=" $qossettings {'OUT_SPD'}" /> kbps
775 <td width='33%' align='center'><input type='submit' name='ACTION' value=" $Lang ::tr{'save'}" /> <input type='reset' name='ACTION' value=" $Lang ::tr{'reset'}" />
785 & Header
:: openbox
( '100%' , 'center' , 'Parentklasse' );
787 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
791 if ( $message ne "" ) {
792 print "<tr><td colspan='3' align='center'> $message " ;
794 if ( $qossettings { 'EDIT' } eq 'yes' ) {
795 print "<input type='hidden' name='CLASS' value= $qossettings {'CLASS'}>" ;
796 print "<input type='hidden' name='DEVICE' value= $qossettings {'DEVICE'}>" ;
799 <tr><td width='100%' colspan='3'>Geben sie die Daten ein <br /> und klicken Sie danach auf <i>Speichern</i>.
800 <tr><td width='33%' align='right'>Interface:
801 <td width='33%' align='left'>
804 if ( $qossettings { 'EDIT' } eq 'yes' ) {
805 print "<select name='DEVICE' disabled>" ;
807 print "<select name='DEVICE'>" ;
809 if ( $qossettings { 'DEVICE' } eq $qossettings { 'RED_DEV' } ) {
810 $qossettings { 'RED_DEV_SEL' } = 'selected' ;
811 } elsif ( $qossettings { 'DEVICE' } eq $qossettings { 'IMQ_DEV' } ) {
812 $qossettings { 'IMQ_DEV_SEL' } = 'selected' ;
815 <option value= $qossettings {'RED_DEV'} $qossettings {'RED_DEV_SEL'}> $qossettings {'RED_DEV'}</option>
816 <option value= $qossettings {'IMQ_DEV'} $qossettings {'IMQ_DEV_SEL'}> $qossettings {'IMQ_DEV'}</option></select>
817 <td width='33%' align='center'>
818 <tr><td width='33%' align='right'>Klasse:<td width='33%' align='left'>
821 if ( $qossettings { 'EDIT' } eq 'yes' ) {
822 print "<select name='CLASS' disabled>" ;
824 print "<select name='CLASS'>" ;
826 for ( $c = 100 ; $c <= 120 ; $c ++ )
828 if ( $qossettings { 'CLASS' } ne $c )
829 { print "<option value=' $c '> $c </option> \n " ; }
830 else { print "<option selected value=' $c '> $c </option> \n " ; }
832 for ( $c = 200 ; $c <= 220 ; $c ++ )
834 if ( $qossettings { 'CLASS' } ne $c )
835 { print "<option value=' $c '> $c </option> \n " ; }
836 else { print "<option selected value=' $c '> $c </option> \n " ; }
840 <td width='33%' align='center'>
841 <tr><td width='33%' align='right'>Prioritaet:<td width='33%' align='left'><select name='PRIO'>
844 for ( $c = 1 ; $c <= 7 ; $c ++ )
846 if ( $qossettings { 'PRIO' } ne $c )
847 { print "<option value=' $c '> $c </option> \n " ; }
848 else { print "<option selected value=' $c '> $c </option> \n " ; }
850 if ( $qossettings { 'MINBWDTH' } eq "" ) { $qossettings { 'MINBWDTH' } = "1" ; }
853 <td width='33%' align='center'>
854 <tr><td width='33%' align='right'>Garantierte Bandbreite:
855 <td width='33%' align='left'><input type='text' size='20' name='MINBWDTH' maxlength='8' required='1' value=" $qossettings {'MINBWDTH'}" />
856 <td width='33%' align='center'>
857 <tr><td width='33%' align='right'>Maximale Bandbreite:
858 <td width='33%' align='left'><input type='text' size='20' name='MAXBWDTH' maxlength='8' required='1' value=" $qossettings {'MAXBWDTH'}" />
859 <td width='33%' align='center'>
860 <tr><td width='33%' align='right'>Burst:
861 <td width='33%' align='left'><input type='text' size='20' name='BURST' maxlength='8' value=" $qossettings {'BURST'}" />
862 <td width='33%' align='center'>
863 <tr><td width='33%' align='right'>Ceilburst:
864 <td width='33%' align='left'><input type='text' size='20' name='CBURST' maxlength='8' value=" $qossettings {'CBURST'}" />
865 <td width='33%' align='center'>
866 <tr><td width='33%' align='right'>TOS-Bit:
867 <td width='33%' align='left'><select name='TOS'>
868 <option value='0'>Ausgeschaltet (0)</option>
869 <option value='8'>Minimale Verzoegerung (8)</option>
870 <option value='4'>Maximaler Durchsatz (4)</option>
871 <option value='2'>Maximale Zuverlaessigkeit (2)</option>
872 <option value='1'>Minimale Kosten (1)</option></select>
873 <td width='33%' align='center'>
874 <tr><td width='33%' align='right'> $Lang ::tr{'remark'}:
875 <td width='66%' colspan='2' align='left'><input type='text' name='REMARK' size='40' maxlength='40' value=" $qossettings {'REMARK'}" /> <img alt='blob' src='/blob.gif' />
876 <tr><td width='33%' align='right'>
877 <td width='33%' align='left'>
878 <td width='33%' align='center'><input type='submit' name='DOCLASS' value= $Lang ::tr{'save'} /> <input type='reset' value= $Lang ::tr{'reset'} />
886 & Header
:: openbox
( '100%' , 'center' , 'Unterklasse' );
888 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
892 if ( $message ne "" ) {
893 print "<tr><td colspan='3' align='center'> $message " ;
896 <tr><td colspan='3' width='100%'>Aktuelle Klasse: $qossettings {'CLASS'}
897 <tr><td width='100%' colspan='3'>Geben sie die Daten ein <br /> und klicken Sie danach auf <i>Speichern</i>.
898 <tr><td width='33%' align='right'>Unterklasse:<td width='33%' align='left'><select name='SCLASS'>
901 if ( $qossettings { 'CLASS' } >= 100 && $qossettings { 'CLASS' } < 121 ) {
902 $qossettings { 'DEVICE' } = $qossettings { 'RED_DEV' };
903 for ( $c = 1000 ; $c <= 1020 ; $c ++ )
905 if ( $qossettings { 'SCLASS' } ne $c )
906 { print "<option value=' $c '> $c </option> \n " ; }
907 else { print "<option selected value=' $c '> $c </option> \n " ; }
909 } elsif ( $qossettings { 'CLASS' } >= 200 && $qossettings { 'CLASS' } < 221 ) {
910 $qossettings { 'DEVICE' } = $qossettings { 'IMQ_DEV' };
911 for ( $c = 2000 ; $c <= 2020 ; $c ++ )
913 if ( $qossettings { 'SCLASS' } ne $c )
914 { print "<option value=' $c '> $c </option> \n " ; }
915 else { print "<option selected value=' $c '> $c </option> \n " ; }
920 <td width='33%' align='center'>
921 <tr><td width='33%' align='right'>Prioritaet:<td width='33%' align='left'><select name='PRIO'>
924 for ( $c = 1 ; $c <= 7 ; $c ++ )
926 if ( $qossettings { 'PRIO' } ne $c )
927 { print "<option value=' $c '> $c </option> \n " ; }
928 else { print "<option selected value=' $c '> $c </option> \n " ; }
931 <td width='33%' align='center'>
932 <tr><td width='33%' align='right'>Garantierte Bandbreite:
933 <td width='33%' align='left'><input type='text' name='MINBWDTH' maxlength='8' required='1' value=" $qossettings {'MINBWDTH'}" />
934 <td width='33%' align='center'>
935 <tr><td width='33%' align='right'>Maximale Bandbreite:
936 <td width='33%' align='left'><input type='text' name='MAXBWDTH' maxlength='8' required='1' value=" $qossettings {'MAXBWDTH'}" />
937 <td width='33%' align='center'>
938 <tr><td width='33%' align='right'>Burst:
939 <td width='33%' align='left'><input type='text' name='BURST' maxlength='8' value=" $qossettings {'BURST'}" />
940 <td width='33%' align='center'>
941 <tr><td width='33%' align='right'>Ceilburst:
942 <td width='33%' align='left'><input type='text' name='CBURST' maxlength='8' value=" $qossettings {'CBURST'}" />
943 <td width='33%' align='center'>
944 <tr><td width='33%' align='right'>TOS-Bit:
945 <td width='33%' align='left'><select name='TOS'>
946 <option value='0'>Ausgeschaltet (0)</option>
947 <option value='8'>Minimale Verzoegerung (8)</option>
948 <option value='4'>Maximaler Durchsatz (4)</option>
949 <option value='2'>Maximale Zuverlaessigkeit (2)</option>
950 <option value='1'>Minimale Kosten (1)</option></select>
951 <td width='33%' align='center'><input type='hidden' name='CLASS' value=" $qossettings {'CLASS'}" />
952 <input type='hidden' name='DEVICE' value=" $qossettings {'DEVICE'}" />
953 <input type='submit' name='DOSCLASS' value= $Lang ::tr{'save'} /> <input type='reset' value= $Lang ::tr{'reset'} />
961 & Header
:: openbox
( '100%' , 'center' , 'Level7-Regel' );
963 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
967 if ( $message ne "" ) {
968 print "<tr><td colspan='3' align='center'><font color='red'> $message </font>" ;
971 <tr><td colspan='3' width='100%'>Aktuelle Klasse: $qossettings {'CLASS'}
972 <tr><td width='100%' colspan='3'>Geben sie die Daten ein <br /> und klicken Sie danach auf <i>Speichern</i>.
973 <tr><td width='33%' align='right'>Protokoll:
974 <td width='33%' align='left'><select name='L7PROT'>
977 opendir ( DIR
, "/etc/l7-protocols/protocols" );
978 foreach $direntry ( sort readdir ( DIR
) )
980 next if $direntry eq "." ;
981 next if $direntry eq ".." ;
982 next if - d
"/etc/l7-protocols/protocols/ $direntry " ;
983 @proto = split ( /\./ , $direntry );
984 if ( $proto [ 0 ] eq $qossettings { 'L7PROT' } ) {
985 print "<option value=' $proto [0]' selected> $proto [0]</option> \n " ;
987 print "<option value=' $proto [0]'> $proto [0]</option> \n " ;
992 </select><td width='33%' align='center'>
993 <tr><td width='33%' align='right'>Quell-IP-Adresse:
994 <td width='33%' align='left'><input type='text' name='QIP' maxlength='15' value= $qossettings {'QIP'}>
995 <td width='33%' align='center'>
996 <tr><td width='33%' align='right'>Ziel-IP-Adresse:
997 <td width='33%' align='left'><input type='text' name='DIP' maxlength='15' value= $qossettings {'DIP'}>
998 <td width='33%' align='center'><input type='hidden' name='CLASS' value= $qossettings {'CLASS'}><input type='submit' name='DOLEVEL7' value= $Lang ::tr{'save'} />
1002 & Header
:: closebox
();
1006 & Header
:: openbox
( '100%' , 'center' , 'Port-Regel hinzufuegen' );
1008 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1010 <tr><td width='100%' colspan='3'>Geben sie die Daten ein <br /> und klicken Sie danach auf <i>Speichern</i>.
1011 <tr><td width='33%' align='right'>Protokoll:
1012 <td width='33%' align='left'><select name='PPROT'>
1015 open ( FILE
, "< /etc/protocols" );
1018 foreach $direntry ( sort @proto )
1020 @tmpline = split ( /\ / , $direntry );
1021 next if $tmpline [ 0 ] =~ "#" ;
1022 if ( $tmpline [ 0 ] eq $qossettings { 'PPROT' } ) {
1023 print "<option value=' $tmpline [0]' selected> $tmpline [0]</option> \n " ;
1025 print "<option value=' $tmpline [0]'> $tmpline [0]</option> \n " ;
1029 </select><td width='33%' align='center'>
1030 <tr><td width='33%' align='right'>Quell-Port:
1031 <td width='33%' align='left'><input type='text' name='QPORT' maxlength='5' value= $qossettings {'QPORT'}>
1032 <td width='33%' align='center'>
1033 <tr><td width='33%' align='right'>Ziel-Port:
1034 <td width='33%' align='left'><input type='text' name='DPORT' maxlength='5' value= $qossettings {'DPORT'}>
1035 <td width='33%' align='center'>
1036 <tr><td width='33%' align='right'>Quell-IP-Adresse:
1037 <td width='33%' align='left'><input type='text' name='QIP' maxlength='15' value= $qossettings {'QIP'}>
1038 <td width='33%' align='center'>
1039 <tr><td width='33%' align='right'>Ziel-IP-Adresse:
1040 <td width='33%' align='left'><input type='text' name='DIP' maxlength='15' value= $qossettings {'DIP'}>
1041 <td width='33%' align='center'><input type='hidden' name='CLASS' value=' $qossettings {'CLASS'}'><input type='submit' name='DOPORT' value= $Lang ::tr{'save'} />
1045 & Header
:: closebox
();
1049 & Header
:: openbox
( '100%' , 'center' , 'TOS-Regel' );
1050 if ( $qossettings { 'TOS' }) {
1051 $checked [ $qossettings { 'TOS' }] = "checked" ;
1054 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1058 if ( $message ne "" ) {
1059 print "<tr><td colspan='3' align='center'><font color='red'> $message </font>" ;
1062 <tr><td colspan='2' width='100%'>Aktuelle Klasse: $qossettings {'CLASS'}
1063 <tr><td width='100%' colspan='2'>Aktivieren oder deaktivieren sie die TOS-Bits <br /> und klicken Sie danach auf <i>Speichern</i>.
1064 <tr><td width='50%' align='left'>Minimale Verzoegerung (8) <td width='50%'><input type="radio" name="TOS" value="8" $checked [8]>
1065 <tr><td width='50%' align='left'>Maximaler Durchsatz (4) <td width='50%'><input type="radio" name="TOS" value="4" $checked [4]>
1066 <tr><td width='50%' align='left'>Maximale Zuverlaessigkeit (2) <td width='50%'><input type="radio" name="TOS" value="2" $checked [2]>
1067 <tr><td width='50%' align='left'>Minimale Kosten (1) <td width='50%'><input type="radio" name="TOS" value="1" $checked [1]>
1068 <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'} />
1072 & Header
:: closebox
();
1076 $qossettings { 'DEV' } = shift ;
1077 open ( FILE
, "< $classfile " ) or die "Unable to read $classfile " ;
1081 open ( FILE
, "< $subclassfile " ) or die "Unable to read $subclassfile " ;
1082 @subclasses = < FILE
>;
1084 open ( FILE
, "< $level7file " ) or die "Unable to read $level7file " ;
1087 open ( FILE
, "< $tosfile " ) or die "Unable to read $tosfile " ;
1090 open ( FILE
, "< $portfile " ) or die "Unable to read $portfile " ;
1091 @portrules = < FILE
>;
1093 foreach $classentry ( sort @classes )
1095 @classline = split ( /\;/ , $classentry );
1096 if ( $classline [ 0 ] eq $qossettings { 'DEV' } )
1098 gengraph
( $qossettings { 'DEV' }, $classline [ 1 ]);
1099 & Header
:: openbox
( '100%' , 'center' , "Klasse: $classline [1]" );
1101 <table border='0' width='100%' cellspacing='0'>
1102 <tr><td bgcolor='lightgrey' width='10%' align='center'><b> $Lang ::tr{'interface'}</b>
1103 <td bgcolor='lightgrey' width='10%' align='center'><b>Klasse</b>
1104 <td bgcolor='lightgrey' width='10%' align='center'>Prioritaet
1105 <td bgcolor='lightgrey' width='10%' align='center'>Garantierte Bandbreite
1106 <td bgcolor='lightgrey' width='10%' align='center'>Maximale Bandbreite
1107 <td bgcolor='lightgrey' width='10%' align='center'>Burst
1108 <td bgcolor='lightgrey' width='10%' align='center'>Ceil Burst
1109 <td bgcolor='lightgrey' width='10%' align='center'>TOS
1110 <td bgcolor='lightgrey' width='20%' align='center'>Aktionen
1111 <tr><td align='center' bgcolor='#EAEAEA'> $classline [0]</td>
1112 <td align='center' bgcolor='#EAEAEA'> $classline [1]</td>
1113 <td align='center' bgcolor='#EAEAEA'> $classline [2]</td>
1114 <td align='center' bgcolor='#EAEAEA'> $classline [3]</td>
1115 <td align='center' bgcolor='#EAEAEA'> $classline [4]</td>
1116 <td align='center' bgcolor='#EAEAEA'> $classline [5]</td>
1117 <td align='center' bgcolor='#EAEAEA'> $classline [6]</td>
1118 <td align='center' bgcolor='#EAEAEA'> $classline [7]</td>
1119 <td align='right' bgcolor='#EAEAEA'>
1120 <table border='0'><tr>
1121 <td><form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1122 <input type='hidden' name='CLASS' value=' $classline [1]'>
1123 <input type='hidden' name='ACTION' value='Unterklasse hinzufuegen'>
1124 <input type='image' alt='Unterklasse hinzufuegen' src='/images/addblue.gif'>
1126 <td><form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1127 <input type='hidden' name='CLASS' value=' $classline [1]'>
1128 <input type='hidden' name='ACTION' value='Regel hinzufuegen'>
1129 <input type='image' alt='Regel hinzufuegen' src='/images/addgreen.gif'>
1131 <td><form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1132 <input type='hidden' name='CLASS' value=' $classline [1]'>
1133 <input type='hidden' name='DOCLASS' value='Bearbeiten'>
1134 <input type='image' alt='Bearbeiten' src='/images/edit.gif'>
1136 <td><form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1137 <input type='hidden' name='CLASS' value=' $classline [1]'>
1138 <input type='hidden' name='DOCLASS' value='Loeschen'>
1139 <input type='image' alt='Loeschen' src='/images/delete.gif'>
1143 <tr><td align='right' colspan='2'><b> $Lang ::tr{'remark'}:</b>
1144 <td align='center' colspan='6'> $classline [8]
1145 <td align='right'><b>Queueing:</b> $classline [9]
1150 foreach $l7ruleentry ( sort @l7rules )
1152 @l7ruleline = split ( /\;/ , $l7ruleentry );
1153 if ( $l7ruleline [ 0 ] eq $classline [ 1 ] )
1156 <tr><td align='right' colspan='2'><b>Level7-Protokoll:</b>
1157 <td align='center' colspan='6'> $l7ruleline [2]
1159 <table border='0'><tr>
1160 <td><form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1161 <input type='hidden' name='CLASS' value=' $l7ruleline [0]' />
1162 <input type='hidden' name='L7PROT' value=' $l7ruleline [2]' />
1163 <input type='hidden' name='DOLEVEL7' value='Bearbeiten' />
1164 <input type='image' alt='Bearbeiten' src='/images/edit.gif' />
1166 <td><form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1167 <input type='hidden' name='CLASS' value=' $l7ruleline [0]' />
1168 <input type='hidden' name='L7PROT' value=' $l7ruleline [2]' />
1169 <input type='hidden' name='DOLEVEL7' value='Loeschen' />
1170 <input type='image' alt='Loeschen' src='/images/delete.gif' />
1175 if (( $l7ruleline [ 3 ] ne "" ) || ( $l7ruleline [ 4 ] ne "" )){
1177 <tr><td align='center'>
1178 <td align='right' colspan='3'><b>Quell-IP:</b> $l7ruleline [3]
1179 <td align='right' colspan='3'><b>Ziel-IP:</b> $l7ruleline [4]
1193 foreach $portruleentry ( sort @portrules )
1195 @portruleline = split ( /\;/ , $portruleentry );
1196 if ( $portruleline [ 0 ] eq $classline [ 1 ] )
1199 <tr><td align='right' colspan='2'><b>Port-Regel:</b>
1200 <td align='center'>( $portruleline [2])
1201 <td align='center' colspan='2'>
1204 if ( $portruleline [ 4 ]) {
1206 <i>Quell-Port:</i> $portruleline [4]
1210 print "<td align='center' colspan='2'>" ;
1211 if ( $portruleline [ 6 ]) {
1213 <i>Ziel-Port:</i> $portruleline [6]
1220 <table border='0'><tr>
1221 <td><form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1222 <input type='hidden' name='CLASS' value=' $portruleline [0]'>
1223 <input type='hidden' name='PPROT' value=' $portruleline [2]'>
1224 <input type='hidden' name='QIP' value=' $portruleline [3]'>
1225 <input type='hidden' name='QPORT' value=' $portruleline [4]'>
1226 <input type='hidden' name='DIP' value=' $portruleline [5]'>
1227 <input type='hidden' name='DPORT' value=' $portruleline [6]'>
1228 <input type='hidden' name='DOPORT' value='Bearbeiten'>
1229 <input type='image' alt='Bearbeiten' src='/images/edit.gif'>
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='Loeschen'>
1239 <input type='image' alt='Loeschen' src='/images/delete.gif'>
1244 if (( $portruleline [ 3 ] ne "" ) || ( $portruleline [ 5 ] ne "" )){
1246 <tr><td align='center'>
1247 <td align='right' colspan='3'><b>Quell-IP:</b> $portruleline [3]
1248 <td align='right' colspan='3'><b>Ziel-IP:</b> $portruleline [5]
1257 foreach $tosruleentry ( sort @tosrules )
1259 @tosruleline = split ( /\;/ , $tosruleentry );
1260 if ( $tosruleline [ 0 ] eq $classline [ 1 ] )
1263 <tr><td align='right' colspan='2'>
1264 <b>TOS Bit matches:</b>
1265 <td colspan='6' align='center'>
1268 if ( $tosruleline [ 2 ] eq "8" ) {
1269 print "Minimale Verzoegerung \n " ;
1270 } elsif ( $tosruleline [ 2 ] eq "4" ) {
1271 print "Maximaler Durchsatz \n " ;
1272 } elsif ( $tosruleline [ 2 ] eq "2" ) {
1273 print "Maximaler Durchsatz \n " ;
1274 } elsif ( $tosruleline [ 2 ] eq "1" ) {
1275 print "Minimale Kosten \n " ;
1276 } else { print " \n " ; }
1281 <table border='0'><tr>
1282 <td><form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1283 <input type='hidden' name='CLASS' value=' $tosruleline [0]'>
1284 <input type='hidden' name='DEV' value=' $tosruleline [1]'>
1285 <input type='hidden' name='TOS' value=' $tosruleline [2]'>
1286 <input type='hidden' name='DOTOS' value='Bearbeiten'>
1287 <input type='image' alt='Bearbeiten' src='/images/edit.gif'>
1289 <td><form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1290 <input type='hidden' name='CLASS' value=' $tosruleline [0]'>
1291 <input type='hidden' name='DEV' value=' $tosruleline [1]'>
1292 <input type='hidden' name='TOS' value=' $tosruleline [2]'>
1293 <input type='hidden' name='DOTOS' value='Loeschen'>
1294 <input type='image' alt='Loeschen' src='/images/delete.gif'>
1303 if ( - e
"/home/httpd/html/graphs/class_ $qossettings {'CLASSPRFX'}- $qossettings {'CLASS'}_ $qossettings {'DEV'}-packets.png" ) {
1305 <tr><td colspan='9' align='center'><img src='/graphs/class_ $qossettings {'CLASSPRFX'}- $qossettings {'CLASS'}_ $qossettings {'DEV'}-packets.png'>
1311 foreach $subclassentry ( sort @subclasses )
1313 @subclassline = split ( /\;/ , $subclassentry );
1314 if ( $subclassline [ 1 ] eq $classline [ 1 ] ) {
1316 <tr><td align='center' bgcolor='#FAFAFA'>Subklasse:
1317 <td align='center' bgcolor='#FAFAFA'> $subclassline [2]
1318 <td align='center' bgcolor='#FAFAFA'> $subclassline [3]
1319 <td align='center' bgcolor='#FAFAFA'> $subclassline [4]
1320 <td align='center' bgcolor='#FAFAFA'> $subclassline [5]
1321 <td align='center' bgcolor='#FAFAFA'> $subclassline [6]
1322 <td align='center' bgcolor='#FAFAFA'> $subclassline [7]
1323 <td align='center' bgcolor='#FAFAFA'> $subclassline [8]
1324 <td align='right' bgcolor='#FAFAFA'>
1325 <table border='0'><tr>
1326 <td><form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1327 <input type='hidden' name='CLASS' value=' $subclassline [2]'>
1328 <input type='hidden' name='ACTION' value='Regel hinzufuegen'>
1329 <input type='image' alt='Regel hinzufuegen' src='/images/addgreen.gif'>
1331 <td><form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1332 <input type='hidden' name='CLASS' value=' $subclassline [2]'>
1333 <input type='hidden' name='DOSCLASS' value='Bearbeiten'>
1334 <input type='image' alt='Bearbeiten' src='/images/edit.gif'>
1336 <td><form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1337 <input type='hidden' name='CLASS' value=' $subclassline [2]'>
1338 <input type='hidden' name='DOSCLASS' value='Loeschen'>
1339 <input type='image' alt='Loeschen' src='/images/delete.gif'>
1350 & Header
:: closebox
();
1358 & Header
:: openbox
( '100%' , 'center' , 'Expertenoptionen:' );
1360 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1362 <tr><td width='33%' align='right'>MTU:<td width='33%' align='left'>
1363 <input type='text' name='MTU' maxlength='8' required='4' value= $qossettings {'MTU'}>
1364 <td width='33%' align='center'>Diese Einstellung aendert die MTU nicht global sondern nur fuer das QoS.
1365 <tr><td width='33%' align='right'>Queue Laenge:<td width='33%' align='left'>
1366 <input type='text' name='QLENGTH' maxlength='8' required='2' value= $qossettings {'QLENGTH'}>
1367 <td width='33%' align='center'>
1368 <tr><td width='33%' align='right'>SFQ Perturb:<td width='33%' align='left'>
1369 <input type='text' name='SFQ_PERTUB' maxlength='8' required='1' value= $qossettings {'SFQ_PERTUB'}>
1370 <td width='33%' align='center'><input type='submit' name='ACTION' value= $Lang ::tr{'save'} />
1375 & Header
:: closebox
();
1379 if ( $qossettings { 'VALID' } eq 'yes' ) {
1380 if ( $qossettings { 'DEVICE' } eq $qossettings { 'RED_DEV' } ) {
1381 $qossettings { 'SPD' } = $qossettings { 'OUT_SPD' };
1382 } elsif ( $qossettings { 'DEVICE' } eq $qossettings { 'IMQ_DEV' } ) {
1383 $qossettings { 'SPD' } = $qossettings { 'INC_SPD' };
1385 unless ( ( $qossettings { 'MINBWDTH' } >= 1 ) && ( $qossettings { 'MINBWDTH' } <= $qossettings { 'SPD' } ) ) {
1386 $qossettings { 'VALID' } = 'no' ;
1387 $message = "Mindestbandbreite ist ungueltig." ;
1389 $qossettings { 'SPD' } = '' ;
1394 if ( $qossettings { 'VALID' } eq 'yes' ) {
1395 if ( $qossettings { 'DEVICE' } eq $qossettings { 'RED_DEV' } ) {
1396 $qossettings { 'SPD' } = $qossettings { 'OUT_SPD' };
1397 } elsif ( $qossettings { 'DEVICE' } eq $qossettings { 'IMQ_DEV' } ) {
1398 $qossettings { 'SPD' } = $qossettings { 'INC_SPD' };
1400 unless ( ( $qossettings { 'MAXBDWTH' } >= 0 ) && ( $qossettings { 'MAXBDWTH' } >= $qossettings { 'MINBDWTH' }) &&( $qossettings { 'MAXBDWTH' } <= $qossettings { 'SPD' } ) ) {
1401 $qossettings { 'VALID' } = 'no' ;
1402 $message = "Mamimalbandbreite ist ungueltig." ;
1404 $qossettings { 'SPD' } = '' ;
1409 if ( $qossettings { 'VALID' } eq 'yes' ) {
1410 if ( $qossettings { 'DEVICE' } eq $qossettings { 'RED_DEV' } ) {
1411 if ( $qossettings { 'CLASS' } lt 100 || $qossettings { 'CLASS' } ge 121 ) {
1412 $qossettings { 'VALID' } = 'no' ;
1413 $message = "Die Klassennummer passt nicht zum angegebenen Interface." ;
1415 } elsif ( $qossettings { 'DEVICE' } eq $qossettings { 'IMQ_DEV' } ) {
1416 if ( $qossettings { 'CLASS' } lt 200 || $qossettings { 'CLASS' } ge 221 ) {
1417 $qossettings { 'VALID' } = 'no' ;
1418 $message = "Die Klassennummer passt nicht zum angegebenen Interface." ;
1421 open ( FILE
, "< $classfile " ) or die "Unable to read $classfile " ;
1424 foreach $classentry ( sort @tmp )
1426 @tmpline = split ( /\;/ , $classentry );
1427 if ( $tmpline [ 1 ] eq $qossettings { 'CLASS' } )
1429 $qossettings { 'VALID' } = 'no' ;
1430 $message = "Die aktuelle Klasse wird bereits verwendet." ;
1438 if ( $qossettings { 'VALID' } eq 'yes' ) {
1439 open ( FILE
, "< $subclassfile " ) or die "Unable to read $subclassfile " ;
1442 foreach $subclassentry ( sort @tmp )
1444 @tmpline = split ( /\;/ , $subclassentry );
1445 if ( $tmpline [ 2 ] eq $qossettings { 'SCLASS' } )
1447 $qossettings { 'VALID' } = 'no' ;
1448 $message = "Die aktuelle Klasse wird bereits verwendet." ;
1456 $qossettings { 'DEV' } = shift ;
1457 $qossettings { 'CLASS' } = shift ;
1459 if ( $qossettings { 'DEV' } eq $qossettings { 'RED_DEV' } ) {
1460 $qossettings { 'CLASSPRFX' } = '1' ;
1462 $qossettings { 'CLASSPRFX' } = '2' ;
1464 my $color = random_hex_color
( 6 );
1466 RRDs
:: graph
( "/home/httpd/html/graphs/class_ $qossettings {'CLASSPRFX'}- $qossettings {'CLASS'}_ $qossettings {'DEV'}-packets.png" ,
1467 "--start" , "-3240" , "-aPNG" , "-i" , "-z" ,
1468 "--alt-y-grid" , "-w 600" , "-h 150" , "-r" ,
1469 "--color" , "SHADEA#EAE9EE" ,
1470 "--color" , "SHADEB#EAE9EE" ,
1471 "--color" , "BACK#FFFFFF" ,
1472 "-t $qossettings {'CLASS'} ( $qossettings {'DEV'})" ,
1473 "DEF:pkts=/var/log/rrd/class_ $qossettings {'CLASSPRFX'}- $qossettings {'CLASS'}_ $qossettings {'DEV'}.rrd:pkts:AVERAGE" ,
1474 "DEF:dropped=/var/log/rrd/class_ $qossettings {'CLASSPRFX'}- $qossettings {'CLASS'}_ $qossettings {'DEV'}.rrd:dropped:AVERAGE" ,
1475 "DEF:overlimits=/var/log/rrd/class_ $qossettings {'CLASSPRFX'}- $qossettings {'CLASS'}_ $qossettings {'DEV'}.rrd:overlimits:AVERAGE" ,
1476 "AREA:pkts $color :packets" ,
1477 "GPRINT:pkts:LAST:total packets \\ : %8 .3lf %s packets \\ j" ,
1478 "LINE3:dropped#FF0000:dropped" ,
1479 "GPRINT:dropped:LAST:dropped packets \\ : %8 .3lf %s packets \\ j" ,
1480 "LINE3:overlimits#0000FF:overlimits" ,
1481 "GPRINT:overlimits:LAST:overlimits \\ : %8 .3lf %s packets \\ j" ,
1483 $ERROR = RRDs
:: error
;
1488 $qossettings { 'DEV' } = shift ;
1489 if ( $qossettings { 'DEV' } eq $qossettings { 'RED_DEV' } ) {
1490 $qossettings { 'CLASSPRFX' } = '1' ;
1492 $qossettings { 'CLASSPRFX' } = '2' ;
1496 my $color = "#000000" ;
1497 my @command =( "/home/httpd/html/graphs/qos-graph- $qossettings {'DEV'}.png" ,
1498 "--start" , "-3240" , "-aPNG" , "-i" , "-z" ,
1499 "--alt-y-grid" , "-w 600" , "-h 150" , "-r" ,
1500 "--color" , "SHADEA#EAE9EE" ,
1501 "--color" , "SHADEB#EAE9EE" ,
1502 "--color" , "BACK#FFFFFF" ,
1503 "-t Auslastung auf ( $qossettings {'DEV'})"
1505 open ( FILE
, "< $classfile " ) or die "Unable to read $classfile " ;
1508 foreach $classentry ( sort @classes )
1510 @classline = split ( /\;/ , $classentry );
1511 if ( $classline [ 0 ] eq $qossettings { 'DEV' } )
1513 $color = random_hex_color
( 6 );
1514 push ( @command , "DEF: $classline [1]=/var/log/rrd/class_ $qossettings {'CLASSPRFX'}- $classline [1]_ $qossettings {'DEV'}.rrd:bits:AVERAGE" );
1516 if ( $count eq "1" ) {
1517 push ( @command , "AREA: $classline [1] $color :Klasse $classline [1] - $classline [8] \\ j" );
1519 push ( @command , "STACK: $classline [1] $color :Klasse $classline [1] - $classline [8] \\ j" );
1524 RRDs
:: graph
( @command );
1525 $ERROR = RRDs
:: error
;
1529 sub random_hex_color
{
1531 $size = 6 if $size !~ /^3|6$/ ;
1532 my @hex = ( 0 .. 9 , 'a' .. 'f' );
1534 push @color , @hex [ rand ( @hex )] for 1 .. $size ;
1535 return join ( '' , '#' , @color );