]>
git.ipfire.org Git - people/pmueller/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' ;
263 } elsif ( $qossettings { 'DOLEVEL7' } eq 'Loeschen' )
265 open ( FILE
, "< $level7file " ) or die "Unable to read $level7file " ;
268 system ( "rm $level7file " );
269 foreach $l7ruleentry ( sort @l7rules )
271 @l7ruleline = split ( /\;/ , $l7ruleentry );
272 if ( ( $l7ruleline [ 0 ] eq $qossettings { 'CLASS' }) && ( $l7ruleline [ 2 ] eq $qossettings { 'L7PROT' }))
273 { $message = "Level7-Regel ( $qossettings {'CLASS'} - $qossettings {'L7PROT'}) wurde geloescht." ;}
275 { open ( FILE
, ">> $level7file " ) or die "Unable to read $level7file " ;
276 print FILE
$l7ruleentry ;
280 open ( FILE
, "< $level7file " ) or system ( "touch $level7file " ); close FILE
;
281 } elsif ( $qossettings { 'DOLEVEL7' } eq 'Bearbeiten' )
283 open ( FILE
, "< $level7file " ) or die "Unable to read $level7file " ;
286 system ( "rm $level7file " );
287 foreach $l7ruleentry ( sort @l7rules )
289 @l7ruleline = split ( /\;/ , $l7ruleentry );
290 if ( ( $l7ruleline [ 0 ] eq $qossettings { 'CLASS' }) && ( $l7ruleline [ 2 ] eq $qossettings { 'L7PROT' }))
291 { $qossettings { 'QIP' } = $l7ruleline [ 3 ]; $qossettings { 'DIP' } = $l7ruleline [ 4 ];}
293 open ( FILE
, ">> $level7file " ) or die "Unable to write $level7file " ;
294 print FILE
$l7ruleentry ;
299 open ( FILE
, "< $level7file " ) or system ( "touch $level7file " ); close FILE
;
302 ############################################################################################################################
303 ############################################################################################################################
305 if ( $qossettings { 'DOPORT' } eq $Lang :: tr
{ 'save' })
307 if ( $qossettings { 'QIP' } ne '' ) {
308 unless ( & General
:: validip
( $qossettings { 'QIP' }) ) {
309 $qossettings { 'VALID' } = 'no' ;
310 $message = "Die Quell-IP-Adresse ist ungueltig." ;
313 if ( $qossettings { 'DIP' } ne '' ) {
314 unless ( & General
:: validip
( $qossettings { 'DIP' }) ) {
315 $qossettings { 'VALID' } = 'no' ;
316 $message = "Die Ziel-IP-Adresse ist ungueltig." ;
319 if ( $qossettings { 'CLASS' } >= 100 && $qossettings { 'CLASS' } < 121 ) {
320 $qossettings { 'DEVICE' } = $qossettings { 'RED_DEV' };
321 } elsif ( $qossettings { 'CLASS' } >= 1000 && $qossettings { 'CLASS' } < 1021 ) {
322 $qossettings { 'DEVICE' } = $qossettings { 'RED_DEV' };
323 } elsif ( $qossettings { 'CLASS' } >= 200 && $qossettings { 'CLASS' } < 221 ) {
324 $qossettings { 'DEVICE' } = $qossettings { 'IMQ_DEV' };
325 } elsif ( $qossettings { 'CLASS' } >= 2000 && $qossettings { 'CLASS' } < 2021 ) {
326 $qossettings { 'DEVICE' } = $qossettings { 'IMQ_DEV' };
328 if ( $qossettings { 'VALID' } eq 'yes' ) {
329 open ( FILE
, ">> $portfile " ) or die "Unable to write $portfile " ;
331 $qossettings {'CLASS'}; $qossettings {'DEVICE'}; $qossettings {'PPROT'}; $qossettings {'QIP'}; $qossettings {'QPORT'}; $qossettings {'DIP'}; $qossettings {'DPORT'};
336 $qossettings { 'ACTION' } = 'Port-Regel hinzufuegen' ;
338 } elsif ( $qossettings { 'DOPORT' } eq 'Loeschen' )
340 open ( FILE
, "< $portfile " ) or die "Unable to read $portfile " ;
343 open ( FILE
, "> $portfile " ) or die "Unable to read $portfile " ;
344 foreach $portruleentry ( sort @portrules )
346 @portruleline = split ( /\;/ , $portruleentry );
347 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' }))
349 print FILE
$portruleentry ;
353 $message = "Port-Regel ( $qossettings {'CLASS'} - $qossettings {'PPROT'}) wurde geloescht." ;
354 } elsif ( $qossettings { 'DOPORT' } eq 'Bearbeiten' )
356 open ( FILE
, "< $portfile " ) or die "Unable to read $portfile " ;
359 system ( "rm $portfile " );
360 foreach $portruleentry ( sort @portrules )
362 @portruleline = split ( /\;/ , $portruleentry );
363 if ( ( $portruleline [ 0 ] eq $qossettings { 'CLASS' }) && ( $portruleline [ 2 ] eq $qossettings { 'PPROT' }) && ( $portruleline [ 3 ] eq $qossettings { 'QIP' }) && ( $portruleline [ 4 ] eq $qossettings { 'QPORT' }) && ( $portruleline [ 5 ] eq $qossettings { 'DIP' }) && ( $portruleline [ 6 ] eq $qossettings { 'DPORT' }))
364 { $qossettings { 'CLASS' }= $portruleline [ 0 ]; $qossettings { 'PPROT' }= $portruleline [ 2 ]; $qossettings { 'QIP' }= $portruleline [ 3 ]; $qossettings { 'QPORT' }= $portruleline [ 4 ]; $qossettings { 'DIP' }= $portruleline [ 5 ]; $qossettings { 'DPORT' }= $portruleline [ 6 ];}
366 open ( FILE
, ">> $portfile " ) or die "Unable to write $portfile " ;
367 print FILE
$portruleentry ;
372 open ( FILE
, "< $portfile " ) or system ( "touch $portfile " ); close FILE
;
375 ############################################################################################################################
376 ############################################################################################################################
378 if ( $qossettings { 'DOTOS' } eq $Lang :: tr
{ 'save' })
380 if ( $qossettings { 'CLASS' } >= 100 && $qossettings { 'CLASS' } < 121 ) {
381 $qossettings { 'DEVICE' } = $qossettings { 'RED_DEV' };
382 } elsif ( $qossettings { 'CLASS' } >= 1000 && $qossettings { 'CLASS' } < 1021 ) {
383 $qossettings { 'DEVICE' } = $qossettings { 'RED_DEV' };
384 } elsif ( $qossettings { 'CLASS' } >= 200 && $qossettings { 'CLASS' } < 221 ) {
385 $qossettings { 'DEVICE' } = $qossettings { 'IMQ_DEV' };
386 } elsif ( $qossettings { 'CLASS' } >= 2000 && $qossettings { 'CLASS' } < 2021 ) {
387 $qossettings { 'DEVICE' } = $qossettings { 'IMQ_DEV' };
389 open ( FILE
, ">> $tosfile " ) or die "Unable to write $tosfile " ;
391 $qossettings {'CLASS'}; $qossettings {'DEVICE'}; $qossettings {'TOS'};
396 elsif ( $qossettings { 'DOTOS' } eq 'Loeschen' )
398 open ( FILE
, "< $tosfile " ) or die "Unable to read $tosfile " ;
401 open ( FILE
, "> $tosfile " ) or die "Unable to read $tosfile " ;
402 foreach $tosruleentry ( sort @tosrules )
404 @tosruleline = split ( /\;/ , $tosruleentry );
405 unless ( ( $tosruleline [ 0 ] eq $qossettings { 'CLASS' }) && ( $tosruleline [ 2 ] eq $qossettings { 'TOS' }))
407 print FILE
$tosruleentry ;
411 $message = "TOS-Regel ( $qossettings {'CLASS'} - $qossettings {'TOS'}) wurde geloescht." ;
412 } elsif ( $qossettings { 'DOTOS' } eq 'Bearbeiten' )
414 open ( FILE
, "< $tosfile " ) or die "Unable to read $tosfile " ;
417 open ( FILE
, "> $tosfile " ) or die "Unable to write $tosfile " ;
418 foreach $tosruleentry ( sort @tosrules )
420 @tosruleline = split ( /\;/ , $tosruleentry );
421 if (( $tosruleline [ 0 ] eq $qossettings { 'CLASS' } ) && ( $tosruleline [ 2 ] eq $qossettings { 'TOS' } )) {
422 $qossettings { 'DEVICE' } = $tosruleline [ 1 ];
423 $qossettings { 'CLASS' } = $tosruleline [ 0 ];
424 $qossettings { 'TOS' } = $tosruleline [ 2 ];
425 $qossettings { 'EDIT' } = 'yes' ;
427 print FILE
$tosruleentry ;
432 & Header
:: closebigbox
();
433 & Header
:: closepage
();
437 ############################################################################################################################
438 ############################################################################################################################
440 if ( $qossettings { 'ACTION' } eq 'Start' )
442 system ( "/usr/local/bin/qosctrl generate >/dev/null 2>&1" );
443 system ( "/usr/bin/touch /var/ipfire/qos/enable" );
444 system ( "/usr/local/bin/qosctrl start >/dev/null 2>&1" );
445 system ( "logger -t ipfire 'QoS started'" );
446 $qossettings { 'ENABLED' } = 'on' ;
447 & General
:: writehash
( "${General::swroot}/qos/settings" , \
%qossettings );
449 elsif ( $qossettings { 'ACTION' } eq 'Stop' )
451 system ( "/usr/local/bin/qosctrl stop >/dev/null 2>&1" );
452 unlink "/var/ipfire/qos/bin/qos.sh" ;
453 unlink "/var/ipfire/qos/enable" ;
454 system ( "logger -t ipfire 'QoS stopped'" );
455 $qossettings { 'ENABLED' } = 'off' ;
456 & General
:: writehash
( "${General::swroot}/qos/settings" , \
%qossettings );
458 elsif ( $qossettings { 'ACTION' } eq 'Neustart' )
460 if ( $qossettings { 'ENABLED' } eq 'on' ){
461 system ( "/usr/local/bin/qosctrl stop >/dev/null 2>&1" );
462 system ( "/usr/local/bin/qosctrl generate >/dev/null 2>&1" );
463 system ( "/usr/local/bin/qosctrl start >/dev/null 2>&1" );
464 system ( "logger -t ipfire 'QoS restarted'" );
467 elsif ( $qossettings { 'ACTION' } eq $Lang :: tr
{ 'save' })
469 if ( $qossettings { 'DEF_INC_SPD' } eq '' ) {
470 $qossettings { 'DEF_INC_SPD' } = int ( $qossettings { 'INC_SPD' } * 0.9 );
472 if ( $qossettings { 'DEF_OUT_SPD' } eq '' ) {
473 $qossettings { 'DEF_OUT_SPD' } = int ( $qossettings { 'OUT_SPD' } * 0.9 );
475 & General
:: writehash
( "${General::swroot}/qos/settings" , \
%qossettings );
477 elsif ( $qossettings { 'ACTION' } eq 'Statusinformationen' )
479 & Header
:: openbox
( '100%' , 'left' , 'QoS Status' );
480 if ( $qossettings { 'ENABLED' } eq 'on' ){
482 $output = `/usr/local/bin/qosctrl status` ;
483 $output = & Header
:: cleanhtml
( $output , "y" );
484 print "<pre> $output </pre> \n " ;
485 } else { print "QoS ist nicht aktiviert!" ; }
487 & Header
:: closebigbox
();
488 & Header
:: closepage
();
491 elsif ( $qossettings { 'ACTION' } eq 'Grafische Auswertung' )
493 open ( FILE
, "< $classfile " ) or die "Unable to read $classfile " ;
496 open ( FILE
, "< $subclassfile " ) or die "Unable to read $subclassfile " ;
497 @subclasses = < FILE
>;
499 & Header
:: openbox
( '100%' , 'left' , 'QoS Graphen' );
501 <table width='100%'> <tr><td align='center'><font color='red'>Diese Seite braucht je nach Geschwindigkeit des Computers laenger zum Laden.</font>
502 <tr><td align='center'><b>Klasse:</b>
505 foreach $classentry ( sort @classes )
507 @classline = split ( /\;/ , $classentry );
508 $qossettings { 'CLASS' }= $classline [ 1 ];
510 <input type="button" onClick="swapVisibility(' $qossettings {'CLASS'}')" value=' $qossettings {'CLASS'}' />
519 foreach $classentry ( sort @classes )
521 @classline = split ( /\;/ , $classentry );
522 $qossettings { 'DEV' }= $classline [ 0 ];
523 $qossettings { 'CLASS' }= $classline [ 1 ];
524 & gengraph
( $qossettings { 'DEV' }, $qossettings { 'CLASS' });
525 print "<div id=' $qossettings {'CLASS'}' style='display: none'>" ;
526 & Header
:: openbox
( '100%' , 'center' , " $qossettings {'CLASS'} ( $qossettings {'DEV'})" );
529 <tr><td colspan='2' align='center'><img src='/graphs/class_ $qossettings {'CLASSPRFX'}- $qossettings {'CLASS'}_ $qossettings {'DEV'}-packets.png' />
530 <tr><td colspan='2' align='center'><img src='/graphs/class_ $qossettings {'CLASSPRFX'}- $qossettings {'CLASS'}_ $qossettings {'DEV'}-borrowed.png' />
531 <tr><td colspan='2' align='center'><img src='/graphs/class_ $qossettings {'CLASSPRFX'}- $qossettings {'CLASS'}_ $qossettings {'DEV'}-bytes.png' />
534 foreach $subclassentry ( sort @subclasses )
536 @subclassline = split ( /\;/ , $subclassentry );
537 if ( $subclassline [ 1 ] eq $classline [ 1 ]) {
538 $qossettings { 'DEV' }= $subclassline [ 0 ];
539 $qossettings { 'SCLASS' }= $subclassline [ 2 ];
540 & gengraph
( $qossettings { 'DEV' }, $qossettings { 'SCLASS' });
542 <tr><td colspan='2' align='center'><img src='/graphs/class_ $qossettings {'CLASSPRFX'}- $qossettings {'SCLASS'}_ $qossettings {'DEV'}-packets.png' />
543 <tr><td colspan='2' align='center'><img src='/graphs/class_ $qossettings {'CLASSPRFX'}- $qossettings {'SCLASS'}_ $qossettings {'DEV'}-borrowed.png' />
544 <tr><td colspan='2' align='center'><img src='/graphs/class_ $qossettings {'CLASSPRFX'}- $qossettings {'SCLASS'}_ $qossettings {'DEV'}-bytes.png' />
549 print " \t\t </table>" ;
557 & Header
:: closebigbox
();
558 & Header
:: closepage
();
561 elsif ( $qossettings { 'ACTION' } eq 'Parentklasse hinzufuegen' )
564 & Header
:: closebigbox
();
565 & Header
:: closepage
();
568 elsif ( $qossettings { 'ACTION' } eq 'Unterklasse hinzufuegen' )
571 & Header
:: closebigbox
();
572 & Header
:: closepage
();
575 elsif ( $qossettings { 'ACTION' } eq 'Regel hinzufuegen' )
577 & Header
:: openbox
( '100%' , 'center' , 'Regel hinzufuegen' );
580 <tr><td align='center'>Waehlen sie <u>eine</u> der untenstehenden Regeln aus.
581 <tr><td align='center'>
582 <input type="button" onClick="swapVisibility('l7rule')" value='Level7-Regel' />
583 <input type="button" onClick="swapVisibility('portrule')" value='Port-Regel' />
584 <input type="button" onClick="swapVisibility('tosrule')" value='TOS-Regel' />
590 <div id='l7rule' style='display: none'>
596 <div id='portrule' style='display: none'>
602 <div id='tosrule' style='display: none'>
610 & Header
:: closebigbox
();
611 & Header
:: closepage
();
614 elsif ( $qossettings { 'ACTION' } eq 'Erweiterte Einstellungen' )
617 & Header
:: closebigbox
();
618 & Header
:: closepage
();
621 if ( $qossettings { 'ACTIONBW' } eq 'Andern' )
624 & Header
:: closebigbox
();
625 & Header
:: closepage
();
628 if ( $qossettings { 'ACTIONDEF' } eq 'Andern' )
631 & Header
:: closebigbox
();
632 & Header
:: closepage
();
636 & General
:: readhash
( "${General::swroot}/qos/settings" , \
%qossettings );
638 my $status = $Lang :: tr
{ 'stopped' };
639 my $statuscolor = '#993333' ;
640 if ( $qossettings { 'ENABLED' } eq 'on' ) {
641 $status = $Lang :: tr
{ 'running' };
642 $statuscolor = '#339933' ;
645 if ( $netsettings { 'RED_TYPE' } ne 'PPPOE' ) {
646 $qossettings { 'RED_DEV' } = $netsettings { 'RED_DEV' };
650 & Header
:: openbox
( '100%' , 'left' , $Lang :: tr
{ 'error messages' });
651 print "<class name='base'> $errormessage \n " ;
652 print " </class> \n " ;
656 ############################################################################################################################
657 ############################################################################################################################
659 & Header
:: openbox
( '100%' , 'center' , 'Quality of Service' );
662 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
666 if ( $message ne "" ) {
667 print "<tr><td colspan='2' align='center'><font color='red'> $message </font>" ;
670 <tr><td width='50%' align='left'><b>Quality of Service:</b>
671 <td width='50%' align='center' bgcolor=' $statuscolor '><font color='white'> $status </font>
672 <tr><td width='100%' align='center' colspan='2'>
673 <input type='submit' name='ACTION' value="Start" />
674 <input type='submit' name='ACTION' value="Stop" />
675 <input type='submit' name='ACTION' value=" $Lang ::tr{'restart'}" /></table></form>
678 if (( $qossettings { 'OUT_SPD' } ne '' ) && ( $qossettings { 'INC_SPD' } ne '' )) {
680 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
682 <tr><td colspan='3'>
683 <tr><td width='40%' align='right'>Downloadgeschwindigkeit: <td width='40%' align='left'> $qossettings {'INC_SPD'} kbps
684 <td width='20%' rowspan='2' align='center' valign='middle'><input type='submit' name='ACTIONBW' value='Andern' />
685 <tr><td width='40%' align='right'>Uploadgeschwindigkeit: <td width='40%' align='left'> $qossettings {'OUT_SPD'} kbps
690 if (( $qossettings { 'DEFCLASS_OUT' } ne '' ) && ( $qossettings { 'DEFCLASS_INC' } ne '' )&& ( $qossettings { 'ACK' } ne '' )) {
692 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
694 <tr><td colspan='3'><hr />
695 <tr><td width='40%' align='right'>Downloadstandardklasse: <td width='40%' align='left'> $qossettings {'DEFCLASS_INC'}
696 <td width='20%' rowspan='3' align='center' valign='middle'><input type='submit' name='ACTIONDEF' value='Andern' />
697 <tr><td width='40%' align='right'>Uploadstandardklasse: <td width='40%' align='left'> $qossettings {'DEFCLASS_OUT'}
698 <tr><td width='40%' align='right'>ACKs: <td width='40%' align='left'> $qossettings {'ACK'}
699 <tr><td colspan='3' width='100%'><hr />
700 <tr><td colspan='3' width='100%' align='center'>
703 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
704 <table border='0' cellpadding='0' cellspacing='0'>
705 <tr><td><input type='submit' name='ACTION' value='Parentklasse hinzufuegen' />
706 <td><input type='submit' name='ACTION' value='Erweiterte Einstellungen' />
707 <tr><td><input type='submit' name='ACTION' value='Statusinformationen' />
708 <td><input type='submit' name='ACTION' value='Grafische Auswertung' />
716 if ( ( $qossettings { 'OUT_SPD' } eq '' ) || ( $qossettings { 'INC_SPD' } eq '' ) ) {
718 & Header
:: closebigbox
();
719 & Header
:: closepage
();
723 if ( ( $qossettings { 'DEFCLASS_INC' } eq '' ) || ( $qossettings { 'DEFCLASS_OUT' } eq '' ) || ( $qossettings { 'ACK' } eq '' ) ) {
725 & Header
:: closebigbox
();
726 & Header
:: closepage
();
730 & Header
:: openbox
( '100%' , 'center' , $Lang :: tr
{ 'info' });
731 & overviewgraph
( $qossettings { 'RED_DEV' });
732 & overviewgraph
( $qossettings { 'IMQ_DEV' });
735 <tr><td colspan='9' align='center' valign='middle'><img alt="" src='/images/addblue.gif' /> Unterklasse hinzufuegen | <img alt="" src='/images/addgreen.gif' /> Regel hinzufuegen | <img alt="" src='/images/edit.gif' /> Bearbeiten | <img alt="" src='/images/delete.gif' /> Loeschen
736 <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
739 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" )) {
741 <tr><td colspan='9' align='center'><img alt="" src="/graphs/qos-graph- $qossettings {'RED_DEV'}.png" />
742 <tr><td colspan='9' align='center'><img alt="" src="/graphs/qos-graph- $qossettings {'IMQ_DEV'}.png" />
749 & showclasses
( $qossettings { 'RED_DEV' });
750 & showclasses
( $qossettings { 'IMQ_DEV' });
752 & Header
:: closebigbox
();
753 & Header
:: closepage
();
755 ############################################################################################################################
756 ############################################################################################################################
758 sub changedefclasses
{
759 & Header
:: openbox
( '100%' , 'center' , 'Standardklassen:' );
761 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
763 <tr><td width='100%' colspan='3'>Legen sie hier die Standardklassen fest durch die nicht-gefilterte Pakete gehen.
764 <tr><td width='33%' align='right'>Download:<td width='33%' align='left'><select name='DEFCLASS_INC'>
767 for ( $c = 200 ; $c <= 220 ; $c ++ )
769 if ( $qossettings { 'DEFCLASS_INC' } ne $c )
770 { print "<option value=' $c '> $c </option> \n " ; }
771 else { print "<option selected value=' $c '> $c </option> \n " ; }
774 </select><td width='33%' align='center'>
775 <tr><td width='33%' align='right'>Upload:<td width='33%' align='left'><select name='DEFCLASS_OUT'>
778 for ( $c = 100 ; $c <= 120 ; $c ++ )
780 if ( $qossettings { 'DEFCLASS_OUT' } ne $c )
781 { print "<option value=' $c '> $c </option> \n " ; }
782 else { print "<option selected value=' $c '> $c </option> \n " ; }
785 </select><td width='33%' align='center'>
789 <tr><td width='100%' colspan='3'>Legen sie hier die ACK-Klasse fest <br /> und klicken Sie danach auf <i>Speichern</i>.
790 <tr><td width='33%' align='right'>ACKs:<td width='33%' align='left'><select name='ACK'>
793 for ( $c = 100 ; $c <= 120 ; $c ++ )
795 if ( $qossettings { 'ACK' } ne $c )
796 { print "<option value=' $c '> $c </option> \n " ; }
797 else { print "<option selected value=' $c '> $c </option> \n " ; }
800 </select><td width='33%' align='center'><input type='submit' name='ACTION' value=" $Lang ::tr{'save'}" />
808 sub changebandwidth
{
809 & Header
:: openbox
( '100%' , 'center' , 'Bandbreiteneinstellungen' );
810 if ( $qossettings { 'ENABLED' } eq 'on' ) {
811 print "Sie koennen die Bandbreiteneinstellungen nicht bearbeiten, wenn QoS eingeschaltet ist. Schalten sie es zuerst dazu aus.<p>" ;
812 print "<a href='/cgi-bin/qos.cgi'>Zurueck</a>" ;
815 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
816 <input type='hidden' name='DEF_OUT_SPD' value='' /><input type='hidden' name='DEF_INC_SPD' value='' />
818 <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>.
819 <tr><td width='33%' align='right'>Download-Geschwindigkeit:
820 <td width='33%' align='left'><input type='text' name='INC_SPD' maxlength='8' value=" $qossettings {'INC_SPD'}" /> kbps
821 <td width='33%' align='center'>
822 <tr><td width='33%' align='right'>Upload-Geschwindigkeit:
823 <td width='33%' align='left'><input type='text' name='OUT_SPD' maxlength='8' value=" $qossettings {'OUT_SPD'}" /> kbps
824 <td width='33%' align='center'><input type='submit' name='ACTION' value=" $Lang ::tr{'save'}" /> <input type='reset' name='ACTION' value=" $Lang ::tr{'reset'}" />
834 & Header
:: openbox
( '100%' , 'center' , 'Parentklasse' );
836 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
840 if ( $message ne "" ) {
841 print "<tr><td colspan='3' align='center'> $message " ;
843 if ( $qossettings { 'EDIT' } eq 'yes' ) {
844 print "<input type='hidden' name='CLASS' value= $qossettings {'CLASS'} />" ;
845 print "<input type='hidden' name='DEVICE' value= $qossettings {'DEVICE'} />" ;
848 <tr><td width='100%' colspan='3'>Geben sie die Daten ein <br /> und klicken Sie danach auf <i>Speichern</i>.
849 <tr><td width='33%' align='right'>Interface:
850 <td width='33%' align='left'>
853 if ( $qossettings { 'EDIT' } eq 'yes' ) {
854 print "<select name='DEVICE' disabled>" ;
856 print "<select name='DEVICE'>" ;
858 if ( $qossettings { 'DEVICE' } eq $qossettings { 'RED_DEV' } ) {
859 $qossettings { 'RED_DEV_SEL' } = 'selected' ;
860 } elsif ( $qossettings { 'DEVICE' } eq $qossettings { 'IMQ_DEV' } ) {
861 $qossettings { 'IMQ_DEV_SEL' } = 'selected' ;
864 <option value= $qossettings {'RED_DEV'} $qossettings {'RED_DEV_SEL'}> $qossettings {'RED_DEV'}</option>
865 <option value= $qossettings {'IMQ_DEV'} $qossettings {'IMQ_DEV_SEL'}> $qossettings {'IMQ_DEV'}</option></select>
866 <td width='33%' align='center'>
867 <tr><td width='33%' align='right'>Klasse:<td width='33%' align='left'>
870 if ( $qossettings { 'EDIT' } eq 'yes' ) {
871 print "<select name='CLASS' disabled>" ;
873 print "<select name='CLASS'>" ;
875 for ( $c = 100 ; $c <= 120 ; $c ++ )
877 if ( $qossettings { 'CLASS' } ne $c )
878 { print "<option value=' $c '> $c </option> \n " ; }
879 else { print "<option selected value=' $c '> $c </option> \n " ; }
881 for ( $c = 200 ; $c <= 220 ; $c ++ )
883 if ( $qossettings { 'CLASS' } ne $c )
884 { print "<option value=' $c '> $c </option> \n " ; }
885 else { print "<option selected value=' $c '> $c </option> \n " ; }
889 <td width='33%' align='center'>
890 <tr><td width='33%' align='right'>Prioritaet:<td width='33%' align='left'><select name='PRIO'>
893 for ( $c = 1 ; $c <= 7 ; $c ++ )
895 if ( $qossettings { 'PRIO' } ne $c )
896 { print "<option value=' $c '> $c </option> \n " ; }
897 else { print "<option selected value=' $c '> $c </option> \n " ; }
899 if ( $qossettings { 'MINBWDTH' } eq "" ) { $qossettings { 'MINBWDTH' } = "1" ; }
902 <td width='33%' align='center'>
903 <tr><td width='33%' align='right'>Garantierte Bandbreite:
904 <td width='33%' align='left'><input type='text' size='20' name='MINBWDTH' maxlength='8' required='1' value=" $qossettings {'MINBWDTH'}" />
905 <td width='33%' align='center'>
906 <tr><td width='33%' align='right'>Maximale Bandbreite:
907 <td width='33%' align='left'><input type='text' size='20' name='MAXBWDTH' maxlength='8' required='1' value=" $qossettings {'MAXBWDTH'}" />
908 <td width='33%' align='center'>
909 <tr><td width='33%' align='right'>Burst:
910 <td width='33%' align='left'><input type='text' size='20' name='BURST' maxlength='8' value=" $qossettings {'BURST'}" />
911 <td width='33%' align='center'>
912 <tr><td width='33%' align='right'>Ceilburst:
913 <td width='33%' align='left'><input type='text' size='20' name='CBURST' maxlength='8' value=" $qossettings {'CBURST'}" />
914 <td width='33%' align='center'>
915 <tr><td width='33%' align='right'>TOS-Bit:
916 <td width='33%' align='left'><select name='TOS'>
917 <option value='0'>Ausgeschaltet (0)</option>
918 <option value='8'>Minimale Verzoegerung (8)</option>
919 <option value='4'>Maximaler Durchsatz (4)</option>
920 <option value='2'>Maximale Zuverlaessigkeit (2)</option>
921 <option value='1'>Minimale Kosten (1)</option></select>
922 <td width='33%' align='center'>
923 <tr><td width='33%' align='right'> $Lang ::tr{'remark'}:
924 <td width='66%' colspan='2' align='left'><input type='text' name='REMARK' size='40' maxlength='40' value=" $qossettings {'REMARK'}" /> <img alt="" alt='blob' src='/blob.gif' />
925 <tr><td width='33%' align='right'>
926 <td width='33%' align='left'>
927 <td width='33%' align='center'><input type='submit' name='DOCLASS' value= $Lang ::tr{'save'} /> <input type='reset' value= $Lang ::tr{'reset'} />
935 & Header
:: openbox
( '100%' , 'center' , 'Unterklasse' );
937 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
941 if ( $message ne "" ) {
942 print "<tr><td colspan='3' align='center'> $message " ;
945 <tr><td colspan='3' width='100%'>Aktuelle Klasse: $qossettings {'CLASS'}
946 <tr><td width='100%' colspan='3'>Geben sie die Daten ein <br /> und klicken Sie danach auf <i>Speichern</i>.
947 <tr><td width='33%' align='right'>Unterklasse:<td width='33%' align='left'><select name='SCLASS'>
950 if ( $qossettings { 'CLASS' } >= 100 && $qossettings { 'CLASS' } < 121 ) {
951 $qossettings { 'DEVICE' } = $qossettings { 'RED_DEV' };
952 for ( $c = 1000 ; $c <= 1020 ; $c ++ )
954 if ( $qossettings { 'SCLASS' } ne $c )
955 { print "<option value=' $c '> $c </option> \n " ; }
956 else { print "<option selected value=' $c '> $c </option> \n " ; }
958 } elsif ( $qossettings { 'CLASS' } >= 200 && $qossettings { 'CLASS' } < 221 ) {
959 $qossettings { 'DEVICE' } = $qossettings { 'IMQ_DEV' };
960 for ( $c = 2000 ; $c <= 2020 ; $c ++ )
962 if ( $qossettings { 'SCLASS' } ne $c )
963 { print "<option value=' $c '> $c </option> \n " ; }
964 else { print "<option selected value=' $c '> $c </option> \n " ; }
969 <td width='33%' align='center'>
970 <tr><td width='33%' align='right'>Prioritaet:<td width='33%' align='left'><select name='PRIO'>
973 for ( $c = 1 ; $c <= 7 ; $c ++ )
975 if ( $qossettings { 'PRIO' } ne $c )
976 { print "<option value=' $c '> $c </option> \n " ; }
977 else { print "<option selected value=' $c '> $c </option> \n " ; }
980 <td width='33%' align='center'>
981 <tr><td width='33%' align='right'>Garantierte Bandbreite:
982 <td width='33%' align='left'><input type='text' name='MINBWDTH' maxlength='8' required='1' value=" $qossettings {'MINBWDTH'}" />
983 <td width='33%' align='center'>
984 <tr><td width='33%' align='right'>Maximale Bandbreite:
985 <td width='33%' align='left'><input type='text' name='MAXBWDTH' maxlength='8' required='1' value=" $qossettings {'MAXBWDTH'}" />
986 <td width='33%' align='center'>
987 <tr><td width='33%' align='right'>Burst:
988 <td width='33%' align='left'><input type='text' name='BURST' maxlength='8' value=" $qossettings {'BURST'}" />
989 <td width='33%' align='center'>
990 <tr><td width='33%' align='right'>Ceilburst:
991 <td width='33%' align='left'><input type='text' name='CBURST' maxlength='8' value=" $qossettings {'CBURST'}" />
992 <td width='33%' align='center'>
993 <tr><td width='33%' align='right'>TOS-Bit:
994 <td width='33%' align='left'><select name='TOS'>
995 <option value='0'>Ausgeschaltet (0)</option>
996 <option value='8'>Minimale Verzoegerung (8)</option>
997 <option value='4'>Maximaler Durchsatz (4)</option>
998 <option value='2'>Maximale Zuverlaessigkeit (2)</option>
999 <option value='1'>Minimale Kosten (1)</option></select>
1000 <td width='33%' align='center'><input type='hidden' name='CLASS' value=" $qossettings {'CLASS'}" />
1001 <input type='hidden' name='DEVICE' value=" $qossettings {'DEVICE'}" />
1002 <input type='submit' name='DOSCLASS' value= $Lang ::tr{'save'} /> <input type='reset' value= $Lang ::tr{'reset'} />
1006 & Header
:: closebox
();
1010 & Header
:: openbox
( '100%' , 'center' , 'Level7-Regel' );
1012 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1016 if ( $message ne "" ) {
1017 print "<tr><td colspan='3' align='center'><font color='red'> $message </font>" ;
1020 <tr><td colspan='3' width='100%'>Aktuelle Klasse: $qossettings {'CLASS'}
1021 <tr><td width='100%' colspan='3'>Geben sie die Daten ein <br /> und klicken Sie danach auf <i>Speichern</i>.
1022 <tr><td width='33%' align='right'>Protokoll:
1023 <td width='33%' align='left'><select name='L7PROT'>
1026 opendir ( DIR
, "/etc/l7-protocols/protocols" );
1027 foreach $direntry ( sort readdir ( DIR
) )
1029 next if $direntry eq "." ;
1030 next if $direntry eq ".." ;
1031 next if - d
"/etc/l7-protocols/protocols/ $direntry " ;
1032 @proto = split ( /\./ , $direntry );
1033 if ( $proto [ 0 ] eq $qossettings { 'L7PROT' } ) {
1034 print "<option value=' $proto [0]' selected> $proto [0]</option> \n " ;
1036 print "<option value=' $proto [0]'> $proto [0]</option> \n " ;
1041 </select><td width='33%' align='center'>
1042 <tr><td width='33%' align='right'>Quell-IP-Adresse:
1043 <td width='33%' align='left'><input type='text' name='QIP' maxlength='15' value= $qossettings {'QIP'} />
1044 <td width='33%' align='center'>
1045 <tr><td width='33%' align='right'>Ziel-IP-Adresse:
1046 <td width='33%' align='left'><input type='text' name='DIP' maxlength='15' value= $qossettings {'DIP'} />
1047 <td width='33%' align='center'><input type='hidden' name='CLASS' value= $qossettings {'CLASS'} /><input type='submit' name='DOLEVEL7' value= $Lang ::tr{'save'} />
1051 & Header
:: closebox
();
1055 & Header
:: openbox
( '100%' , 'center' , 'Port-Regel hinzufuegen' );
1057 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1059 <tr><td width='100%' colspan='3'>Geben sie die Daten ein <br /> und klicken Sie danach auf <i>Speichern</i>.
1060 <tr><td width='33%' align='right'>Protokoll:
1061 <td width='33%' align='left'><select name='PPROT'>
1064 open ( FILE
, "< /etc/protocols" );
1067 foreach $direntry ( sort @proto )
1069 @tmpline = split ( /\ / , $direntry );
1070 next if $tmpline [ 0 ] =~ "#" ;
1071 if ( $tmpline [ 0 ] eq $qossettings { 'PPROT' } ) {
1072 print "<option value=' $tmpline [0]' selected> $tmpline [0]</option> \n " ;
1074 print "<option value=' $tmpline [0]'> $tmpline [0]</option> \n " ;
1078 </select><td width='33%' align='center'>
1079 <tr><td width='33%' align='right'>Quell-Port:
1080 <td width='33%' align='left'><input type='text' name='QPORT' maxlength='5' value= $qossettings {'QPORT'} />
1081 <td width='33%' align='center'>
1082 <tr><td width='33%' align='right'>Ziel-Port:
1083 <td width='33%' align='left'><input type='text' name='DPORT' maxlength='5' value= $qossettings {'DPORT'} />
1084 <td width='33%' align='center'>
1085 <tr><td width='33%' align='right'>Quell-IP-Adresse:
1086 <td width='33%' align='left'><input type='text' name='QIP' maxlength='15' value= $qossettings {'QIP'} />
1087 <td width='33%' align='center'>
1088 <tr><td width='33%' align='right'>Ziel-IP-Adresse:
1089 <td width='33%' align='left'><input type='text' name='DIP' maxlength='15' value= $qossettings {'DIP'} />
1090 <td width='33%' align='center'><input type='hidden' name='CLASS' value=' $qossettings {'CLASS'}' /><input type='submit' name='DOPORT' value= $Lang ::tr{'save'} />
1094 & Header
:: closebox
();
1098 & Header
:: openbox
( '100%' , 'center' , 'TOS-Regel' );
1099 if ( $qossettings { 'TOS' }) {
1100 $checked [ $qossettings { 'TOS' }] = "checked" ;
1103 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1107 if ( $message ne "" ) {
1108 print "<tr><td colspan='3' align='center'><font color='red'> $message </font>" ;
1111 <tr><td colspan='2' width='100%'>Aktuelle Klasse: $qossettings {'CLASS'}
1112 <tr><td width='100%' colspan='2'>Aktivieren oder deaktivieren sie die TOS-Bits <br /> und klicken Sie danach auf <i>Speichern</i>.
1113 <tr><td width='50%' align='left'>Minimale Verzoegerung (8) <td width='50%'><input type="radio" name="TOS" value="8" $checked [8] />
1114 <tr><td width='50%' align='left'>Maximaler Durchsatz (4) <td width='50%'><input type="radio" name="TOS" value="4" $checked [4] />
1115 <tr><td width='50%' align='left'>Maximale Zuverlaessigkeit (2) <td width='50%'><input type="radio" name="TOS" value="2" $checked [2] />
1116 <tr><td width='50%' align='left'>Minimale Kosten (1) <td width='50%'><input type="radio" name="TOS" value="1" $checked [1] />
1117 <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'} />
1121 & Header
:: closebox
();
1125 $qossettings { 'DEV' } = shift ;
1126 open ( FILE
, "< $classfile " ) or die "Unable to read $classfile " ;
1130 open ( FILE
, "< $subclassfile " ) or die "Unable to read $subclassfile " ;
1131 @subclasses = < FILE
>;
1133 open ( FILE
, "< $level7file " ) or die "Unable to read $level7file " ;
1136 open ( FILE
, "< $tosfile " ) or die "Unable to read $tosfile " ;
1139 open ( FILE
, "< $portfile " ) or die "Unable to read $portfile " ;
1140 @portrules = < FILE
>;
1142 foreach $classentry ( sort @classes )
1144 @classline = split ( /\;/ , $classentry );
1145 if ( $classline [ 0 ] eq $qossettings { 'DEV' } )
1147 gengraph
( $qossettings { 'DEV' }, $classline [ 1 ]);
1148 & Header
:: openbox
( '100%' , 'center' , "Klasse: $classline [1]" );
1150 <table border='0' width='100%' cellspacing='0'>
1151 <tr><td bgcolor=' $color {'color20'}' width='10%' align='center'><b> $Lang ::tr{'interface'}</b>
1152 <td bgcolor=' $color {'color20'}' width='10%' align='center'><b>Klasse</b>
1153 <td bgcolor=' $color {'color20'}' width='10%' align='center'>Prioritaet
1154 <td bgcolor=' $color {'color20'}' width='10%' align='center'>Garantierte Bandbreite
1155 <td bgcolor=' $color {'color20'}' width='10%' align='center'>Maximale Bandbreite
1156 <td bgcolor=' $color {'color20'}' width='10%' align='center'>Burst
1157 <td bgcolor=' $color {'color20'}' width='10%' align='center'>Ceil Burst
1158 <td bgcolor=' $color {'color20'}' width='10%' align='center'>TOS
1159 <td bgcolor=' $color {'color20'}' width='20%' align='center'>Aktionen
1160 <tr><td align='center' bgcolor=' $color {'color22'}'> $classline [0]</td>
1161 <td align='center' bgcolor=' $color {'color22'}'> $classline [1]</td>
1162 <td align='center' bgcolor=' $color {'color22'}'> $classline [2]</td>
1163 <td align='center' bgcolor=' $color {'color22'}'> $classline [3]</td>
1164 <td align='center' bgcolor=' $color {'color22'}'> $classline [4]</td>
1165 <td align='center' bgcolor=' $color {'color22'}'> $classline [5]</td>
1166 <td align='center' bgcolor=' $color {'color22'}'> $classline [6]</td>
1167 <td align='center' bgcolor=' $color {'color22'}'> $classline [7]</td>
1168 <td align='right' bgcolor=' $color {'color22'}'>
1169 <table border='0'><tr>
1170 <td><form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1171 <input type='hidden' name='CLASS' value=' $classline [1]' />
1172 <input type='hidden' name='ACTION' value='Unterklasse hinzufuegen' />
1173 <input type='image' alt='Unterklasse hinzufuegen' src='/images/addblue.gif' />
1175 <td><form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1176 <input type='hidden' name='CLASS' value=' $classline [1]' />
1177 <input type='hidden' name='ACTION' value='Regel hinzufuegen' />
1178 <input type='image' alt='Regel hinzufuegen' src='/images/addgreen.gif' />
1180 <td><form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1181 <input type='hidden' name='CLASS' value=' $classline [1]' />
1182 <input type='hidden' name='DOCLASS' value='Bearbeiten' />
1183 <input type='image' alt='Bearbeiten' src='/images/edit.gif' />
1185 <td><form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1186 <input type='hidden' name='CLASS' value=' $classline [1]' />
1187 <input type='hidden' name='DOCLASS' value='Loeschen' />
1188 <input type='image' alt='Loeschen' src='/images/delete.gif' />
1192 <tr><td align='right' colspan='2'><b> $Lang ::tr{'remark'}:</b>
1193 <td align='center' colspan='6'> $classline [8]
1194 <td align='right'><b>Queueing:</b> $classline [9]
1199 foreach $l7ruleentry ( sort @l7rules )
1201 @l7ruleline = split ( /\;/ , $l7ruleentry );
1202 if ( $l7ruleline [ 0 ] eq $classline [ 1 ] )
1205 <tr><td align='right' colspan='2'><b>Level7-Protokoll:</b>
1206 <td align='center' colspan='6'> $l7ruleline [2]
1208 <table border='0'><tr>
1209 <td><form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1210 <input type='hidden' name='CLASS' value=' $l7ruleline [0]' />
1211 <input type='hidden' name='L7PROT' value=' $l7ruleline [2]' />
1212 <input type='hidden' name='DOLEVEL7' value='Bearbeiten' />
1213 <input type='image' alt='Bearbeiten' src='/images/edit.gif' />
1215 <td><form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1216 <input type='hidden' name='CLASS' value=' $l7ruleline [0]' />
1217 <input type='hidden' name='L7PROT' value=' $l7ruleline [2]' />
1218 <input type='hidden' name='DOLEVEL7' value='Loeschen' />
1219 <input type='image' alt='Loeschen' src='/images/delete.gif' />
1224 if (( $l7ruleline [ 3 ] ne "" ) || ( $l7ruleline [ 4 ] ne "" )){
1226 <tr><td align='center'>
1227 <td align='right' colspan='3'><b>Quell-IP:</b> $l7ruleline [3]
1228 <td align='right' colspan='3'><b>Ziel-IP:</b> $l7ruleline [4]
1242 foreach $portruleentry ( sort @portrules )
1244 @portruleline = split ( /\;/ , $portruleentry );
1245 if ( $portruleline [ 0 ] eq $classline [ 1 ] )
1248 <tr><td align='right' colspan='2'><b>Port-Regel:</b>
1249 <td align='center'>( $portruleline [2])
1250 <td align='center' colspan='2'>
1253 if ( $portruleline [ 4 ]) {
1255 <i>Quell-Port:</i> $portruleline [4]
1259 print "<td align='center' colspan='2'>" ;
1260 if ( $portruleline [ 6 ]) {
1262 <i>Ziel-Port:</i> $portruleline [6]
1269 <table border='0'><tr>
1270 <td><form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1271 <input type='hidden' name='CLASS' value=' $portruleline [0]' />
1272 <input type='hidden' name='PPROT' value=' $portruleline [2]' />
1273 <input type='hidden' name='QIP' value=' $portruleline [3]' />
1274 <input type='hidden' name='QPORT' value=' $portruleline [4]' />
1275 <input type='hidden' name='DIP' value=' $portruleline [5]' />
1276 <input type='hidden' name='DPORT' value=' $portruleline [6]' />
1277 <input type='hidden' name='DOPORT' value='Bearbeiten' />
1278 <input type='image' alt='Bearbeiten' src='/images/edit.gif' />
1280 <td><form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1281 <input type='hidden' name='CLASS' value=' $portruleline [0]' />
1282 <input type='hidden' name='PPROT' value=' $portruleline [2]' />
1283 <input type='hidden' name='QIP' value=' $portruleline [3]' />
1284 <input type='hidden' name='QPORT' value=' $portruleline [4]' />
1285 <input type='hidden' name='DIP' value=' $portruleline [5]' />
1286 <input type='hidden' name='DPORT' value=' $portruleline [6]' />
1287 <input type='hidden' name='DOPORT' value='Loeschen' />
1288 <input type='image' alt='Loeschen' src='/images/delete.gif' />
1293 if (( $portruleline [ 3 ] ne "" ) || ( $portruleline [ 5 ] ne "" )){
1295 <tr><td align='center'>
1296 <td align='right' colspan='3'><b>Quell-IP:</b> $portruleline [3]
1297 <td align='right' colspan='3'><b>Ziel-IP:</b> $portruleline [5]
1306 foreach $tosruleentry ( sort @tosrules )
1308 @tosruleline = split ( /\;/ , $tosruleentry );
1309 if ( $tosruleline [ 0 ] eq $classline [ 1 ] )
1312 <tr><td align='right' colspan='2'>
1313 <b>TOS Bit matches:</b>
1314 <td colspan='6' align='center'>
1317 if ( $tosruleline [ 2 ] eq "8" ) {
1318 print "Minimale Verzoegerung \n " ;
1319 } elsif ( $tosruleline [ 2 ] eq "4" ) {
1320 print "Maximaler Durchsatz \n " ;
1321 } elsif ( $tosruleline [ 2 ] eq "2" ) {
1322 print "Maximaler Durchsatz \n " ;
1323 } elsif ( $tosruleline [ 2 ] eq "1" ) {
1324 print "Minimale Kosten \n " ;
1325 } else { print " \n " ; }
1330 <table border='0'><tr>
1331 <td><form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1332 <input type='hidden' name='CLASS' value=' $tosruleline [0]' />
1333 <input type='hidden' name='DEV' value=' $tosruleline [1]' />
1334 <input type='hidden' name='TOS' value=' $tosruleline [2]' />
1335 <input type='hidden' name='DOTOS' value='Bearbeiten' />
1336 <input type='image' alt='Bearbeiten' src='/images/edit.gif' />
1338 <td><form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1339 <input type='hidden' name='CLASS' value=' $tosruleline [0]' />
1340 <input type='hidden' name='DEV' value=' $tosruleline [1]' />
1341 <input type='hidden' name='TOS' value=' $tosruleline [2]' />
1342 <input type='hidden' name='DOTOS' value='Loeschen' />
1343 <input type='image' alt='Loeschen' src='/images/delete.gif' />
1352 if ( - e
"/srv/web/ipfire/html/graphs/class_ $qossettings {'CLASSPRFX'}- $qossettings {'CLASS'}_ $qossettings {'DEV'}-packets.png" ) {
1354 <tr><td colspan='9' align='center'><img alt="" src='/graphs/class_ $qossettings {'CLASSPRFX'}- $qossettings {'CLASS'}_ $qossettings {'DEV'}-packets.png' />
1360 foreach $subclassentry ( sort @subclasses )
1362 @subclassline = split ( /\;/ , $subclassentry );
1363 if ( $subclassline [ 1 ] eq $classline [ 1 ] ) {
1365 <tr><td align='center' bgcolor='#FAFAFA'>Subklasse:
1366 <td align='center' bgcolor='#FAFAFA'> $subclassline [2]
1367 <td align='center' bgcolor='#FAFAFA'> $subclassline [3]
1368 <td align='center' bgcolor='#FAFAFA'> $subclassline [4]
1369 <td align='center' bgcolor='#FAFAFA'> $subclassline [5]
1370 <td align='center' bgcolor='#FAFAFA'> $subclassline [6]
1371 <td align='center' bgcolor='#FAFAFA'> $subclassline [7]
1372 <td align='center' bgcolor='#FAFAFA'> $subclassline [8]
1373 <td align='right' bgcolor='#FAFAFA'>
1374 <table border='0'><tr>
1375 <td><form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1376 <input type='hidden' name='CLASS' value=' $subclassline [2]' />
1377 <input type='hidden' name='ACTION' value='Regel hinzufuegen' />
1378 <input type='image' alt='Regel hinzufuegen' src='/images/addgreen.gif' />
1380 <td><form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1381 <input type='hidden' name='CLASS' value=' $subclassline [2]' />
1382 <input type='hidden' name='DOSCLASS' value='Bearbeiten' />
1383 <input type='image' alt='Bearbeiten' src='/images/edit.gif' />
1385 <td><form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1386 <input type='hidden' name='CLASS' value=' $subclassline [2]' />
1387 <input type='hidden' name='DOSCLASS' value='Loeschen' />
1388 <input type='image' alt='Loeschen' src='/images/delete.gif' />
1399 & Header
:: closebox
();
1407 & Header
:: openbox
( '100%' , 'center' , 'Expertenoptionen:' );
1409 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1411 <tr><td width='33%' align='right'>MTU:<td width='33%' align='left'>
1412 <input type='text' name='MTU' maxlength='8' required='4' value= $qossettings {'MTU'} />
1413 <td width='33%' align='center'>Diese Einstellung aendert die MTU nicht global sondern nur fuer das QoS.
1414 <tr><td width='33%' align='right'>Queue Laenge:<td width='33%' align='left'>
1415 <input type='text' name='QLENGTH' maxlength='8' required='2' value= $qossettings {'QLENGTH'} />
1416 <td width='33%' align='center'>
1417 <tr><td width='33%' align='right'>SFQ Perturb:<td width='33%' align='left'>
1418 <input type='text' name='SFQ_PERTUB' maxlength='8' required='1' value= $qossettings {'SFQ_PERTUB'} />
1419 <td width='33%' align='center'><input type='submit' name='ACTION' value= $Lang ::tr{'save'} />
1424 & Header
:: closebox
();
1428 if ( $qossettings { 'VALID' } eq 'yes' ) {
1429 if ( $qossettings { 'DEVICE' } eq $qossettings { 'RED_DEV' } ) {
1430 $qossettings { 'SPD' } = $qossettings { 'OUT_SPD' };
1431 } elsif ( $qossettings { 'DEVICE' } eq $qossettings { 'IMQ_DEV' } ) {
1432 $qossettings { 'SPD' } = $qossettings { 'INC_SPD' };
1434 unless ( ( $qossettings { 'MINBWDTH' } >= 1 ) && ( $qossettings { 'MINBWDTH' } <= $qossettings { 'SPD' } ) ) {
1435 $qossettings { 'VALID' } = 'no' ;
1436 $message = "Mindestbandbreite ist ungueltig." ;
1438 $qossettings { 'SPD' } = '' ;
1443 if ( $qossettings { 'VALID' } eq 'yes' ) {
1444 if ( $qossettings { 'DEVICE' } eq $qossettings { 'RED_DEV' } ) {
1445 $qossettings { 'SPD' } = $qossettings { 'OUT_SPD' };
1446 } elsif ( $qossettings { 'DEVICE' } eq $qossettings { 'IMQ_DEV' } ) {
1447 $qossettings { 'SPD' } = $qossettings { 'INC_SPD' };
1449 unless ( ( $qossettings { 'MAXBDWTH' } >= 0 ) && ( $qossettings { 'MAXBDWTH' } >= $qossettings { 'MINBDWTH' }) &&( $qossettings { 'MAXBDWTH' } <= $qossettings { 'SPD' } ) ) {
1450 $qossettings { 'VALID' } = 'no' ;
1451 $message = "Mamimalbandbreite ist ungueltig." ;
1453 $qossettings { 'SPD' } = '' ;
1458 if ( $qossettings { 'VALID' } eq 'yes' ) {
1459 if ( $qossettings { 'DEVICE' } eq $qossettings { 'RED_DEV' } ) {
1460 if ( $qossettings { 'CLASS' } lt 100 || $qossettings { 'CLASS' } ge 121 ) {
1461 $qossettings { 'VALID' } = 'no' ;
1462 $message = "Die Klassennummer passt nicht zum angegebenen Interface." ;
1464 } elsif ( $qossettings { 'DEVICE' } eq $qossettings { 'IMQ_DEV' } ) {
1465 if ( $qossettings { 'CLASS' } lt 200 || $qossettings { 'CLASS' } ge 221 ) {
1466 $qossettings { 'VALID' } = 'no' ;
1467 $message = "Die Klassennummer passt nicht zum angegebenen Interface." ;
1470 open ( FILE
, "< $classfile " ) or die "Unable to read $classfile " ;
1473 foreach $classentry ( sort @tmp )
1475 @tmpline = split ( /\;/ , $classentry );
1476 if ( $tmpline [ 1 ] eq $qossettings { 'CLASS' } )
1478 $qossettings { 'VALID' } = 'no' ;
1479 $message = "Die aktuelle Klasse wird bereits verwendet." ;
1487 if ( $qossettings { 'VALID' } eq 'yes' ) {
1488 open ( FILE
, "< $subclassfile " ) or die "Unable to read $subclassfile " ;
1491 foreach $subclassentry ( sort @tmp )
1493 @tmpline = split ( /\;/ , $subclassentry );
1494 if ( $tmpline [ 2 ] eq $qossettings { 'SCLASS' } )
1496 $qossettings { 'VALID' } = 'no' ;
1497 $message = "Die aktuelle Klasse wird bereits verwendet." ;
1505 $qossettings { 'DEV' } = shift ;
1506 $qossettings { 'CLASS' } = shift ;
1508 if ( $qossettings { 'DEV' } eq $qossettings { 'RED_DEV' } ) {
1509 $qossettings { 'CLASSPRFX' } = '1' ;
1511 $qossettings { 'CLASSPRFX' } = '2' ;
1513 my $color = random_hex_color
( 6 );
1515 RRDs
:: graph
( "/srv/web/ipfire/html/graphs/class_ $qossettings {'CLASSPRFX'}- $qossettings {'CLASS'}_ $qossettings {'DEV'}-packets.png" ,
1516 "--start" , "-3240" , "-aPNG" , "-i" , "-z" ,
1517 "--alt-y-grid" , "-w 600" , "-h 150" , "-r" ,
1518 "--color" , "SHADEA#EAE9EE" ,
1519 "--color" , "SHADEB#EAE9EE" ,
1520 "--color" , "BACK#FFFFFF" ,
1521 "-t $qossettings {'CLASS'} ( $qossettings {'DEV'})" ,
1522 "DEF:pkts=/var/log/rrd/class_ $qossettings {'CLASSPRFX'}- $qossettings {'CLASS'}_ $qossettings {'DEV'}.rrd:pkts:AVERAGE" ,
1523 "DEF:dropped=/var/log/rrd/class_ $qossettings {'CLASSPRFX'}- $qossettings {'CLASS'}_ $qossettings {'DEV'}.rrd:dropped:AVERAGE" ,
1524 "DEF:overlimits=/var/log/rrd/class_ $qossettings {'CLASSPRFX'}- $qossettings {'CLASS'}_ $qossettings {'DEV'}.rrd:overlimits:AVERAGE" ,
1525 "AREA:pkts $color :packets" ,
1526 "GPRINT:pkts:LAST:total packets \\ : %8 .3lf %s packets \\ j" ,
1527 "LINE3:dropped#FF0000:dropped" ,
1528 "GPRINT:dropped:LAST:dropped packets \\ : %8 .3lf %s packets \\ j" ,
1529 "LINE3:overlimits#0000FF:overlimits" ,
1530 "GPRINT:overlimits:LAST:overlimits \\ : %8 .3lf %s packets \\ j" ,
1532 $ERROR = RRDs
:: error
;
1537 $qossettings { 'DEV' } = shift ;
1538 if ( $qossettings { 'DEV' } eq $qossettings { 'RED_DEV' } ) {
1539 $qossettings { 'CLASSPRFX' } = '1' ;
1541 $qossettings { 'CLASSPRFX' } = '2' ;
1545 my $color = "#000000" ;
1546 my @command =( "/srv/web/ipfire/html/graphs/qos-graph- $qossettings {'DEV'}.png" ,
1547 "--start" , "-3240" , "-aPNG" , "-i" , "-z" ,
1548 "--alt-y-grid" , "-w 600" , "-h 150" , "-r" ,
1549 "--color" , "SHADEA#EAE9EE" ,
1550 "--color" , "SHADEB#EAE9EE" ,
1551 "--color" , "BACK#FFFFFF" ,
1552 "-t Auslastung auf ( $qossettings {'DEV'})"
1554 open ( FILE
, "< $classfile " ) or die "Unable to read $classfile " ;
1557 foreach $classentry ( sort @classes )
1559 @classline = split ( /\;/ , $classentry );
1560 if ( $classline [ 0 ] eq $qossettings { 'DEV' } )
1562 $color = random_hex_color
( 6 );
1563 push ( @command , "DEF: $classline [1]=/var/log/rrd/class_ $qossettings {'CLASSPRFX'}- $classline [1]_ $qossettings {'DEV'}.rrd:bits:AVERAGE" );
1565 if ( $count eq "1" ) {
1566 push ( @command , "AREA: $classline [1] $color :Klasse $classline [1] - $classline [8] \\ j" );
1568 push ( @command , "STACK: $classline [1] $color :Klasse $classline [1] - $classline [8] \\ j" );
1573 RRDs
:: graph
( @command );
1574 $ERROR = RRDs
:: error
;
1578 sub random_hex_color
{
1580 $size = 6 if $size !~ /^3|6$/ ;
1581 my @hex = ( 0 .. 9 , 'a' .. 'f' );
1583 push @color , @hex [ rand ( @hex )] for 1 .. $size ;
1584 return join ( '' , '#' , @color );