]>
git.ipfire.org Git - 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>" ;
519 & Header
:: closebigbox
();
520 & Header
:: closepage
();
523 elsif ( $qossettings { 'ACTION' } eq 'Parentklasse hinzufuegen' )
526 & Header
:: closebigbox
();
527 & Header
:: closepage
();
530 elsif ( $qossettings { 'ACTION' } eq 'Unterklasse hinzufuegen' )
533 & Header
:: closebigbox
();
534 & Header
:: closepage
();
537 elsif ( $qossettings { 'ACTION' } eq 'Regel hinzufuegen' )
539 & Header
:: openbox
( '100%' , 'center' , 'Regel hinzufuegen' );
542 <tr><td align='center'>Waehlen sie <u>eine</u> der untenstehenden Regeln aus.
543 <tr><td align='center'>
544 <input type="button" onClick="swapVisibility('l7rule')" value='Level7-Regel' />
545 <input type="button" onClick="swapVisibility('portrule')" value='Port-Regel' />
546 <input type="button" onClick="swapVisibility('tosrule')" value='TOS-Regel' />
552 <div id='l7rule' style='display: none'>
558 <div id='portrule' style='display: none'>
564 <div id='tosrule' style='display: none'>
572 & Header
:: closebigbox
();
573 & Header
:: closepage
();
576 elsif ( $qossettings { 'ACTION' } eq 'Erweiterte Einstellungen' )
579 & Header
:: closebigbox
();
580 & Header
:: closepage
();
583 if ( $qossettings { 'ACTIONBW' } eq 'Andern' )
586 & Header
:: closebigbox
();
587 & Header
:: closepage
();
590 if ( $qossettings { 'ACTIONDEF' } eq 'Andern' )
593 & Header
:: closebigbox
();
594 & Header
:: closepage
();
598 & General
:: readhash
( "${General::swroot}/qos/settings" , \
%qossettings );
600 my $status = $Lang :: tr
{ 'stopped' };
601 my $statuscolor = '#993333' ;
602 if ( $qossettings { 'ENABLED' } eq 'on' ) {
603 $status = $Lang :: tr
{ 'running' };
604 $statuscolor = '#339933' ;
607 if ( $netsettings { 'RED_TYPE' } ne 'PPPOE' ) {
608 $qossettings { 'RED_DEV' } = $netsettings { 'RED_DEV' };
612 & Header
:: openbox
( '100%' , 'left' , $Lang :: tr
{ 'error messages' });
613 print "<class name='base'> $errormessage \n " ;
614 print " </class> \n " ;
618 ############################################################################################################################
619 ############################################################################################################################
621 & Header
:: openbox
( '100%' , 'center' , 'Quality of Service' );
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'}" />
639 if (( $qossettings { 'OUT_SPD' } ne '' ) && ( $qossettings { 'INC_SPD' } ne '' )) {
641 <tr><td colspan='3'>
642 <tr><td width='40%' align='right'>Downloadgeschwindigkeit: <td width='40%' align='left'> $qossettings {'INC_SPD'} kbps
643 <td width='20%' rowspan='2' align='center' valign='middle'><input type='submit' name='ACTIONBW' value='Andern' />
644 <tr><td width='40%' align='right'>Uploadgeschwindigkeit: <td width='40%' align='left'> $qossettings {'OUT_SPD'} kbps
648 if (( $qossettings { 'DEFCLASS_OUT' } ne '' ) && ( $qossettings { 'DEFCLASS_INC' } ne '' )&& ( $qossettings { 'ACK' } ne '' )) {
650 <tr><td colspan='3'><hr />
651 <tr><td width='40%' align='right'>Downloadstandardklasse: <td width='40%' align='left'> $qossettings {'DEFCLASS_INC'}
652 <td width='20%' rowspan='3' align='center' valign='middle'><input type='submit' name='ACTIONDEF' value='Andern'>
653 <tr><td width='40%' align='right'>Uploadstandardklasse: <td width='40%' align='left'> $qossettings {'DEFCLASS_OUT'}
654 <tr><td width='40%' align='right'>ACKs: <td width='40%' align='left'> $qossettings {'ACK'}
655 <tr><td colspan='3' width='100%'><hr />
656 <tr><td colspan='3' width='100%' align='center'>
657 <table boder='0' cellpadding='0' cellspacing='0'>
658 <tr><td><input type='submit' name='ACTION' value='Parentklasse hinzufuegen'>
659 <td><input type='submit' name='ACTION' value='Erweiterte Einstellungen'>
660 <tr><td><input type='submit' name='ACTION' value='Statusinformationen'>
661 <td><input type='submit' name='ACTION' value='Grafische Auswertung'>
670 if ( ( $qossettings { 'OUT_SPD' } eq '' ) || ( $qossettings { 'INC_SPD' } eq '' ) ) {
672 & Header
:: closebigbox
();
673 & Header
:: closepage
();
677 if ( ( $qossettings { 'DEFCLASS_INC' } eq '' ) || ( $qossettings { 'DEFCLASS_OUT' } eq '' ) || ( $qossettings { 'ACK' } eq '' ) ) {
679 & Header
:: closebigbox
();
680 & Header
:: closepage
();
684 & Header
:: openbox
( '100%' , 'center' , $Lang :: tr
{ 'info' });
685 & overviewgraph
( $qossettings { 'RED_DEV' });
686 & overviewgraph
( $qossettings { 'IMQ_DEV' });
689 <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
690 <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
693 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" )) {
695 <tr><td colspan='9' align='center'><img src="/graphs/qos-graph- $qossettings {'RED_DEV'}.png">
696 <tr><td colspan='9' align='center'><img src="/graphs/qos-graph- $qossettings {'IMQ_DEV'}.png">
703 & showclasses
( $qossettings { 'RED_DEV' });
704 & showclasses
( $qossettings { 'IMQ_DEV' });
706 & Header
:: closebigbox
();
707 & Header
:: closepage
();
709 ############################################################################################################################
710 ############################################################################################################################
712 sub changedefclasses
{
713 & Header
:: openbox
( '100%' , 'center' , 'Standardklassen:' );
715 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
717 <tr><td width='100%' colspan='3'>Legen sie hier die Standardklassen fest durch die nicht-gefilterte Pakete gehen.
718 <tr><td width='33%' align='right'>Download:<td width='33%' align='left'><select name='DEFCLASS_INC'>
721 for ( $c = 200 ; $c <= 220 ; $c ++ )
723 if ( $qossettings { 'DEFCLASS_INC' } ne $c )
724 { print "<option value=' $c '> $c </option> \n " ; }
725 else { print "<option selected value=' $c '> $c </option> \n " ; }
728 </select><td width='33%' align='center'>
729 <tr><td width='33%' align='right'>Upload:<td width='33%' align='left'><select name='DEFCLASS_OUT'>
732 for ( $c = 100 ; $c <= 120 ; $c ++ )
734 if ( $qossettings { 'DEFCLASS_OUT' } ne $c )
735 { print "<option value=' $c '> $c </option> \n " ; }
736 else { print "<option selected value=' $c '> $c </option> \n " ; }
739 </select><td width='33%' align='center'>
743 <tr><td width='100%' colspan='3'>Legen sie hier die ACK-Klasse fest <br /> und klicken Sie danach auf <i>Speichern</i>.
744 <tr><td width='33%' align='right'>ACKs:<td width='33%' align='left'><select name='ACK'>
747 for ( $c = 100 ; $c <= 120 ; $c ++ )
749 if ( $qossettings { 'ACK' } ne $c )
750 { print "<option value=' $c '> $c </option> \n " ; }
751 else { print "<option selected value=' $c '> $c </option> \n " ; }
754 </select><td width='33%' align='center'><input type='submit' name='ACTION' value=" $Lang ::tr{'save'}" />
762 sub changebandwidth
{
763 & Header
:: openbox
( '100%' , 'center' , 'Bandbreiteneinstellungen' );
764 if ( $qossettings { 'ENABLED' } eq 'on' ) {
765 print "Sie koennen die Bandbreiteneinstellungen nicht bearbeiten, wenn QoS eingeschaltet ist. Schalten sie es zuerst dazu aus.<p>" ;
766 print "<a href='/cgi-bin/qos.cgi'>Zurueck</a>" ;
769 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
770 <input type='hidden' name='DEF_OUT_SPD' value='' /><input type='hidden' name='DEF_INC_SPD' value='' />
772 <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>.
773 <tr><td width='33%' align='right'>Download-Geschwindigkeit:
774 <td width='33%' align='left'><input type='text' name='INC_SPD' maxlength='8' value=" $qossettings {'INC_SPD'}" /> kbps
775 <td width='33%' align='center'>
776 <tr><td width='33%' align='right'>Upload-Geschwindigkeit:
777 <td width='33%' align='left'><input type='text' name='OUT_SPD' maxlength='8' value=" $qossettings {'OUT_SPD'}" /> kbps
778 <td width='33%' align='center'><input type='submit' name='ACTION' value=" $Lang ::tr{'save'}" /> <input type='reset' name='ACTION' value=" $Lang ::tr{'reset'}" />
788 & Header
:: openbox
( '100%' , 'center' , 'Parentklasse' );
790 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
794 if ( $message ne "" ) {
795 print "<tr><td colspan='3' align='center'> $message " ;
797 if ( $qossettings { 'EDIT' } eq 'yes' ) {
798 print "<input type='hidden' name='CLASS' value= $qossettings {'CLASS'}>" ;
799 print "<input type='hidden' name='DEVICE' value= $qossettings {'DEVICE'}>" ;
802 <tr><td width='100%' colspan='3'>Geben sie die Daten ein <br /> und klicken Sie danach auf <i>Speichern</i>.
803 <tr><td width='33%' align='right'>Interface:
804 <td width='33%' align='left'>
807 if ( $qossettings { 'EDIT' } eq 'yes' ) {
808 print "<select name='DEVICE' disabled>" ;
810 print "<select name='DEVICE'>" ;
812 if ( $qossettings { 'DEVICE' } eq $qossettings { 'RED_DEV' } ) {
813 $qossettings { 'RED_DEV_SEL' } = 'selected' ;
814 } elsif ( $qossettings { 'DEVICE' } eq $qossettings { 'IMQ_DEV' } ) {
815 $qossettings { 'IMQ_DEV_SEL' } = 'selected' ;
818 <option value= $qossettings {'RED_DEV'} $qossettings {'RED_DEV_SEL'}> $qossettings {'RED_DEV'}</option>
819 <option value= $qossettings {'IMQ_DEV'} $qossettings {'IMQ_DEV_SEL'}> $qossettings {'IMQ_DEV'}</option></select>
820 <td width='33%' align='center'>
821 <tr><td width='33%' align='right'>Klasse:<td width='33%' align='left'>
824 if ( $qossettings { 'EDIT' } eq 'yes' ) {
825 print "<select name='CLASS' disabled>" ;
827 print "<select name='CLASS'>" ;
829 for ( $c = 100 ; $c <= 120 ; $c ++ )
831 if ( $qossettings { 'CLASS' } ne $c )
832 { print "<option value=' $c '> $c </option> \n " ; }
833 else { print "<option selected value=' $c '> $c </option> \n " ; }
835 for ( $c = 200 ; $c <= 220 ; $c ++ )
837 if ( $qossettings { 'CLASS' } ne $c )
838 { print "<option value=' $c '> $c </option> \n " ; }
839 else { print "<option selected value=' $c '> $c </option> \n " ; }
843 <td width='33%' align='center'>
844 <tr><td width='33%' align='right'>Prioritaet:<td width='33%' align='left'><select name='PRIO'>
847 for ( $c = 1 ; $c <= 7 ; $c ++ )
849 if ( $qossettings { 'PRIO' } ne $c )
850 { print "<option value=' $c '> $c </option> \n " ; }
851 else { print "<option selected value=' $c '> $c </option> \n " ; }
853 if ( $qossettings { 'MINBWDTH' } eq "" ) { $qossettings { 'MINBWDTH' } = "1" ; }
856 <td width='33%' align='center'>
857 <tr><td width='33%' align='right'>Garantierte Bandbreite:
858 <td width='33%' align='left'><input type='text' size='20' name='MINBWDTH' maxlength='8' required='1' value=" $qossettings {'MINBWDTH'}" />
859 <td width='33%' align='center'>
860 <tr><td width='33%' align='right'>Maximale Bandbreite:
861 <td width='33%' align='left'><input type='text' size='20' name='MAXBWDTH' maxlength='8' required='1' value=" $qossettings {'MAXBWDTH'}" />
862 <td width='33%' align='center'>
863 <tr><td width='33%' align='right'>Burst:
864 <td width='33%' align='left'><input type='text' size='20' name='BURST' maxlength='8' value=" $qossettings {'BURST'}" />
865 <td width='33%' align='center'>
866 <tr><td width='33%' align='right'>Ceilburst:
867 <td width='33%' align='left'><input type='text' size='20' name='CBURST' maxlength='8' value=" $qossettings {'CBURST'}" />
868 <td width='33%' align='center'>
869 <tr><td width='33%' align='right'>TOS-Bit:
870 <td width='33%' align='left'><select name='TOS'>
871 <option value='0'>Ausgeschaltet (0)</option>
872 <option value='8'>Minimale Verzoegerung (8)</option>
873 <option value='4'>Maximaler Durchsatz (4)</option>
874 <option value='2'>Maximale Zuverlaessigkeit (2)</option>
875 <option value='1'>Minimale Kosten (1)</option></select>
876 <td width='33%' align='center'>
877 <tr><td width='33%' align='right'> $Lang ::tr{'remark'}:
878 <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' />
879 <tr><td width='33%' align='right'>
880 <td width='33%' align='left'>
881 <td width='33%' align='center'><input type='submit' name='DOCLASS' value= $Lang ::tr{'save'} /> <input type='reset' value= $Lang ::tr{'reset'} />
889 & Header
:: openbox
( '100%' , 'center' , 'Unterklasse' );
891 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
895 if ( $message ne "" ) {
896 print "<tr><td colspan='3' align='center'> $message " ;
899 <tr><td colspan='3' width='100%'>Aktuelle Klasse: $qossettings {'CLASS'}
900 <tr><td width='100%' colspan='3'>Geben sie die Daten ein <br /> und klicken Sie danach auf <i>Speichern</i>.
901 <tr><td width='33%' align='right'>Unterklasse:<td width='33%' align='left'><select name='SCLASS'>
904 if ( $qossettings { 'CLASS' } >= 100 && $qossettings { 'CLASS' } < 121 ) {
905 $qossettings { 'DEVICE' } = $qossettings { 'RED_DEV' };
906 for ( $c = 1000 ; $c <= 1020 ; $c ++ )
908 if ( $qossettings { 'SCLASS' } ne $c )
909 { print "<option value=' $c '> $c </option> \n " ; }
910 else { print "<option selected value=' $c '> $c </option> \n " ; }
912 } elsif ( $qossettings { 'CLASS' } >= 200 && $qossettings { 'CLASS' } < 221 ) {
913 $qossettings { 'DEVICE' } = $qossettings { 'IMQ_DEV' };
914 for ( $c = 2000 ; $c <= 2020 ; $c ++ )
916 if ( $qossettings { 'SCLASS' } ne $c )
917 { print "<option value=' $c '> $c </option> \n " ; }
918 else { print "<option selected value=' $c '> $c </option> \n " ; }
923 <td width='33%' align='center'>
924 <tr><td width='33%' align='right'>Prioritaet:<td width='33%' align='left'><select name='PRIO'>
927 for ( $c = 1 ; $c <= 7 ; $c ++ )
929 if ( $qossettings { 'PRIO' } ne $c )
930 { print "<option value=' $c '> $c </option> \n " ; }
931 else { print "<option selected value=' $c '> $c </option> \n " ; }
934 <td width='33%' align='center'>
935 <tr><td width='33%' align='right'>Garantierte Bandbreite:
936 <td width='33%' align='left'><input type='text' name='MINBWDTH' maxlength='8' required='1' value=" $qossettings {'MINBWDTH'}" />
937 <td width='33%' align='center'>
938 <tr><td width='33%' align='right'>Maximale Bandbreite:
939 <td width='33%' align='left'><input type='text' name='MAXBWDTH' maxlength='8' required='1' value=" $qossettings {'MAXBWDTH'}" />
940 <td width='33%' align='center'>
941 <tr><td width='33%' align='right'>Burst:
942 <td width='33%' align='left'><input type='text' name='BURST' maxlength='8' value=" $qossettings {'BURST'}" />
943 <td width='33%' align='center'>
944 <tr><td width='33%' align='right'>Ceilburst:
945 <td width='33%' align='left'><input type='text' name='CBURST' maxlength='8' value=" $qossettings {'CBURST'}" />
946 <td width='33%' align='center'>
947 <tr><td width='33%' align='right'>TOS-Bit:
948 <td width='33%' align='left'><select name='TOS'>
949 <option value='0'>Ausgeschaltet (0)</option>
950 <option value='8'>Minimale Verzoegerung (8)</option>
951 <option value='4'>Maximaler Durchsatz (4)</option>
952 <option value='2'>Maximale Zuverlaessigkeit (2)</option>
953 <option value='1'>Minimale Kosten (1)</option></select>
954 <td width='33%' align='center'><input type='hidden' name='CLASS' value=" $qossettings {'CLASS'}" />
955 <input type='hidden' name='DEVICE' value=" $qossettings {'DEVICE'}" />
956 <input type='submit' name='DOSCLASS' value= $Lang ::tr{'save'} /> <input type='reset' value= $Lang ::tr{'reset'} />
964 & Header
:: openbox
( '100%' , 'center' , 'Level7-Regel' );
966 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
970 if ( $message ne "" ) {
971 print "<tr><td colspan='3' align='center'><font color='red'> $message </font>" ;
974 <tr><td colspan='3' width='100%'>Aktuelle Klasse: $qossettings {'CLASS'}
975 <tr><td width='100%' colspan='3'>Geben sie die Daten ein <br /> und klicken Sie danach auf <i>Speichern</i>.
976 <tr><td width='33%' align='right'>Protokoll:
977 <td width='33%' align='left'><select name='L7PROT'>
980 opendir ( DIR
, "/etc/l7-protocols/protocols" );
981 foreach $direntry ( sort readdir ( DIR
) )
983 next if $direntry eq "." ;
984 next if $direntry eq ".." ;
985 next if - d
"/etc/l7-protocols/protocols/ $direntry " ;
986 @proto = split ( /\./ , $direntry );
987 if ( $proto [ 0 ] eq $qossettings { 'L7PROT' } ) {
988 print "<option value=' $proto [0]' selected> $proto [0]</option> \n " ;
990 print "<option value=' $proto [0]'> $proto [0]</option> \n " ;
995 </select><td width='33%' align='center'>
996 <tr><td width='33%' align='right'>Quell-IP-Adresse:
997 <td width='33%' align='left'><input type='text' name='QIP' maxlength='15' value= $qossettings {'QIP'}>
998 <td width='33%' align='center'>
999 <tr><td width='33%' align='right'>Ziel-IP-Adresse:
1000 <td width='33%' align='left'><input type='text' name='DIP' maxlength='15' value= $qossettings {'DIP'}>
1001 <td width='33%' align='center'><input type='hidden' name='CLASS' value= $qossettings {'CLASS'}><input type='submit' name='DOLEVEL7' value= $Lang ::tr{'save'} />
1005 & Header
:: closebox
();
1009 & Header
:: openbox
( '100%' , 'center' , 'Port-Regel hinzufuegen' );
1011 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1013 <tr><td width='100%' colspan='3'>Geben sie die Daten ein <br /> und klicken Sie danach auf <i>Speichern</i>.
1014 <tr><td width='33%' align='right'>Protokoll:
1015 <td width='33%' align='left'><select name='PPROT'>
1018 open ( FILE
, "< /etc/protocols" );
1021 foreach $direntry ( sort @proto )
1023 @tmpline = split ( /\ / , $direntry );
1024 next if $tmpline [ 0 ] =~ "#" ;
1025 if ( $tmpline [ 0 ] eq $qossettings { 'PPROT' } ) {
1026 print "<option value=' $tmpline [0]' selected> $tmpline [0]</option> \n " ;
1028 print "<option value=' $tmpline [0]'> $tmpline [0]</option> \n " ;
1032 </select><td width='33%' align='center'>
1033 <tr><td width='33%' align='right'>Quell-Port:
1034 <td width='33%' align='left'><input type='text' name='QPORT' maxlength='5' value= $qossettings {'QPORT'}>
1035 <td width='33%' align='center'>
1036 <tr><td width='33%' align='right'>Ziel-Port:
1037 <td width='33%' align='left'><input type='text' name='DPORT' maxlength='5' value= $qossettings {'DPORT'}>
1038 <td width='33%' align='center'>
1039 <tr><td width='33%' align='right'>Quell-IP-Adresse:
1040 <td width='33%' align='left'><input type='text' name='QIP' maxlength='15' value= $qossettings {'QIP'}>
1041 <td width='33%' align='center'>
1042 <tr><td width='33%' align='right'>Ziel-IP-Adresse:
1043 <td width='33%' align='left'><input type='text' name='DIP' maxlength='15' value= $qossettings {'DIP'}>
1044 <td width='33%' align='center'><input type='hidden' name='CLASS' value=' $qossettings {'CLASS'}'><input type='submit' name='DOPORT' value= $Lang ::tr{'save'} />
1048 & Header
:: closebox
();
1052 & Header
:: openbox
( '100%' , 'center' , 'TOS-Regel' );
1053 if ( $qossettings { 'TOS' }) {
1054 $checked [ $qossettings { 'TOS' }] = "checked" ;
1057 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1061 if ( $message ne "" ) {
1062 print "<tr><td colspan='3' align='center'><font color='red'> $message </font>" ;
1065 <tr><td colspan='2' width='100%'>Aktuelle Klasse: $qossettings {'CLASS'}
1066 <tr><td width='100%' colspan='2'>Aktivieren oder deaktivieren sie die TOS-Bits <br /> und klicken Sie danach auf <i>Speichern</i>.
1067 <tr><td width='50%' align='left'>Minimale Verzoegerung (8) <td width='50%'><input type="radio" name="TOS" value="8" $checked [8]>
1068 <tr><td width='50%' align='left'>Maximaler Durchsatz (4) <td width='50%'><input type="radio" name="TOS" value="4" $checked [4]>
1069 <tr><td width='50%' align='left'>Maximale Zuverlaessigkeit (2) <td width='50%'><input type="radio" name="TOS" value="2" $checked [2]>
1070 <tr><td width='50%' align='left'>Minimale Kosten (1) <td width='50%'><input type="radio" name="TOS" value="1" $checked [1]>
1071 <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'} />
1075 & Header
:: closebox
();
1079 $qossettings { 'DEV' } = shift ;
1080 open ( FILE
, "< $classfile " ) or die "Unable to read $classfile " ;
1084 open ( FILE
, "< $subclassfile " ) or die "Unable to read $subclassfile " ;
1085 @subclasses = < FILE
>;
1087 open ( FILE
, "< $level7file " ) or die "Unable to read $level7file " ;
1090 open ( FILE
, "< $tosfile " ) or die "Unable to read $tosfile " ;
1093 open ( FILE
, "< $portfile " ) or die "Unable to read $portfile " ;
1094 @portrules = < FILE
>;
1096 foreach $classentry ( sort @classes )
1098 @classline = split ( /\;/ , $classentry );
1099 if ( $classline [ 0 ] eq $qossettings { 'DEV' } )
1101 gengraph
( $qossettings { 'DEV' }, $classline [ 1 ]);
1102 & Header
:: openbox
( '100%' , 'center' , "Klasse: $classline [1]" );
1104 <table border='0' width='100%' cellspacing='0'>
1105 <tr><td bgcolor=' $color {'color20'}' width='10%' align='center'><b> $Lang ::tr{'interface'}</b>
1106 <td bgcolor=' $color {'color20'}' width='10%' align='center'><b>Klasse</b>
1107 <td bgcolor=' $color {'color20'}' width='10%' align='center'>Prioritaet
1108 <td bgcolor=' $color {'color20'}' width='10%' align='center'>Garantierte Bandbreite
1109 <td bgcolor=' $color {'color20'}' width='10%' align='center'>Maximale Bandbreite
1110 <td bgcolor=' $color {'color20'}' width='10%' align='center'>Burst
1111 <td bgcolor=' $color {'color20'}' width='10%' align='center'>Ceil Burst
1112 <td bgcolor=' $color {'color20'}' width='10%' align='center'>TOS
1113 <td bgcolor=' $color {'color20'}' width='20%' align='center'>Aktionen
1114 <tr><td align='center' bgcolor=' $color {'color22'}'> $classline [0]</td>
1115 <td align='center' bgcolor=' $color {'color22'}'> $classline [1]</td>
1116 <td align='center' bgcolor=' $color {'color22'}'> $classline [2]</td>
1117 <td align='center' bgcolor=' $color {'color22'}'> $classline [3]</td>
1118 <td align='center' bgcolor=' $color {'color22'}'> $classline [4]</td>
1119 <td align='center' bgcolor=' $color {'color22'}'> $classline [5]</td>
1120 <td align='center' bgcolor=' $color {'color22'}'> $classline [6]</td>
1121 <td align='center' bgcolor=' $color {'color22'}'> $classline [7]</td>
1122 <td align='right' bgcolor=' $color {'color22'}'>
1123 <table border='0'><tr>
1124 <td><form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1125 <input type='hidden' name='CLASS' value=' $classline [1]'>
1126 <input type='hidden' name='ACTION' value='Unterklasse hinzufuegen'>
1127 <input type='image' alt='Unterklasse hinzufuegen' src='/images/addblue.gif'>
1129 <td><form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1130 <input type='hidden' name='CLASS' value=' $classline [1]'>
1131 <input type='hidden' name='ACTION' value='Regel hinzufuegen'>
1132 <input type='image' alt='Regel hinzufuegen' src='/images/addgreen.gif'>
1134 <td><form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1135 <input type='hidden' name='CLASS' value=' $classline [1]'>
1136 <input type='hidden' name='DOCLASS' value='Bearbeiten'>
1137 <input type='image' alt='Bearbeiten' src='/images/edit.gif'>
1139 <td><form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1140 <input type='hidden' name='CLASS' value=' $classline [1]'>
1141 <input type='hidden' name='DOCLASS' value='Loeschen'>
1142 <input type='image' alt='Loeschen' src='/images/delete.gif'>
1146 <tr><td align='right' colspan='2'><b> $Lang ::tr{'remark'}:</b>
1147 <td align='center' colspan='6'> $classline [8]
1148 <td align='right'><b>Queueing:</b> $classline [9]
1153 foreach $l7ruleentry ( sort @l7rules )
1155 @l7ruleline = split ( /\;/ , $l7ruleentry );
1156 if ( $l7ruleline [ 0 ] eq $classline [ 1 ] )
1159 <tr><td align='right' colspan='2'><b>Level7-Protokoll:</b>
1160 <td align='center' colspan='6'> $l7ruleline [2]
1162 <table border='0'><tr>
1163 <td><form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1164 <input type='hidden' name='CLASS' value=' $l7ruleline [0]' />
1165 <input type='hidden' name='L7PROT' value=' $l7ruleline [2]' />
1166 <input type='hidden' name='DOLEVEL7' value='Bearbeiten' />
1167 <input type='image' alt='Bearbeiten' src='/images/edit.gif' />
1169 <td><form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1170 <input type='hidden' name='CLASS' value=' $l7ruleline [0]' />
1171 <input type='hidden' name='L7PROT' value=' $l7ruleline [2]' />
1172 <input type='hidden' name='DOLEVEL7' value='Loeschen' />
1173 <input type='image' alt='Loeschen' src='/images/delete.gif' />
1178 if (( $l7ruleline [ 3 ] ne "" ) || ( $l7ruleline [ 4 ] ne "" )){
1180 <tr><td align='center'>
1181 <td align='right' colspan='3'><b>Quell-IP:</b> $l7ruleline [3]
1182 <td align='right' colspan='3'><b>Ziel-IP:</b> $l7ruleline [4]
1196 foreach $portruleentry ( sort @portrules )
1198 @portruleline = split ( /\;/ , $portruleentry );
1199 if ( $portruleline [ 0 ] eq $classline [ 1 ] )
1202 <tr><td align='right' colspan='2'><b>Port-Regel:</b>
1203 <td align='center'>( $portruleline [2])
1204 <td align='center' colspan='2'>
1207 if ( $portruleline [ 4 ]) {
1209 <i>Quell-Port:</i> $portruleline [4]
1213 print "<td align='center' colspan='2'>" ;
1214 if ( $portruleline [ 6 ]) {
1216 <i>Ziel-Port:</i> $portruleline [6]
1223 <table border='0'><tr>
1224 <td><form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1225 <input type='hidden' name='CLASS' value=' $portruleline [0]'>
1226 <input type='hidden' name='PPROT' value=' $portruleline [2]'>
1227 <input type='hidden' name='QIP' value=' $portruleline [3]'>
1228 <input type='hidden' name='QPORT' value=' $portruleline [4]'>
1229 <input type='hidden' name='DIP' value=' $portruleline [5]'>
1230 <input type='hidden' name='DPORT' value=' $portruleline [6]'>
1231 <input type='hidden' name='DOPORT' value='Bearbeiten'>
1232 <input type='image' alt='Bearbeiten' src='/images/edit.gif'>
1234 <td><form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1235 <input type='hidden' name='CLASS' value=' $portruleline [0]'>
1236 <input type='hidden' name='PPROT' value=' $portruleline [2]'>
1237 <input type='hidden' name='QIP' value=' $portruleline [3]'>
1238 <input type='hidden' name='QPORT' value=' $portruleline [4]'>
1239 <input type='hidden' name='DIP' value=' $portruleline [5]'>
1240 <input type='hidden' name='DPORT' value=' $portruleline [6]'>
1241 <input type='hidden' name='DOPORT' value='Loeschen'>
1242 <input type='image' alt='Loeschen' src='/images/delete.gif'>
1247 if (( $portruleline [ 3 ] ne "" ) || ( $portruleline [ 5 ] ne "" )){
1249 <tr><td align='center'>
1250 <td align='right' colspan='3'><b>Quell-IP:</b> $portruleline [3]
1251 <td align='right' colspan='3'><b>Ziel-IP:</b> $portruleline [5]
1260 foreach $tosruleentry ( sort @tosrules )
1262 @tosruleline = split ( /\;/ , $tosruleentry );
1263 if ( $tosruleline [ 0 ] eq $classline [ 1 ] )
1266 <tr><td align='right' colspan='2'>
1267 <b>TOS Bit matches:</b>
1268 <td colspan='6' align='center'>
1271 if ( $tosruleline [ 2 ] eq "8" ) {
1272 print "Minimale Verzoegerung \n " ;
1273 } elsif ( $tosruleline [ 2 ] eq "4" ) {
1274 print "Maximaler Durchsatz \n " ;
1275 } elsif ( $tosruleline [ 2 ] eq "2" ) {
1276 print "Maximaler Durchsatz \n " ;
1277 } elsif ( $tosruleline [ 2 ] eq "1" ) {
1278 print "Minimale Kosten \n " ;
1279 } else { print " \n " ; }
1284 <table border='0'><tr>
1285 <td><form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1286 <input type='hidden' name='CLASS' value=' $tosruleline [0]'>
1287 <input type='hidden' name='DEV' value=' $tosruleline [1]'>
1288 <input type='hidden' name='TOS' value=' $tosruleline [2]'>
1289 <input type='hidden' name='DOTOS' value='Bearbeiten'>
1290 <input type='image' alt='Bearbeiten' src='/images/edit.gif'>
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='Loeschen'>
1297 <input type='image' alt='Loeschen' src='/images/delete.gif'>
1306 if ( - e
"/srv/web/ipfire/html/graphs/class_ $qossettings {'CLASSPRFX'}- $qossettings {'CLASS'}_ $qossettings {'DEV'}-packets.png" ) {
1308 <tr><td colspan='9' align='center'><img src='/graphs/class_ $qossettings {'CLASSPRFX'}- $qossettings {'CLASS'}_ $qossettings {'DEV'}-packets.png'>
1314 foreach $subclassentry ( sort @subclasses )
1316 @subclassline = split ( /\;/ , $subclassentry );
1317 if ( $subclassline [ 1 ] eq $classline [ 1 ] ) {
1319 <tr><td align='center' bgcolor='#FAFAFA'>Subklasse:
1320 <td align='center' bgcolor='#FAFAFA'> $subclassline [2]
1321 <td align='center' bgcolor='#FAFAFA'> $subclassline [3]
1322 <td align='center' bgcolor='#FAFAFA'> $subclassline [4]
1323 <td align='center' bgcolor='#FAFAFA'> $subclassline [5]
1324 <td align='center' bgcolor='#FAFAFA'> $subclassline [6]
1325 <td align='center' bgcolor='#FAFAFA'> $subclassline [7]
1326 <td align='center' bgcolor='#FAFAFA'> $subclassline [8]
1327 <td align='right' bgcolor='#FAFAFA'>
1328 <table border='0'><tr>
1329 <td><form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1330 <input type='hidden' name='CLASS' value=' $subclassline [2]'>
1331 <input type='hidden' name='ACTION' value='Regel hinzufuegen'>
1332 <input type='image' alt='Regel hinzufuegen' src='/images/addgreen.gif'>
1334 <td><form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1335 <input type='hidden' name='CLASS' value=' $subclassline [2]'>
1336 <input type='hidden' name='DOSCLASS' value='Bearbeiten'>
1337 <input type='image' alt='Bearbeiten' src='/images/edit.gif'>
1339 <td><form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1340 <input type='hidden' name='CLASS' value=' $subclassline [2]'>
1341 <input type='hidden' name='DOSCLASS' value='Loeschen'>
1342 <input type='image' alt='Loeschen' src='/images/delete.gif'>
1353 & Header
:: closebox
();
1361 & Header
:: openbox
( '100%' , 'center' , 'Expertenoptionen:' );
1363 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1365 <tr><td width='33%' align='right'>MTU:<td width='33%' align='left'>
1366 <input type='text' name='MTU' maxlength='8' required='4' value= $qossettings {'MTU'}>
1367 <td width='33%' align='center'>Diese Einstellung aendert die MTU nicht global sondern nur fuer das QoS.
1368 <tr><td width='33%' align='right'>Queue Laenge:<td width='33%' align='left'>
1369 <input type='text' name='QLENGTH' maxlength='8' required='2' value= $qossettings {'QLENGTH'}>
1370 <td width='33%' align='center'>
1371 <tr><td width='33%' align='right'>SFQ Perturb:<td width='33%' align='left'>
1372 <input type='text' name='SFQ_PERTUB' maxlength='8' required='1' value= $qossettings {'SFQ_PERTUB'}>
1373 <td width='33%' align='center'><input type='submit' name='ACTION' value= $Lang ::tr{'save'} />
1378 & Header
:: closebox
();
1382 if ( $qossettings { 'VALID' } eq 'yes' ) {
1383 if ( $qossettings { 'DEVICE' } eq $qossettings { 'RED_DEV' } ) {
1384 $qossettings { 'SPD' } = $qossettings { 'OUT_SPD' };
1385 } elsif ( $qossettings { 'DEVICE' } eq $qossettings { 'IMQ_DEV' } ) {
1386 $qossettings { 'SPD' } = $qossettings { 'INC_SPD' };
1388 unless ( ( $qossettings { 'MINBWDTH' } >= 1 ) && ( $qossettings { 'MINBWDTH' } <= $qossettings { 'SPD' } ) ) {
1389 $qossettings { 'VALID' } = 'no' ;
1390 $message = "Mindestbandbreite ist ungueltig." ;
1392 $qossettings { 'SPD' } = '' ;
1397 if ( $qossettings { 'VALID' } eq 'yes' ) {
1398 if ( $qossettings { 'DEVICE' } eq $qossettings { 'RED_DEV' } ) {
1399 $qossettings { 'SPD' } = $qossettings { 'OUT_SPD' };
1400 } elsif ( $qossettings { 'DEVICE' } eq $qossettings { 'IMQ_DEV' } ) {
1401 $qossettings { 'SPD' } = $qossettings { 'INC_SPD' };
1403 unless ( ( $qossettings { 'MAXBDWTH' } >= 0 ) && ( $qossettings { 'MAXBDWTH' } >= $qossettings { 'MINBDWTH' }) &&( $qossettings { 'MAXBDWTH' } <= $qossettings { 'SPD' } ) ) {
1404 $qossettings { 'VALID' } = 'no' ;
1405 $message = "Mamimalbandbreite ist ungueltig." ;
1407 $qossettings { 'SPD' } = '' ;
1412 if ( $qossettings { 'VALID' } eq 'yes' ) {
1413 if ( $qossettings { 'DEVICE' } eq $qossettings { 'RED_DEV' } ) {
1414 if ( $qossettings { 'CLASS' } lt 100 || $qossettings { 'CLASS' } ge 121 ) {
1415 $qossettings { 'VALID' } = 'no' ;
1416 $message = "Die Klassennummer passt nicht zum angegebenen Interface." ;
1418 } elsif ( $qossettings { 'DEVICE' } eq $qossettings { 'IMQ_DEV' } ) {
1419 if ( $qossettings { 'CLASS' } lt 200 || $qossettings { 'CLASS' } ge 221 ) {
1420 $qossettings { 'VALID' } = 'no' ;
1421 $message = "Die Klassennummer passt nicht zum angegebenen Interface." ;
1424 open ( FILE
, "< $classfile " ) or die "Unable to read $classfile " ;
1427 foreach $classentry ( sort @tmp )
1429 @tmpline = split ( /\;/ , $classentry );
1430 if ( $tmpline [ 1 ] eq $qossettings { 'CLASS' } )
1432 $qossettings { 'VALID' } = 'no' ;
1433 $message = "Die aktuelle Klasse wird bereits verwendet." ;
1441 if ( $qossettings { 'VALID' } eq 'yes' ) {
1442 open ( FILE
, "< $subclassfile " ) or die "Unable to read $subclassfile " ;
1445 foreach $subclassentry ( sort @tmp )
1447 @tmpline = split ( /\;/ , $subclassentry );
1448 if ( $tmpline [ 2 ] eq $qossettings { 'SCLASS' } )
1450 $qossettings { 'VALID' } = 'no' ;
1451 $message = "Die aktuelle Klasse wird bereits verwendet." ;
1459 $qossettings { 'DEV' } = shift ;
1460 $qossettings { 'CLASS' } = shift ;
1462 if ( $qossettings { 'DEV' } eq $qossettings { 'RED_DEV' } ) {
1463 $qossettings { 'CLASSPRFX' } = '1' ;
1465 $qossettings { 'CLASSPRFX' } = '2' ;
1467 my $color = random_hex_color
( 6 );
1469 RRDs
:: graph
( "/srv/web/ipfire/html/graphs/class_ $qossettings {'CLASSPRFX'}- $qossettings {'CLASS'}_ $qossettings {'DEV'}-packets.png" ,
1470 "--start" , "-3240" , "-aPNG" , "-i" , "-z" ,
1471 "--alt-y-grid" , "-w 600" , "-h 150" , "-r" ,
1472 "--color" , "SHADEA#EAE9EE" ,
1473 "--color" , "SHADEB#EAE9EE" ,
1474 "--color" , "BACK#FFFFFF" ,
1475 "-t $qossettings {'CLASS'} ( $qossettings {'DEV'})" ,
1476 "DEF:pkts=/var/log/rrd/class_ $qossettings {'CLASSPRFX'}- $qossettings {'CLASS'}_ $qossettings {'DEV'}.rrd:pkts:AVERAGE" ,
1477 "DEF:dropped=/var/log/rrd/class_ $qossettings {'CLASSPRFX'}- $qossettings {'CLASS'}_ $qossettings {'DEV'}.rrd:dropped:AVERAGE" ,
1478 "DEF:overlimits=/var/log/rrd/class_ $qossettings {'CLASSPRFX'}- $qossettings {'CLASS'}_ $qossettings {'DEV'}.rrd:overlimits:AVERAGE" ,
1479 "AREA:pkts $color :packets" ,
1480 "GPRINT:pkts:LAST:total packets \\ : %8 .3lf %s packets \\ j" ,
1481 "LINE3:dropped#FF0000:dropped" ,
1482 "GPRINT:dropped:LAST:dropped packets \\ : %8 .3lf %s packets \\ j" ,
1483 "LINE3:overlimits#0000FF:overlimits" ,
1484 "GPRINT:overlimits:LAST:overlimits \\ : %8 .3lf %s packets \\ j" ,
1486 $ERROR = RRDs
:: error
;
1491 $qossettings { 'DEV' } = shift ;
1492 if ( $qossettings { 'DEV' } eq $qossettings { 'RED_DEV' } ) {
1493 $qossettings { 'CLASSPRFX' } = '1' ;
1495 $qossettings { 'CLASSPRFX' } = '2' ;
1499 my $color = "#000000" ;
1500 my @command =( "/srv/web/ipfire/html/graphs/qos-graph- $qossettings {'DEV'}.png" ,
1501 "--start" , "-3240" , "-aPNG" , "-i" , "-z" ,
1502 "--alt-y-grid" , "-w 600" , "-h 150" , "-r" ,
1503 "--color" , "SHADEA#EAE9EE" ,
1504 "--color" , "SHADEB#EAE9EE" ,
1505 "--color" , "BACK#FFFFFF" ,
1506 "-t Auslastung auf ( $qossettings {'DEV'})"
1508 open ( FILE
, "< $classfile " ) or die "Unable to read $classfile " ;
1511 foreach $classentry ( sort @classes )
1513 @classline = split ( /\;/ , $classentry );
1514 if ( $classline [ 0 ] eq $qossettings { 'DEV' } )
1516 $color = random_hex_color
( 6 );
1517 push ( @command , "DEF: $classline [1]=/var/log/rrd/class_ $qossettings {'CLASSPRFX'}- $classline [1]_ $qossettings {'DEV'}.rrd:bits:AVERAGE" );
1519 if ( $count eq "1" ) {
1520 push ( @command , "AREA: $classline [1] $color :Klasse $classline [1] - $classline [8] \\ j" );
1522 push ( @command , "STACK: $classline [1] $color :Klasse $classline [1] - $classline [8] \\ j" );
1527 RRDs
:: graph
( @command );
1528 $ERROR = RRDs
:: error
;
1532 sub random_hex_color
{
1534 $size = 6 if $size !~ /^3|6$/ ;
1535 my @hex = ( 0 .. 9 , 'a' .. 'f' );
1537 push @color , @hex [ rand ( @hex )] for 1 .. $size ;
1538 return join ( '' , '#' , @color );