]>
git.ipfire.org Git - people/teissler/ipfire-2.x.git/blob - html/cgi-bin/qos.cgi
5 # This code is distributed under the terms of the GPL
12 # enable only the following on debugging purpose
14 use CGI
:: Carp
'fatalsToBrowser' ;
16 require '/var/ipfire/general-functions.pl' ;
17 require "${General::swroot}/lang.pl" ;
18 require "${General::swroot}/header.pl" ;
24 my $errormessage = "" ;
28 my $subclassentry = "" ;
30 my $portruleentry = "" ;
31 my $tosruleentry = "" ;
40 my @subclassline = ();
42 my @portruleline = ();
47 my $classfile = "/var/ipfire/qos/classes" ;
48 my $subclassfile = "/var/ipfire/qos/subclasses" ;
49 my $level7file = "/var/ipfire/qos/level7config" ;
50 my $portfile = "/var/ipfire/qos/portconfig" ;
51 my $tosfile = "/var/ipfire/qos/tosconfig" ;
52 & General
:: readhash
( "${General::swroot}/ethernet/settings" , \
%netsettings );
54 & Header
:: showhttpheaders
();
56 $qossettings { 'ENABLED' } = 'off' ;
57 $qossettings { 'EDIT' } = 'no' ;
58 $qossettings { 'OUT_SPD' } = '' ;
59 $qossettings { 'INC_SPD' } = '' ;
60 $qossettings { 'DEF_OUT_SPD' } = '' ;
61 $qossettings { 'DEF_INC_SPD' } = '' ;
62 $qossettings { 'DEFCLASS_INC' } = '' ;
63 $qossettings { 'DEFCLASS_OUT' } = '' ;
64 $qossettings { 'ACK' } = '' ;
65 $qossettings { 'MTU' } = '1492' ;
66 $qossettings { 'SFQ_PERTUB' } = '10' ;
67 $qossettings { 'QLENGTH' } = '30' ;
68 $qossettings { 'RED_DEV' } = `cat /var/ipfire/red/iface` ;
69 $qossettings { 'IMQ_DEV' } = 'imq0' ;
70 $qossettings { 'VALID' } = 'yes' ;
71 ### Values that have to be initialized
72 $qossettings { 'ACTION' } = '' ;
73 $qossettings { 'ACTIONDEF' } = '' ;
74 $qossettings { 'ACTIONBW' } = '' ;
75 $qossettings { 'RED_DEV_SEL' } = '' ;
76 $qossettings { 'IMQ_DEV_SEL' } = '' ;
77 $qossettings { 'PRIO' } = '' ;
78 $qossettings { 'SPD' } = '' ;
79 $qossettings { 'CLASS' } = '' ;
80 $qossettings { 'SCLASS' } = '' ;
81 $qossettings { 'QPORT' } = '' ;
82 $qossettings { 'DPORT' } = '' ;
83 $qossettings { 'QIP' } = '' ;
84 $qossettings { 'DIP' } = '' ;
85 $qossettings { 'PPROT' } = '' ;
86 $qossettings { 'L7PROT' } = '' ;
87 $qossettings { 'DEVICE' } = '' ;
88 $qossettings { 'MINBWDTH' } = '' ;
89 $qossettings { 'MAXBWDTH' } = '' ;
90 $qossettings { 'BURST' } = '' ;
91 $qossettings { 'CBURST' } = '' ;
92 $qossettings { 'DOCLASS' } = '' ;
93 $qossettings { 'DOSCLASS' } = '' ;
94 $qossettings { 'DOLEVEL7' } = '' ;
95 $qossettings { 'DOPORT' } = '' ;
96 $qossettings { 'CLASS' } = '' ;
97 $qossettings { 'CLASSPRFX' } = '' ;
98 $qossettings { 'DEV' } = '' ;
99 $qossettings { 'TOS' } = '' ;
102 & General
:: readhash
( "${General::swroot}/qos/settings" , \
%qossettings );
103 & Header
:: getcgihash
( \
%qossettings );
106 my %mainsettings = ();
107 & General
:: readhash
( "${General::swroot}/main/settings" , \
%mainsettings );
108 & General
:: readhash
( "/srv/web/ipfire/html/themes/" . $mainsettings { 'THEME' }. "/include/colors.txt" , \
%color );
110 & Header
:: openpage
( 'QoS' , 1 , '' );
111 & Header
:: openbigbox
( '100%' , 'left' , '' , $errormessage );
113 ############################################################################################################################
114 ############################################################################################################################
116 if ( $qossettings { 'DOCLASS' } eq $Lang :: tr
{ 'save' })
121 if ( $qossettings { 'VALID' } eq 'yes' ) {
122 open ( FILE
, ">> $classfile " ) or die "Unable to write $classfile " ;
124 $qossettings {'DEVICE'}; $qossettings {'CLASS'}; $qossettings {'PRIO'}; $qossettings {'MINBWDTH'}; $qossettings {'MAXBWDTH'}; $qossettings {'BURST'}; $qossettings {'CBURST'}; $qossettings {'TOS'}; $qossettings {'REMARK'};
129 $qossettings { 'ACTION' } = 'Parentklasse hinzufuegen' ;
132 elsif ( $qossettings { 'DOCLASS' } eq 'Bearbeiten' )
134 open ( FILE
, "< $classfile " ) or die "Unable to read $classfile " ;
137 open ( FILE
, "> $classfile " ) or die "Unable to write $classfile " ;
138 foreach $classentry ( sort @classes )
140 @classline = split ( /\;/ , $classentry );
141 if ( $classline [ 1 ] ne $qossettings { 'CLASS' } ) {
142 print FILE
$classentry ;
144 $qossettings { 'DEVICE' } = $classline [ 0 ];
145 $qossettings { 'PRIO' } = $classline [ 2 ];
146 $qossettings { 'MINBWDTH' } = $classline [ 3 ];
147 $qossettings { 'MAXBWDTH' } = $classline [ 4 ];
148 $qossettings { 'BURST' } = $classline [ 5 ];
149 $qossettings { 'CBURST' } = $classline [ 6 ];
150 $qossettings { 'TOS' } = $classline [ 7 ];
151 $qossettings { 'REMARK' } = $classline [ 8 ];
152 $qossettings { 'EDIT' } = 'yes' ;
157 & Header
:: closebigbox
();
158 & Header
:: closepage
();
161 elsif ( $qossettings { 'DOCLASS' } eq 'Loeschen' )
163 open ( FILE
, "< $classfile " ) or die "Unable to read $classfile " ;
166 open ( FILE
, "> $classfile " ) or die "Unable to write $classfile " ;
167 foreach $classentry ( sort @tmp )
169 @tmpline = split ( /\;/ , $classentry );
170 if ( $tmpline [ 1 ] ne $qossettings { 'CLASS' } )
172 print FILE
$classentry ;
176 open ( FILE
, "< $subclassfile " ) or die "Unable to read $classfile " ;
179 open ( FILE
, "> $subclassfile " ) or die "Unable to write $classfile " ;
180 foreach $subclassentry ( sort @tmp )
182 @tmpline = split ( /\;/ , $subclassentry );
183 if ( $tmpline [ 1 ] ne $qossettings { 'CLASS' } )
185 print FILE
$subclassentry ;
189 $message = "Klasse $qossettings {'CLASS'} wurde mit eventuell vorhandenen Unterklassen geloescht." ;
192 ############################################################################################################################
193 ############################################################################################################################
195 if ( $qossettings { 'DOSCLASS' } eq $Lang :: tr
{ 'save' })
199 if ( $qossettings { 'VALID' } eq 'yes' ) {
200 open ( FILE
, ">> $subclassfile " ) or die "Unable to write $subclassfile " ;
202 $qossettings {'DEVICE'}; $qossettings {'CLASS'}; $qossettings {'SCLASS'}; $qossettings {'PRIO'}; $qossettings {'MINBWDTH'}; $qossettings {'MAXBWDTH'}; $qossettings {'BURST'}; $qossettings {'CBURST'}; $qossettings {'TOS'};
207 $qossettings { 'ACTION' } = 'Unterklasse hinzufuegen' ;
209 } elsif ( $qossettings { 'DOSCLASS' } eq 'Loeschen' )
211 open ( FILE
, "< $subclassfile " ) or die "Unable to read $classfile " ;
214 open ( FILE
, "> $subclassfile " ) or die "Unable to write $classfile " ;
215 foreach $subclassentry ( sort @tmp )
217 @tmpline = split ( /\;/ , $subclassentry );
218 if ( $tmpline [ 2 ] ne $qossettings { 'CLASS' } )
220 print FILE
$subclassentry ;
224 $message = "Unterklasse $qossettings {'CLASS'} wurde geloescht." ;
227 ############################################################################################################################
228 ############################################################################################################################
230 if ( $qossettings { 'DOLEVEL7' } eq $Lang :: tr
{ 'save' })
232 if ( $qossettings { 'QIP' } ne '' ) {
233 unless ( & General
:: validip
( $qossettings { 'QIP' }) ) {
234 $qossettings { 'VALID' } = 'no' ;
235 $message = "Die Quell-IP-Adresse ist ungueltig." ;
238 if ( $qossettings { 'DIP' } ne '' ) {
239 unless ( & General
:: validip
( $qossettings { 'DIP' }) ) {
240 $qossettings { 'VALID' } = 'no' ;
241 $message = "Die Ziel-IP-Adresse ist ungueltig." ;
244 if ( $qossettings { 'CLASS' } >= 100 && $qossettings { 'CLASS' } < 121 ) {
245 $qossettings { 'DEVICE' } = $qossettings { 'RED_DEV' };
246 } elsif ( $qossettings { 'CLASS' } >= 1000 && $qossettings { 'CLASS' } < 1021 ) {
247 $qossettings { 'DEVICE' } = $qossettings { 'RED_DEV' };
248 } elsif ( $qossettings { 'CLASS' } >= 200 && $qossettings { 'CLASS' } < 221 ) {
249 $qossettings { 'DEVICE' } = $qossettings { 'IMQ_DEV' };
250 } elsif ( $qossettings { 'CLASS' } >= 2000 && $qossettings { 'CLASS' } < 2021 ) {
251 $qossettings { 'DEVICE' } = $qossettings { 'IMQ_DEV' };
253 if ( $qossettings { 'VALID' } eq 'yes' ) {
254 open ( FILE
, ">> $level7file " ) or die "Unable to write $level7file " ;
256 $qossettings {'CLASS'}; $qossettings {'DEVICE'}; $qossettings {'L7PROT'}; $qossettings {'QIP'}; $qossettings {'DIP'};
261 $qossettings { 'ACTION' } = 'Level7-Regel hinzufuegen' ;
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 'Parentklasse hinzufuegen' )
494 & Header
:: closebigbox
();
495 & Header
:: closepage
();
498 elsif ( $qossettings { 'ACTION' } eq 'Unterklasse hinzufuegen' )
501 & Header
:: closebigbox
();
502 & Header
:: closepage
();
505 elsif ( $qossettings { 'ACTION' } eq 'Regel hinzufuegen' )
507 & Header
:: openbox
( '100%' , 'center' , 'Regel hinzufuegen' );
510 <tr><td align='center'>Waehlen sie <u>eine</u> der untenstehenden Regeln aus.
511 <tr><td align='center'>
512 <input type="button" onClick="swapVisibility('l7rule')" value='Level7-Regel' />
513 <input type="button" onClick="swapVisibility('portrule')" value='Port-Regel' />
514 <input type="button" onClick="swapVisibility('tosrule')" value='TOS-Regel' />
520 <div id='l7rule' style='display: none'>
526 <div id='portrule' style='display: none'>
532 <div id='tosrule' style='display: none'>
540 & Header
:: closebigbox
();
541 & Header
:: closepage
();
544 elsif ( $qossettings { 'ACTION' } eq 'Erweiterte Einstellungen' )
547 & Header
:: closebigbox
();
548 & Header
:: closepage
();
551 if ( $qossettings { 'ACTIONBW' } eq 'Andern' )
554 & Header
:: closebigbox
();
555 & Header
:: closepage
();
558 if ( $qossettings { 'ACTIONDEF' } eq 'Andern' )
561 & Header
:: closebigbox
();
562 & Header
:: closepage
();
566 & General
:: readhash
( "${General::swroot}/qos/settings" , \
%qossettings );
568 my $status = $Lang :: tr
{ 'stopped' };
569 my $statuscolor = '#993333' ;
570 if ( $qossettings { 'ENABLED' } eq 'on' ) {
571 $status = $Lang :: tr
{ 'running' };
572 $statuscolor = '#339933' ;
575 if ( $netsettings { 'RED_TYPE' } ne 'PPPOE' ) {
576 $qossettings { 'RED_DEV' } = $netsettings { 'RED_DEV' };
580 & Header
:: openbox
( '100%' , 'left' , $Lang :: tr
{ 'error messages' });
581 print "<class name='base'> $errormessage \n " ;
582 print " </class> \n " ;
586 ############################################################################################################################
587 ############################################################################################################################
589 & Header
:: openbox
( '100%' , 'center' , 'Quality of Service' );
592 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
596 if ( $message ne "" ) {
597 print "<tr><td colspan='2' align='center'><font color='red'> $message </font>" ;
600 <tr><td width='50%' align='left'><b>Quality of Service:</b>
601 <td width='50%' align='center' bgcolor=' $statuscolor '><font color='white'> $status </font>
602 <tr><td width='100%' align='center' colspan='2'>
603 <input type='submit' name='ACTION' value="Start" />
604 <input type='submit' name='ACTION' value="Stop" />
605 <input type='submit' name='ACTION' value=" $Lang ::tr{'restart'}" /></table></form>
608 if (( $qossettings { 'OUT_SPD' } ne '' ) && ( $qossettings { 'INC_SPD' } ne '' )) {
610 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
612 <tr><td colspan='3'>
613 <tr><td width='40%' align='right'>Downloadgeschwindigkeit: <td width='40%' align='left'> $qossettings {'INC_SPD'} kbps
614 <td width='20%' rowspan='2' align='center' valign='middle'><input type='submit' name='ACTIONBW' value='Andern' />
615 <tr><td width='40%' align='right'>Uploadgeschwindigkeit: <td width='40%' align='left'> $qossettings {'OUT_SPD'} kbps
620 if (( $qossettings { 'DEFCLASS_OUT' } ne '' ) && ( $qossettings { 'DEFCLASS_INC' } ne '' )&& ( $qossettings { 'ACK' } ne '' )) {
622 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
624 <tr><td colspan='3'><hr />
625 <tr><td width='40%' align='right'>Downloadstandardklasse: <td width='40%' align='left'> $qossettings {'DEFCLASS_INC'}
626 <td width='20%' rowspan='3' align='center' valign='middle'><input type='submit' name='ACTIONDEF' value='Andern' />
627 <tr><td width='40%' align='right'>Uploadstandardklasse: <td width='40%' align='left'> $qossettings {'DEFCLASS_OUT'}
628 <tr><td width='40%' align='right'>ACKs: <td width='40%' align='left'> $qossettings {'ACK'}
629 <tr><td colspan='3' width='100%'><hr />
630 <tr><td colspan='3' width='100%' align='center'>
633 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
634 <table border='0' cellpadding='0' cellspacing='0'>
635 <tr><td><input type='submit' name='ACTION' value='Parentklasse hinzufuegen' />
636 <td><input type='submit' name='ACTION' value='Erweiterte Einstellungen' />
637 <td><input type='submit' name='ACTION' value='Statusinformationen' />
645 if ( ( $qossettings { 'OUT_SPD' } eq '' ) || ( $qossettings { 'INC_SPD' } eq '' ) ) {
647 & Header
:: closebigbox
();
648 & Header
:: closepage
();
652 if ( ( $qossettings { 'DEFCLASS_INC' } eq '' ) || ( $qossettings { 'DEFCLASS_OUT' } eq '' ) || ( $qossettings { 'ACK' } eq '' ) ) {
654 & Header
:: closebigbox
();
655 & Header
:: closepage
();
659 & Header
:: openbox
( '100%' , 'center' , $Lang :: tr
{ 'info' });
660 & overviewgraph
( $qossettings { 'RED_DEV' });
661 & overviewgraph
( $qossettings { 'IMQ_DEV' });
664 <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
665 <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
668 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" )) {
670 <tr><td colspan='9' align='center'><img alt="" src="/graphs/qos-graph- $qossettings {'RED_DEV'}.png" />
671 <tr><td colspan='9' align='center'><img alt="" src="/graphs/qos-graph- $qossettings {'IMQ_DEV'}.png" />
678 & showclasses
( $qossettings { 'RED_DEV' });
679 & showclasses
( $qossettings { 'IMQ_DEV' });
681 & Header
:: closebigbox
();
682 & Header
:: closepage
();
684 ############################################################################################################################
685 ############################################################################################################################
687 sub changedefclasses
{
688 & Header
:: openbox
( '100%' , 'center' , 'Standardklassen:' );
690 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
692 <tr><td width='100%' colspan='3'>Legen sie hier die Standardklassen fest durch die nicht-gefilterte Pakete gehen.
693 <tr><td width='33%' align='right'>Download:<td width='33%' align='left'><select name='DEFCLASS_INC'>
696 for ( $c = 200 ; $c <= 220 ; $c ++ )
698 if ( $qossettings { 'DEFCLASS_INC' } ne $c )
699 { print "<option value=' $c '> $c </option> \n " ; }
700 else { print "<option selected value=' $c '> $c </option> \n " ; }
703 </select><td width='33%' align='center'>
704 <tr><td width='33%' align='right'>Upload:<td width='33%' align='left'><select name='DEFCLASS_OUT'>
707 for ( $c = 100 ; $c <= 120 ; $c ++ )
709 if ( $qossettings { 'DEFCLASS_OUT' } ne $c )
710 { print "<option value=' $c '> $c </option> \n " ; }
711 else { print "<option selected value=' $c '> $c </option> \n " ; }
714 </select><td width='33%' align='center'>
718 <tr><td width='100%' colspan='3'>Legen sie hier die ACK-Klasse fest <br /> und klicken Sie danach auf <i>Speichern</i>.
719 <tr><td width='33%' align='right'>ACKs:<td width='33%' align='left'><select name='ACK'>
722 for ( $c = 100 ; $c <= 120 ; $c ++ )
724 if ( $qossettings { 'ACK' } ne $c )
725 { print "<option value=' $c '> $c </option> \n " ; }
726 else { print "<option selected value=' $c '> $c </option> \n " ; }
729 </select><td width='33%' align='center'><input type='submit' name='ACTION' value=" $Lang ::tr{'save'}" />
737 sub changebandwidth
{
738 & Header
:: openbox
( '100%' , 'center' , 'Bandbreiteneinstellungen' );
739 if ( $qossettings { 'ENABLED' } eq 'on' ) {
740 print "Sie koennen die Bandbreiteneinstellungen nicht bearbeiten, wenn QoS eingeschaltet ist. Schalten sie es zuerst dazu aus.<p>" ;
741 print "<a href='/cgi-bin/qos.cgi'>Zurueck</a>" ;
744 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
745 <input type='hidden' name='DEF_OUT_SPD' value='' /><input type='hidden' name='DEF_INC_SPD' value='' />
747 <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>.
748 <tr><td width='33%' align='right'>Download-Geschwindigkeit:
749 <td width='33%' align='left'><input type='text' name='INC_SPD' maxlength='8' value=" $qossettings {'INC_SPD'}" /> kbps
750 <td width='33%' align='center'>
751 <tr><td width='33%' align='right'>Upload-Geschwindigkeit:
752 <td width='33%' align='left'><input type='text' name='OUT_SPD' maxlength='8' value=" $qossettings {'OUT_SPD'}" /> kbps
753 <td width='33%' align='center'><input type='submit' name='ACTION' value=" $Lang ::tr{'save'}" /> <input type='reset' name='ACTION' value=" $Lang ::tr{'reset'}" />
763 & Header
:: openbox
( '100%' , 'center' , 'Parentklasse' );
765 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
769 if ( $message ne "" ) {
770 print "<tr><td colspan='3' align='center'> $message " ;
772 if ( $qossettings { 'EDIT' } eq 'yes' ) {
773 print "<input type='hidden' name='CLASS' value=' $qossettings {'CLASS'}' />" ;
774 print "<input type='hidden' name='DEVICE' value=' $qossettings {'DEVICE'}' />" ;
777 <tr><td width='100%' colspan='3'>Geben sie die Daten ein <br /> und klicken Sie danach auf <i>Speichern</i>.
778 <tr><td width='33%' align='right'>Interface:
779 <td width='33%' align='left'>
782 if ( $qossettings { 'EDIT' } eq 'yes' ) {
783 print "<select name='DEVICE' disabled>" ;
785 print "<select name='DEVICE'>" ;
787 if ( $qossettings { 'DEVICE' } eq $qossettings { 'RED_DEV' } ) {
788 $qossettings { 'RED_DEV_SEL' } = 'selected' ;
789 } elsif ( $qossettings { 'DEVICE' } eq $qossettings { 'IMQ_DEV' } ) {
790 $qossettings { 'IMQ_DEV_SEL' } = 'selected' ;
793 <option value=' $qossettings {'RED_DEV'}' $qossettings {'RED_DEV_SEL'}> $qossettings {'RED_DEV'}</option>
794 <option value=' $qossettings {'IMQ_DEV'}' $qossettings {'IMQ_DEV_SEL'}> $qossettings {'IMQ_DEV'}</option></select>
795 <td width='33%' align='center'>
796 <tr><td width='33%' align='right'>Klasse:<td width='33%' align='left'>
799 if ( $qossettings { 'EDIT' } eq 'yes' ) {
800 print "<select name='CLASS' disabled>" ;
802 print "<select name='CLASS'>" ;
804 for ( $c = 100 ; $c <= 120 ; $c ++ )
806 if ( $qossettings { 'CLASS' } ne $c )
807 { print "<option value=' $c '> $c </option> \n " ; }
808 else { print "<option selected value=' $c '> $c </option> \n " ; }
810 for ( $c = 200 ; $c <= 220 ; $c ++ )
812 if ( $qossettings { 'CLASS' } ne $c )
813 { print "<option value=' $c '> $c </option> \n " ; }
814 else { print "<option selected value=' $c '> $c </option> \n " ; }
818 <td width='33%' align='center'>
819 <tr><td width='33%' align='right'>Prioritaet:<td width='33%' align='left'><select name='PRIO'>
822 for ( $c = 1 ; $c <= 7 ; $c ++ )
824 if ( $qossettings { 'PRIO' } ne $c )
825 { print "<option value=' $c '> $c </option> \n " ; }
826 else { print "<option selected value=' $c '> $c </option> \n " ; }
828 if ( $qossettings { 'MINBWDTH' } eq "" ) { $qossettings { 'MINBWDTH' } = "1" ; }
831 <td width='33%' align='center'>
832 <tr><td width='33%' align='right'>Garantierte Bandbreite:
833 <td width='33%' align='left'><input type='text' size='20' name='MINBWDTH' maxlength='8' required='1' value=" $qossettings {'MINBWDTH'}" />
834 <td width='33%' align='center'>
835 <tr><td width='33%' align='right'>Maximale Bandbreite:
836 <td width='33%' align='left'><input type='text' size='20' name='MAXBWDTH' maxlength='8' required='1' value=" $qossettings {'MAXBWDTH'}" />
837 <td width='33%' align='center'>
838 <tr><td width='33%' align='right'>Burst:
839 <td width='33%' align='left'><input type='text' size='20' name='BURST' maxlength='8' value=" $qossettings {'BURST'}" />
840 <td width='33%' align='center'>
841 <tr><td width='33%' align='right'>Ceilburst:
842 <td width='33%' align='left'><input type='text' size='20' name='CBURST' maxlength='8' value=" $qossettings {'CBURST'}" />
843 <td width='33%' align='center'>
844 <tr><td width='33%' align='right'>TOS-Bit:
845 <td width='33%' align='left'><select name='TOS'>
846 <option value='0'>Ausgeschaltet (0)</option>
847 <option value='8'>Minimale Verzoegerung (8)</option>
848 <option value='4'>Maximaler Durchsatz (4)</option>
849 <option value='2'>Maximale Zuverlaessigkeit (2)</option>
850 <option value='1'>Minimale Kosten (1)</option></select>
851 <td width='33%' align='center'>
852 <tr><td width='33%' align='right'> $Lang ::tr{'remark'}:
853 <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' />
854 <tr><td width='33%' align='right'>
855 <td width='33%' align='left'>
856 <td width='33%' align='center'><input type='submit' name='DOCLASS' value=' $Lang ::tr{'save'}' /> <input type='reset' value=' $Lang ::tr{'reset'}' />
864 & Header
:: openbox
( '100%' , 'center' , 'Unterklasse' );
866 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
870 if ( $message ne "" ) {
871 print "<tr><td colspan='3' align='center'> $message " ;
874 <tr><td colspan='3' width='100%'>Aktuelle Klasse: $qossettings {'CLASS'}
875 <tr><td width='100%' colspan='3'>Geben sie die Daten ein <br /> und klicken Sie danach auf <i>Speichern</i>.
876 <tr><td width='33%' align='right'>Unterklasse:<td width='33%' align='left'><select name='SCLASS'>
879 if ( $qossettings { 'CLASS' } >= 100 && $qossettings { 'CLASS' } < 121 ) {
880 $qossettings { 'DEVICE' } = $qossettings { 'RED_DEV' };
881 for ( $c = 1000 ; $c <= 1020 ; $c ++ )
883 if ( $qossettings { 'SCLASS' } ne $c )
884 { print "<option value=' $c '> $c </option> \n " ; }
885 else { print "<option selected value=' $c '> $c </option> \n " ; }
887 } elsif ( $qossettings { 'CLASS' } >= 200 && $qossettings { 'CLASS' } < 221 ) {
888 $qossettings { 'DEVICE' } = $qossettings { 'IMQ_DEV' };
889 for ( $c = 2000 ; $c <= 2020 ; $c ++ )
891 if ( $qossettings { 'SCLASS' } ne $c )
892 { print "<option value=' $c '> $c </option> \n " ; }
893 else { print "<option selected value=' $c '> $c </option> \n " ; }
898 <td width='33%' align='center'>
899 <tr><td width='33%' align='right'>Prioritaet:<td width='33%' align='left'><select name='PRIO'>
902 for ( $c = 1 ; $c <= 7 ; $c ++ )
904 if ( $qossettings { 'PRIO' } ne $c )
905 { print "<option value=' $c '> $c </option> \n " ; }
906 else { print "<option selected value=' $c '> $c </option> \n " ; }
909 <td width='33%' align='center'>
910 <tr><td width='33%' align='right'>Garantierte Bandbreite:
911 <td width='33%' align='left'><input type='text' name='MINBWDTH' maxlength='8' required='1' value=" $qossettings {'MINBWDTH'}" />
912 <td width='33%' align='center'>
913 <tr><td width='33%' align='right'>Maximale Bandbreite:
914 <td width='33%' align='left'><input type='text' name='MAXBWDTH' maxlength='8' required='1' value=" $qossettings {'MAXBWDTH'}" />
915 <td width='33%' align='center'>
916 <tr><td width='33%' align='right'>Burst:
917 <td width='33%' align='left'><input type='text' name='BURST' maxlength='8' value=" $qossettings {'BURST'}" />
918 <td width='33%' align='center'>
919 <tr><td width='33%' align='right'>Ceilburst:
920 <td width='33%' align='left'><input type='text' name='CBURST' maxlength='8' value=" $qossettings {'CBURST'}" />
921 <td width='33%' align='center'>
922 <tr><td width='33%' align='right'>TOS-Bit:
923 <td width='33%' align='left'><select name='TOS'>
924 <option value='0'>Ausgeschaltet (0)</option>
925 <option value='8'>Minimale Verzoegerung (8)</option>
926 <option value='4'>Maximaler Durchsatz (4)</option>
927 <option value='2'>Maximale Zuverlaessigkeit (2)</option>
928 <option value='1'>Minimale Kosten (1)</option></select>
929 <td width='33%' align='center'><input type='hidden' name='CLASS' value=" $qossettings {'CLASS'}" />
930 <input type='hidden' name='DEVICE' value=" $qossettings {'DEVICE'}" />
931 <input type='submit' name='DOSCLASS' value=' $Lang ::tr{'save'}' /> <input type='reset' value=' $Lang ::tr{'reset'}' />
939 & Header
:: openbox
( '100%' , 'center' , 'Level7-Regel' );
941 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
945 if ( $message ne "" ) {
946 print "<tr><td colspan='3' align='center'><font color='red'> $message </font>" ;
949 <tr><td colspan='3' width='100%'>Aktuelle Klasse: $qossettings {'CLASS'}
950 <tr><td width='100%' colspan='3'>Geben sie die Daten ein <br /> und klicken Sie danach auf <i>Speichern</i>.
951 <tr><td width='33%' align='right'>Protokoll:
952 <td width='33%' align='left'><select name='L7PROT'>
955 opendir ( DIR
, "/etc/l7-protocols/protocols" );
956 foreach $direntry ( sort readdir ( DIR
) )
958 next if $direntry eq "." ;
959 next if $direntry eq ".." ;
960 next if - d
"/etc/l7-protocols/protocols/ $direntry " ;
961 @proto = split ( /\./ , $direntry );
962 if ( $proto [ 0 ] eq $qossettings { 'L7PROT' } ) {
963 print "<option value=' $proto [0]' selected> $proto [0]</option> \n " ;
965 print "<option value=' $proto [0]'> $proto [0]</option> \n " ;
970 </select><td width='33%' align='center'>
971 <tr><td width='33%' align='right'>Quell-IP-Adresse:
972 <td width='33%' align='left'><input type='text' name='QIP' maxlength='15' value=' $qossettings {'QIP'}' />
973 <td width='33%' align='center'>
974 <tr><td width='33%' align='right'>Ziel-IP-Adresse:
975 <td width='33%' align='left'><input type='text' name='DIP' maxlength='15' value=' $qossettings {'DIP'}' />
976 <td width='33%' align='center'><input type='hidden' name='CLASS' value=' $qossettings {'CLASS'}' /><input type='submit' name='DOLEVEL7' value=' $Lang ::tr{'save'}' />
984 & Header
:: openbox
( '100%' , 'center' , 'Port-Regel hinzufuegen' );
986 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
988 <tr><td width='100%' colspan='3'>Geben sie die Daten ein <br /> und klicken Sie danach auf <i>Speichern</i>.
989 <tr><td width='33%' align='right'>Protokoll:
990 <td width='33%' align='left'><select name='PPROT'>
993 open ( FILE
, "< /etc/protocols" );
996 foreach $direntry ( sort @proto )
998 @tmpline = split ( /\ / , $direntry );
999 next if $tmpline [ 0 ] =~ "#" ;
1000 if ( $tmpline [ 0 ] eq $qossettings { 'PPROT' } ) {
1001 print "<option value=' $tmpline [0]' selected> $tmpline [0]</option> \n " ;
1003 print "<option value=' $tmpline [0]'> $tmpline [0]</option> \n " ;
1007 </select><td width='33%' align='center'>
1008 <tr><td width='33%' align='right'>Quell-Port:
1009 <td width='33%' align='left'><input type='text' name='QPORT' maxlength='5' value=' $qossettings {'QPORT'}' />
1010 <td width='33%' align='center'>
1011 <tr><td width='33%' align='right'>Ziel-Port:
1012 <td width='33%' align='left'><input type='text' name='DPORT' maxlength='5' value=' $qossettings {'DPORT'}' />
1013 <td width='33%' align='center'>
1014 <tr><td width='33%' align='right'>Quell-IP-Adresse:
1015 <td width='33%' align='left'><input type='text' name='QIP' maxlength='15' value=' $qossettings {'QIP'}' />
1016 <td width='33%' align='center'>
1017 <tr><td width='33%' align='right'>Ziel-IP-Adresse:
1018 <td width='33%' align='left'><input type='text' name='DIP' maxlength='15' value=' $qossettings {'DIP'}' />
1019 <td width='33%' align='center'><input type='hidden' name='CLASS' value=' $qossettings {'CLASS'}' /><input type='submit' name='DOPORT' value=' $Lang ::tr{'save'}' />
1023 & Header
:: closebox
();
1027 & Header
:: openbox
( '100%' , 'center' , 'TOS-Regel' );
1028 if ( $qossettings { 'TOS' }) {
1029 $checked [ $qossettings { 'TOS' }] = "checked" ;
1032 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1036 if ( $message ne "" ) {
1037 print "<tr><td colspan='3' align='center'><font color='red'> $message </font>" ;
1040 <tr><td colspan='2' width='100%'>Aktuelle Klasse: $qossettings {'CLASS'}
1041 <tr><td width='100%' colspan='2'>Aktivieren oder deaktivieren sie die TOS-Bits <br /> und klicken Sie danach auf <i>Speichern</i>.
1042 <tr><td width='50%' align='left'>Minimale Verzoegerung (8) <td width='50%'><input type="radio" name="TOS" value="8" $checked [8] />
1043 <tr><td width='50%' align='left'>Maximaler Durchsatz (4) <td width='50%'><input type="radio" name="TOS" value="4" $checked [4] />
1044 <tr><td width='50%' align='left'>Maximale Zuverlaessigkeit (2) <td width='50%'><input type="radio" name="TOS" value="2" $checked [2] />
1045 <tr><td width='50%' align='left'>Minimale Kosten (1) <td width='50%'><input type="radio" name="TOS" value="1" $checked [1] />
1046 <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'}' />
1050 & Header
:: closebox
();
1054 $qossettings { 'DEV' } = shift ;
1055 open ( FILE
, "< $classfile " ) or die "Unable to read $classfile " ;
1059 open ( FILE
, "< $subclassfile " ) or die "Unable to read $subclassfile " ;
1060 @subclasses = < FILE
>;
1062 open ( FILE
, "< $level7file " ) or die "Unable to read $level7file " ;
1065 open ( FILE
, "< $tosfile " ) or die "Unable to read $tosfile " ;
1068 open ( FILE
, "< $portfile " ) or die "Unable to read $portfile " ;
1069 @portrules = < FILE
>;
1071 foreach $classentry ( sort @classes )
1073 @classline = split ( /\;/ , $classentry );
1074 if ( $classline [ 0 ] eq $qossettings { 'DEV' } )
1076 & Header
:: openbox
( '100%' , 'center' , "Klasse: $classline [1]" );
1078 <table border='0' width='100%' cellspacing='0'>
1079 <tr><td bgcolor=' $color {'color20'}' width='10%' align='center'><b> $Lang ::tr{'interface'}</b>
1080 <td bgcolor=' $color {'color20'}' width='10%' align='center'><b>Klasse</b>
1081 <td bgcolor=' $color {'color20'}' width='10%' align='center'>Prioritaet
1082 <td bgcolor=' $color {'color20'}' width='10%' align='center'>Garantierte Bandbreite
1083 <td bgcolor=' $color {'color20'}' width='10%' align='center'>Maximale Bandbreite
1084 <td bgcolor=' $color {'color20'}' width='10%' align='center'>Burst
1085 <td bgcolor=' $color {'color20'}' width='10%' align='center'>Ceil Burst
1086 <td bgcolor=' $color {'color20'}' width='10%' align='center'>TOS
1087 <td bgcolor=' $color {'color20'}' width='20%' align='center'>Aktionen
1088 <tr><td align='center' bgcolor=' $color {'color22'}'> $classline [0]</td>
1089 <td align='center' bgcolor=' $color {'color22'}'> $classline [1]</td>
1090 <td align='center' bgcolor=' $color {'color22'}'> $classline [2]</td>
1091 <td align='center' bgcolor=' $color {'color22'}'> $classline [3]</td>
1092 <td align='center' bgcolor=' $color {'color22'}'> $classline [4]</td>
1093 <td align='center' bgcolor=' $color {'color22'}'> $classline [5]</td>
1094 <td align='center' bgcolor=' $color {'color22'}'> $classline [6]</td>
1095 <td align='center' bgcolor=' $color {'color22'}'> $classline [7]</td>
1096 <td align='right' bgcolor=' $color {'color22'}'>
1097 <table border='0'><tr>
1098 <td><form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1099 <input type='hidden' name='CLASS' value=' $classline [1]' />
1100 <input type='hidden' name='ACTION' value='Unterklasse hinzufuegen' />
1101 <input type='image' alt='Unterklasse hinzufuegen' src='/images/addblue.gif' />
1103 <td><form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1104 <input type='hidden' name='CLASS' value=' $classline [1]' />
1105 <input type='hidden' name='ACTION' value='Regel hinzufuegen' />
1106 <input type='image' alt='Regel hinzufuegen' src='/images/addgreen.gif' />
1108 <td><form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1109 <input type='hidden' name='CLASS' value=' $classline [1]' />
1110 <input type='hidden' name='DOCLASS' value='Bearbeiten' />
1111 <input type='image' alt='Bearbeiten' src='/images/edit.gif' />
1113 <td><form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1114 <input type='hidden' name='CLASS' value=' $classline [1]' />
1115 <input type='hidden' name='DOCLASS' value='Loeschen' />
1116 <input type='image' alt='Loeschen' src='/images/delete.gif' />
1120 <tr><td align='right' colspan='2'><b> $Lang ::tr{'remark'}:</b>
1121 <td align='center' colspan='6'> $classline [8]
1122 <td align='right'><b>Queueing:</b> $classline [9]
1127 foreach $l7ruleentry ( sort @l7rules )
1129 @l7ruleline = split ( /\;/ , $l7ruleentry );
1130 if ( $l7ruleline [ 0 ] eq $classline [ 1 ] )
1133 <tr><td align='right' colspan='2'><b>Level7-Protokoll:</b>
1134 <td align='center' colspan='6'> $l7ruleline [2]
1136 <table border='0'><tr>
1137 <td><form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1138 <input type='hidden' name='CLASS' value=' $l7ruleline [0]' />
1139 <input type='hidden' name='L7PROT' value=' $l7ruleline [2]' />
1140 <input type='hidden' name='DOLEVEL7' value='Bearbeiten' />
1141 <input type='image' alt='Bearbeiten' src='/images/edit.gif' />
1143 <td><form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1144 <input type='hidden' name='CLASS' value=' $l7ruleline [0]' />
1145 <input type='hidden' name='L7PROT' value=' $l7ruleline [2]' />
1146 <input type='hidden' name='DOLEVEL7' value='Loeschen' />
1147 <input type='image' alt='Loeschen' src='/images/delete.gif' />
1152 if (( $l7ruleline [ 3 ] ne "" ) || ( $l7ruleline [ 4 ] ne "" )){
1154 <tr><td align='center'>
1155 <td align='right' colspan='3'><b>Quell-IP:</b> $l7ruleline [3]
1156 <td align='right' colspan='3'><b>Ziel-IP:</b> $l7ruleline [4]
1170 foreach $portruleentry ( sort @portrules )
1172 @portruleline = split ( /\;/ , $portruleentry );
1173 if ( $portruleline [ 0 ] eq $classline [ 1 ] )
1176 <tr><td align='right' colspan='2'><b>Port-Regel:</b>
1177 <td align='center'>( $portruleline [2])
1178 <td align='center' colspan='2'>
1181 if ( $portruleline [ 4 ]) {
1183 <i>Quell-Port:</i> $portruleline [4]
1187 print "<td align='center' colspan='2'>" ;
1188 if ( $portruleline [ 6 ]) {
1190 <i>Ziel-Port:</i> $portruleline [6]
1197 <table border='0'><tr>
1198 <td><form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1199 <input type='hidden' name='CLASS' value=' $portruleline [0]' />
1200 <input type='hidden' name='PPROT' value=' $portruleline [2]' />
1201 <input type='hidden' name='QIP' value=' $portruleline [3]' />
1202 <input type='hidden' name='QPORT' value=' $portruleline [4]' />
1203 <input type='hidden' name='DIP' value=' $portruleline [5]' />
1204 <input type='hidden' name='DPORT' value=' $portruleline [6]' />
1205 <input type='hidden' name='DOPORT' value='Bearbeiten' />
1206 <input type='image' alt='Bearbeiten' src='/images/edit.gif' />
1208 <td><form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1209 <input type='hidden' name='CLASS' value=' $portruleline [0]' />
1210 <input type='hidden' name='PPROT' value=' $portruleline [2]' />
1211 <input type='hidden' name='QIP' value=' $portruleline [3]' />
1212 <input type='hidden' name='QPORT' value=' $portruleline [4]' />
1213 <input type='hidden' name='DIP' value=' $portruleline [5]' />
1214 <input type='hidden' name='DPORT' value=' $portruleline [6]' />
1215 <input type='hidden' name='DOPORT' value='Loeschen' />
1216 <input type='image' alt='Loeschen' src='/images/delete.gif' />
1221 if (( $portruleline [ 3 ] ne "" ) || ( $portruleline [ 5 ] ne "" )){
1223 <tr><td align='center'>
1224 <td align='right' colspan='3'><b>Quell-IP:</b> $portruleline [3]
1225 <td align='right' colspan='3'><b>Ziel-IP:</b> $portruleline [5]
1234 foreach $tosruleentry ( sort @tosrules )
1236 @tosruleline = split ( /\;/ , $tosruleentry );
1237 if ( $tosruleline [ 0 ] eq $classline [ 1 ] )
1240 <tr><td align='right' colspan='2'>
1241 <b>TOS Bit matches:</b>
1242 <td colspan='6' align='center'>
1245 if ( $tosruleline [ 2 ] eq "8" ) {
1246 print "Minimale Verzoegerung \n " ;
1247 } elsif ( $tosruleline [ 2 ] eq "4" ) {
1248 print "Maximaler Durchsatz \n " ;
1249 } elsif ( $tosruleline [ 2 ] eq "2" ) {
1250 print "Maximaler Durchsatz \n " ;
1251 } elsif ( $tosruleline [ 2 ] eq "1" ) {
1252 print "Minimale Kosten \n " ;
1253 } else { print " \n " ; }
1258 <table border='0'><tr>
1259 <td><form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1260 <input type='hidden' name='CLASS' value=' $tosruleline [0]' />
1261 <input type='hidden' name='DEV' value=' $tosruleline [1]' />
1262 <input type='hidden' name='TOS' value=' $tosruleline [2]' />
1263 <input type='hidden' name='DOTOS' value='Bearbeiten' />
1264 <input type='image' alt='Bearbeiten' src='/images/edit.gif' />
1266 <td><form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1267 <input type='hidden' name='CLASS' value=' $tosruleline [0]' />
1268 <input type='hidden' name='DEV' value=' $tosruleline [1]' />
1269 <input type='hidden' name='TOS' value=' $tosruleline [2]' />
1270 <input type='hidden' name='DOTOS' value='Loeschen' />
1271 <input type='image' alt='Loeschen' src='/images/delete.gif' />
1281 foreach $subclassentry ( sort @subclasses )
1283 @subclassline = split ( /\;/ , $subclassentry );
1284 if ( $subclassline [ 1 ] eq $classline [ 1 ] ) {
1286 <tr><td align='center' bgcolor='#FAFAFA'>Subklasse:
1287 <td align='center' bgcolor='#FAFAFA'> $subclassline [2]
1288 <td align='center' bgcolor='#FAFAFA'> $subclassline [3]
1289 <td align='center' bgcolor='#FAFAFA'> $subclassline [4]
1290 <td align='center' bgcolor='#FAFAFA'> $subclassline [5]
1291 <td align='center' bgcolor='#FAFAFA'> $subclassline [6]
1292 <td align='center' bgcolor='#FAFAFA'> $subclassline [7]
1293 <td align='center' bgcolor='#FAFAFA'> $subclassline [8]
1294 <td align='right' bgcolor='#FAFAFA'>
1295 <table border='0'><tr>
1296 <td><form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1297 <input type='hidden' name='CLASS' value=' $subclassline [2]' />
1298 <input type='hidden' name='ACTION' value='Regel hinzufuegen' />
1299 <input type='image' alt='Regel hinzufuegen' src='/images/addgreen.gif' />
1301 <td><form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1302 <input type='hidden' name='CLASS' value=' $subclassline [2]' />
1303 <input type='hidden' name='DOSCLASS' value='Bearbeiten' />
1304 <input type='image' alt='Bearbeiten' src='/images/edit.gif' />
1306 <td><form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1307 <input type='hidden' name='CLASS' value=' $subclassline [2]' />
1308 <input type='hidden' name='DOSCLASS' value='Loeschen' />
1309 <input type='image' alt='Loeschen' src='/images/delete.gif' />
1320 & Header
:: closebox
();
1328 & Header
:: openbox
( '100%' , 'center' , 'Expertenoptionen:' );
1330 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
1332 <tr><td width='33%' align='right'>MTU:<td width='33%' align='left'>
1333 <input type='text' name='MTU' maxlength='8' required='4' value=' $qossettings {'MTU'}' />
1334 <td width='33%' align='center'>Diese Einstellung aendert die MTU nicht global sondern nur fuer das QoS.
1335 <tr><td width='33%' align='right'>Queue Laenge:<td width='33%' align='left'>
1336 <input type='text' name='QLENGTH' maxlength='8' required='2' value=' $qossettings {'QLENGTH'}' />
1337 <td width='33%' align='center'>
1338 <tr><td width='33%' align='right'>SFQ Perturb:<td width='33%' align='left'>
1339 <input type='text' name='SFQ_PERTUB' maxlength='8' required='1' value=' $qossettings {'SFQ_PERTUB'}' />
1340 <td width='33%' align='center'><input type='submit' name='ACTION' value=' $Lang ::tr{'save'}' />
1345 & Header
:: closebox
();
1349 if ( $qossettings { 'VALID' } eq 'yes' ) {
1350 if ( $qossettings { 'DEVICE' } eq $qossettings { 'RED_DEV' } ) {
1351 $qossettings { 'SPD' } = $qossettings { 'OUT_SPD' };
1352 } elsif ( $qossettings { 'DEVICE' } eq $qossettings { 'IMQ_DEV' } ) {
1353 $qossettings { 'SPD' } = $qossettings { 'INC_SPD' };
1355 unless ( ( $qossettings { 'MINBWDTH' } >= 1 ) && ( $qossettings { 'MINBWDTH' } <= $qossettings { 'SPD' } ) ) {
1356 $qossettings { 'VALID' } = 'no' ;
1357 $message = "Mindestbandbreite ist ungueltig." ;
1359 $qossettings { 'SPD' } = '' ;
1364 if ( $qossettings { 'VALID' } eq 'yes' ) {
1365 if ( $qossettings { 'DEVICE' } eq $qossettings { 'RED_DEV' } ) {
1366 $qossettings { 'SPD' } = $qossettings { 'OUT_SPD' };
1367 } elsif ( $qossettings { 'DEVICE' } eq $qossettings { 'IMQ_DEV' } ) {
1368 $qossettings { 'SPD' } = $qossettings { 'INC_SPD' };
1370 unless ( ( $qossettings { 'MAXBDWTH' } >= 0 ) && ( $qossettings { 'MAXBDWTH' } >= $qossettings { 'MINBDWTH' }) &&( $qossettings { 'MAXBDWTH' } <= $qossettings { 'SPD' } ) ) {
1371 $qossettings { 'VALID' } = 'no' ;
1372 $message = "Mamimalbandbreite ist ungueltig." ;
1374 $qossettings { 'SPD' } = '' ;
1379 if ( $qossettings { 'VALID' } eq 'yes' ) {
1380 if ( $qossettings { 'DEVICE' } eq $qossettings { 'RED_DEV' } ) {
1381 if ( $qossettings { 'CLASS' } lt 100 || $qossettings { 'CLASS' } ge 121 ) {
1382 $qossettings { 'VALID' } = 'no' ;
1383 $message = "Die Klassennummer passt nicht zum angegebenen Interface." ;
1385 } elsif ( $qossettings { 'DEVICE' } eq $qossettings { 'IMQ_DEV' } ) {
1386 if ( $qossettings { 'CLASS' } lt 200 || $qossettings { 'CLASS' } ge 221 ) {
1387 $qossettings { 'VALID' } = 'no' ;
1388 $message = "Die Klassennummer passt nicht zum angegebenen Interface." ;
1391 open ( FILE
, "< $classfile " ) or die "Unable to read $classfile " ;
1394 foreach $classentry ( sort @tmp )
1396 @tmpline = split ( /\;/ , $classentry );
1397 if ( $tmpline [ 1 ] eq $qossettings { 'CLASS' } )
1399 $qossettings { 'VALID' } = 'no' ;
1400 $message = "Die aktuelle Klasse wird bereits verwendet." ;
1408 if ( $qossettings { 'VALID' } eq 'yes' ) {
1409 open ( FILE
, "< $subclassfile " ) or die "Unable to read $subclassfile " ;
1412 foreach $subclassentry ( sort @tmp )
1414 @tmpline = split ( /\;/ , $subclassentry );
1415 if ( $tmpline [ 2 ] eq $qossettings { 'SCLASS' } )
1417 $qossettings { 'VALID' } = 'no' ;
1418 $message = "Die aktuelle Klasse wird bereits verwendet." ;
1426 $qossettings { 'DEV' } = shift ;
1427 if ( $qossettings { 'DEV' } eq $qossettings { 'RED_DEV' } ) {
1428 $qossettings { 'CLASSPRFX' } = '1' ;
1430 $qossettings { 'CLASSPRFX' } = '2' ;
1434 my $color = "#000000" ;
1435 my @command =( "/srv/web/ipfire/html/graphs/qos-graph- $qossettings {'DEV'}.png" ,
1436 "--start" , "-3240" , "-aPNG" , "-i" , "-z" ,
1437 "--alt-y-grid" , "-w 600" , "-h 150" , "-r" ,
1438 "--color" , "SHADEA#EAE9EE" ,
1439 "--color" , "SHADEB#EAE9EE" ,
1440 "--color" , "BACK#FFFFFF" ,
1441 "-t Auslastung auf ( $qossettings {'DEV'})"
1443 open ( FILE
, "< $classfile " ) or die "Unable to read $classfile " ;
1446 foreach $classentry ( sort @classes )
1448 @classline = split ( /\;/ , $classentry );
1449 if ( $classline [ 0 ] eq $qossettings { 'DEV' } )
1451 $color = random_hex_color
( 6 );
1452 push ( @command , "DEF: $classline [1]=/var/log/rrd/class_ $qossettings {'CLASSPRFX'}- $classline [1]_ $qossettings {'DEV'}.rrd:bits:AVERAGE" );
1454 if ( $count eq "1" ) {
1455 push ( @command , "AREA: $classline [1] $color :Klasse $classline [1] - $classline [8] \\ j" );
1457 push ( @command , "STACK: $classline [1] $color :Klasse $classline [1] - $classline [8] \\ j" );
1462 RRDs
:: graph
( @command );
1463 $ERROR = RRDs
:: error
;
1467 sub random_hex_color
{
1469 $size = 6 if $size !~ /^3|6$/ ;
1470 my @hex = ( 0 .. 9 , 'a' .. 'f' );
1472 push @color , @hex [ rand ( @hex )] for 1 .. $size ;
1473 return join ( '' , '#' , @color );