]>
git.ipfire.org Git - ipfire-2.x.git/blob - html/cgi-bin/qos.cgi
5 # This code is distributed under the terms of the GPL
11 # enable only the following on debugging purpose
13 use CGI
:: Carp
'fatalsToBrowser' ;
15 require '/var/ipfire/general-functions.pl' ;
16 require "${General::swroot}/lang.pl" ;
17 require "${General::swroot}/header.pl" ;
23 my $errormessage = "" ;
27 my $subclassentry = "" ;
35 my @subclassline = ();
39 my $classfile = "/var/ipfire/qos/classes" ;
40 my $subclassfile = "/var/ipfire/qos/subclasses" ;
41 my $level7file = "/var/ipfire/qos/level7config" ;
42 & General
:: readhash
( "${General::swroot}/ethernet/settings" , \
%netsettings );
44 & Header
:: showhttpheaders
();
46 $qossettings { 'ENABLED' } = 'off' ;
47 $qossettings { 'EDIT' } = 'no' ;
48 $qossettings { 'OUT_SPD' } = '' ;
49 $qossettings { 'INC_SPD' } = '' ;
50 $qossettings { 'DEFCLASS_INC' } = '' ;
51 $qossettings { 'DEFCLASS_OUT' } = '' ;
52 $qossettings { 'ACK' } = '' ;
53 $qossettings { 'RED_DEV' } = `cat /var/ipfire/red/iface` ;
54 $qossettings { 'IMQ_DEV' } = 'imq0' ;
55 $qossettings { 'VALID' } = 'yes' ;
57 & General
:: readhash
( "${General::swroot}/qos/settings" , \
%qossettings );
58 & Header
:: getcgihash
( \
%qossettings );
60 & Header
:: openpage
( 'QoS' , 1 , '' );
62 <script type="text/javascript">
64 function BorderOn (id) { id.className='btnOn' }
65 function BorderOff(id) { id.className='btnOff' }
70 border-right: #D5F0FF 2px Inset;
71 border-top: #D5F0FF 2px Inset;
72 border-left: #D5F0FF 2px Inset;
73 border-bottom: #D5F0FF 2px Inset;
75 text-decoration: None;
76 background-color: #FFFFFF;
79 border-right: #D5F0FF 2px Outset;
80 border-top: #D5F0FF 2px Outset;
81 border-left: #D5F0FF 2px Outset;
82 border-bottom: #D5F0FF 2px Outset;
84 text-decoration: None;
85 background-color: #FFFFFF;
91 & Header
:: openbigbox
( '100%' , 'left' , '' , $errormessage );
93 if ( $qossettings { 'DO_CLASS' } eq $Lang :: tr
{ 'save' })
98 if ( $qossettings { 'VALID' } eq 'yes' ) {
99 open ( FILE
, ">> $classfile " ) or die "Unable to write $classfile " ;
101 $qossettings {'DEVICE'}; $qossettings {'CLASS'}; $qossettings {'PRIO'}; $qossettings {'MINBWDTH'}; $qossettings {'MAXBWDTH'}; $qossettings {'BURST'}; $qossettings {'CBURST'};
106 $qossettings { 'ACTION' } = 'Parentklasse hinzufuegen' ;
109 elsif ( $qossettings { 'DO_CLASS' } eq 'Bearbeiten' )
111 open ( FILE
, "< $classfile " ) or die "Unable to read $classfile " ;
114 open ( FILE
, "> $classfile " ) or die "Unable to write $classfile " ;
115 foreach $classentry ( sort @classes )
117 @classline = split ( /\;/ , $classentry );
118 if ( $classline [ 1 ] ne $qossettings { 'CLASS' } ) {
119 print FILE
$classentry ;
121 $qossettings { 'DEVICE' } = $classline [ 0 ];
122 $qossettings { 'PRIO' } = $classline [ 2 ];
123 $qossettings { 'MINBWDTH' } = $classline [ 3 ];
124 $qossettings { 'MAXBWDTH' } = $classline [ 4 ];
125 $qossettings { 'BURST' } = $classline [ 5 ];
126 $qossettings { 'CBURST' } = $classline [ 6 ];
127 $qossettings { 'EDIT' } = 'yes' ;
132 & Header
:: closebigbox
();
133 & Header
:: closepage
();
136 elsif ( $qossettings { 'DO_CLASS' } eq 'Loeschen' )
138 open ( FILE
, "< $classfile " ) or die "Unable to read $classfile " ;
141 open ( FILE
, "> $classfile " ) or die "Unable to write $classfile " ;
142 foreach $classentry ( sort @tmp )
144 @tmpline = split ( /\;/ , $classentry );
145 if ( $tmpline [ 1 ] ne $qossettings { 'CLASS' } )
147 print FILE
$classentry ;
151 $message = "Klasse $qossettings {'CLASS'} wurde geloescht." ;
153 if ( $qossettings { 'DO_SCLASS' } eq $Lang :: tr
{ 'save' })
155 if ( $qossettings { 'SCLASS' } >= 1000 && $qossettings { 'CLASS' } < 1021 ) {
156 $qossettings { 'DEVICE' } = $qossettings { 'RED_DEV' };
157 } elsif ( $qossettings { 'SCLASS' } >= 2000 && $qossettings { 'CLASS' } < 2021 ) {
158 $qossettings { 'DEVICE' } = $qossettings { 'IMQ_DEV' };
162 if ( $qossettings { 'VALID' } eq 'yes' ) {
163 open ( FILE
, ">> $subclassfile " ) or die "Unable to write $subclassfile " ;
165 $qossettings {'DEVICE'}; $qossettings {'CLASS'}; $qossettings {'SCLASS'}; $qossettings {'PRIO'}; $qossettings {'MINBWDTH'}; $qossettings {'MAXBWDTH'}; $qossettings {'BURST'}; $qossettings {'CBURST'};
170 $qossettings { 'ACTION' } = 'Unterklasse hinzufuegen' ;
172 } elsif ( $qossettings { 'DO_SCLASS' } eq 'Loeschen' )
174 open ( FILE
, "< $subclassfile " ) or die "Unable to read $classfile " ;
177 open ( FILE
, "> $subclassfile " ) or die "Unable to write $classfile " ;
178 foreach $subclassentry ( sort @tmp )
180 @tmpline = split ( /\;/ , $subclassentry );
181 if ( $tmpline [ 2 ] ne $qossettings { 'CLASS' } )
183 print FILE
$subclassentry ;
187 $message = "Unterklasse $qossettings {'CLASS'} wurde geloescht." ;
189 if ( $qossettings { 'DO_LEVEL7' } eq $Lang :: tr
{ 'save' })
191 if ( $qossettings { 'QIP' } ne '' ) {
192 unless ( & General
:: validip
( $qossettings { 'QIP' }) ) {
193 $qossettings { 'VALID' } = 'no' ;
194 $message = "Die Quell-IP-Adresse ist ungueltig." ;
197 if ( $qossettings { 'DIP' } ne '' ) {
198 unless ( & General
:: validip
( $qossettings { 'DIP' }) ) {
199 $qossettings { 'VALID' } = 'no' ;
200 $message = "Die Ziel-IP-Adresse ist ungueltig." ;
203 if ( $qossettings { 'CLASS' } >= 100 && $qossettings { 'CLASS' } < 121 ) {
204 $qossettings { 'DEVICE' } = $qossettings { 'RED_DEV' };
205 } elsif ( $qossettings { 'CLASS' } >= 1000 && $qossettings { 'CLASS' } < 1021 ) {
206 $qossettings { 'DEVICE' } = $qossettings { 'RED_DEV' };
207 } elsif ( $qossettings { 'CLASS' } >= 200 && $qossettings { 'CLASS' } < 221 ) {
208 $qossettings { 'DEVICE' } = $qossettings { 'IMQ_DEV' };
209 } elsif ( $qossettings { 'CLASS' } >= 2000 && $qossettings { 'CLASS' } < 2021 ) {
210 $qossettings { 'DEVICE' } = $qossettings { 'IMQ_DEV' };
212 if ( $qossettings { 'VALID' } eq 'yes' ) {
213 open ( FILE
, ">> $level7file " ) or die "Unable to write $level7file " ;
215 $qossettings {'CLASS'}; $qossettings {'DEVICE'}; $qossettings {'L7PROT'}; $qossettings {'QIP'}; $qossettings {'DIP'};
220 $qossettings { 'ACTION' } = 'Level7-Regel hinzufuegen' ;
223 elsif ( $qossettings { 'DO_LEVEL7' } eq 'Loeschen' )
225 open ( FILE
, "< $level7file " ) or die "Unable to read $level7file " ;
228 open ( FILE
, "> $level7file " ) or die "Unable to read $level7file " ;
229 foreach $l7ruleentry ( sort @l7rules )
231 @l7ruleline = split ( /\;/ , $l7ruleentry );
232 if ( ( $l7ruleline [ 0 ] ne $qossettings { 'CLASS' }) && ( $l7ruleline [ 2 ] ne $qossettings { 'L7PROT' }))
234 print FILE
$l7ruleentry ;
238 $message = "Level7-Regel ( $qossettings {'CLASS'} - $qossettings {'L7PROT'}) wurde geloescht." ;
240 if ( $qossettings { 'ACTION' } eq 'Start' )
242 system ( "/bin/touch /var/ipfire/qos/enable" );
243 $qossettings { 'ENABLED' } = 'on' ;
244 & General
:: writehash
( "${General::swroot}/qos/settings" , \
%qossettings );
246 elsif ( $qossettings { 'ACTION' } eq 'Stop' )
248 unlink "/var/ipfire/qos/enable" ;
249 $qossettings { 'ENABLED' } = 'off' ;
250 & General
:: writehash
( "${General::swroot}/qos/settings" , \
%qossettings );
252 elsif ( $qossettings { 'ACTION' } eq $Lang :: tr
{ 'save' })
254 & General
:: writehash
( "${General::swroot}/qos/settings" , \
%qossettings );
256 elsif ( $qossettings { 'ACTION' } eq 'Parentklasse hinzufuegen' )
259 & Header
:: closebigbox
();
260 & Header
:: closepage
();
263 elsif ( $qossettings { 'ACTION' } eq 'Unterklasse hinzufuegen' )
266 & Header
:: closebigbox
();
267 & Header
:: closepage
();
270 elsif ( $qossettings { 'ACTION' } eq 'Level7-Regel hinzufuegen' )
273 & Header
:: closebigbox
();
274 & Header
:: closepage
();
277 elsif ( $qossettings { 'ACTION' } eq 'Port-Regel hinzufuegen' )
280 & Header
:: closebigbox
();
281 & Header
:: closepage
();
284 if ( $qossettings { 'ACTION_BW' } eq 'Andern' )
287 & Header
:: closebigbox
();
288 & Header
:: closepage
();
291 if ( $qossettings { 'ACTION_DEF' } eq 'Andern' )
294 & Header
:: closebigbox
();
295 & Header
:: closepage
();
299 & General
:: readhash
( "${General::swroot}/qos/settings" , \
%qossettings );
301 my $status = $Lang :: tr
{ 'stopped' };
302 my $statuscolor = $Header :: colourred
;
303 if ( $qossettings { 'ENABLED' } eq 'on' ) {
304 $status = $Lang :: tr
{ 'running' };
305 $statuscolor = $Header :: colourgreen
;
308 if ( $netsettings { 'RED_TYPE' } ne 'PPPOE' ) {
309 $qossettings { 'RED_DEV' } = $netsettings { 'RED_DEV' };
313 & Header
:: openbox
( '100%' , 'left' , $Lang :: tr
{ 'error messages' });
314 print "<class name='base'> $errormessage \n " ;
315 print " </class> \n " ;
319 ############################################################################################################################
320 ############################################################################################################################
322 & Header
:: openbox
( '100%' , 'center' , 'Quality of Service' );
324 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
328 if ( $message ne "" ) {
329 print "<tr><td colspan='2' align='center'><font color='red'> $message </font>" ;
332 <tr><td width='50%' align='left'><b>Quality of Service:</b>
333 <td width='50%' align='center' bgcolor=' $statuscolor '><font color='white'> $status </font>
334 <tr><td width='100%' align='center' colspan='2'>
335 <input type='submit' name='ACTION' value='Start' />
336 <input type='submit' name='ACTION' value='Stop' />
337 <input type='submit' name='ACTION' value=' $Lang ::tr{'restart'}' />
340 if (( $qossettings { 'OUT_SPD' } ne '' ) && ( $qossettings { 'INC_SPD' } ne '' )) {
342 <tr><td colspan='3'>
343 <tr><td width='40%' align='right'>Downloadgeschwindigkeit: <td width='40%' align='left'> $qossettings {'INC_SPD'} kbps
344 <td width='20%' rowspan='2' align='center' valign='middle'><input type='submit' name='ACTION_BW' class='btnOff' onmouseover='BorderOn(this)' onmouseout='BorderOff(this)' value='Andern'>
345 <tr><td width='40%' align='right'>Uploadgeschwindigkeit: <td width='40%' align='left'> $qossettings {'OUT_SPD'} kbps
349 if (( $qossettings { 'DEFCLASS_OUT' } ne '' ) && ( $qossettings { 'DEFCLASS_INC' } ne '' )&& ( $qossettings { 'ACK' } ne '' )) {
351 <tr><td colspan='3'><hr>
352 <tr><td width='40%' align='right'>Downloadstandardklasse: <td width='40%' align='left'> $qossettings {'DEFCLASS_INC'}
353 <td width='20%' rowspan='3' align='center' valign='middle'><input type='submit' name='ACTION_DEF' class='btnOff' onmouseover='BorderOn(this)' onmouseout='BorderOff(this)' value='Andern'>
354 <tr><td width='40%' align='right'>Uploadstandardklasse: <td width='40%' align='left'> $qossettings {'DEFCLASS_OUT'}
355 <tr><td width='40%' align='right'>ACKs: <td width='40%' align='left'> $qossettings {'ACK'}
356 <tr><td colspan='3' width='100%'><hr>
357 <tr><td colspan='3' width='100%' align='center'><input type='submit' name='ACTION' class='btnOff' onmouseover='BorderOn(this)' onmouseout='BorderOff(this)' value='Parentklasse hinzufuegen'>
365 if ( ( $qossettings { 'OUT_SPD' } eq '' ) || ( $qossettings { 'INC_SPD' } eq '' ) ) {
368 & Header
:: closebigbox
();
369 & Header
:: closepage
();
373 if ( ( $qossettings { 'DEFCLASS_INC' } eq '' ) || ( $qossettings { 'DEFCLASS_OUT' } eq '' ) || ( $qossettings { 'ACK' } eq '' ) ) {
375 & Header
:: closebigbox
();
376 & Header
:: closepage
();
383 & Header
:: closebigbox
();
384 & Header
:: closepage
();
386 ############################################################################################################################
387 ############################################################################################################################
389 sub changedefclasses
{
390 & Header
:: openbox
( '100%' , 'center' , 'Standardklassen:' );
392 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
394 <tr><td width='100%' colspan='3'>Legen sie hier die Standardklassen fest durch die nicht-gefilterte Pakete gehen.
395 <tr><td width='33%' align='right'>Download:<td width='33%' align='left'><select name='DEFCLASS_INC'>
398 for ( $c = 200 ; $c <= 220 ; $c ++ )
400 if ( $qossettings { 'DEFCLASS_INC' } ne $c )
401 { print "<option value=' $c '> $c </option> \n " ; }
402 else { print "<option selected value=' $c '> $c </option> \n " ; }
405 </select><td width='33%' align='center'>
406 <tr><td width='33%' align='right'>Upload:<td width='33%' align='left'><select name='DEFCLASS_OUT'>
409 for ( $c = 100 ; $c <= 120 ; $c ++ )
411 if ( $qossettings { 'DEFCLASS_OUT' } ne $c )
412 { print "<option value=' $c '> $c </option> \n " ; }
413 else { print "<option selected value=' $c '> $c </option> \n " ; }
416 </select><td width='33%' align='center'>
420 <tr><td width='100%' colspan='3'>Legen sie hier die ACK-Klasse fest <br> und klicken Sie danach auf <i>Speichern</i>.
421 <tr><td width='33%' align='right'>ACKs:<td width='33%' align='left'><select name='ACK'>
424 for ( $c = 100 ; $c <= 120 ; $c ++ )
426 if ( $qossettings { 'ACK' } ne $c )
427 { print "<option value=' $c '> $c </option> \n " ; }
428 else { print "<option selected value=' $c '> $c </option> \n " ; }
431 </select><td width='33%' align='center'><input type='submit' name='ACTION' value= $Lang ::tr{'save'} />
439 sub changebandwidth
{
440 & Header
:: openbox
( '100%' , 'center' , 'Bandbreiteneinstellungen' );
441 if ( $qossettings { 'ENABLED' } eq 'on' ) {
442 print "Sie koennen die Bandbreiteneinstellungen nicht bearbeiten, wenn QoS eingeschaltet ist. Schalten sie es zuerst dazu aus.<p>" ;
443 print "<a href='/cgi-bin/qos.cgi'>Zurueck</a>" ;
446 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
448 <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>.
449 <tr><td width='33%' align='right'>Download-Geschwindigkeit:
450 <td width='33%' align='left'><input type='text' name='INC_SPD' maxlength='8' value= $qossettings {'INC_SPD'}> kbps
451 <td width='33%' align='center'>
452 <tr><td width='33%' align='right'>Upload-Geschwindigkeit:
453 <td width='33%' align='left'><input type='text' name='OUT_SPD' maxlength='8' value= $qossettings {'OUT_SPD'}> kbps
454 <td width='33%' align='center'><input type='submit' name='ACTION' value= $Lang ::tr{'save'} /> <input type='reset' name='ACTION' value= $Lang ::tr{'reset'} />
464 & Header
:: openbox
( '100%' , 'center' , 'Parentklasse' );
466 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
470 if ( $message ne "" ) {
471 print "<tr><td colspan='3' align='center'> $message " ;
473 if ( $qossettings { 'EDIT' } eq 'yes' ) {
474 print "<input type='hidden' name='CLASS' value= $qossettings {'CLASS'}>" ;
475 print "<input type='hidden' name='DEVICE' value= $qossettings {'DEVICE'}>" ;
478 <tr><td width='100%' colspan='3'>Geben sie die Daten ein <br> und klicken Sie danach auf <i>Speichern</i>.
479 <tr><td width='33%' align='right'>Interface:
480 <td width='33%' align='left'>
483 if ( $qossettings { 'EDIT' } eq 'yes' ) {
484 print "<select name='DEVICE' disabled>" ;
486 print "<select name='DEVICE'>" ;
488 if ( $qossettings { 'DEVICE' } eq $qossettings { 'RED_DEV' } ) {
489 $qossettings { 'RED_DEV_SEL' } = 'selected' ;
490 } elsif ( $qossettings { 'DEVICE' } eq $qossettings { 'IMQ_DEV' } ) {
491 $qossettings { 'IMQ_DEV_SEL' } = 'selected' ;
494 <option value= $qossettings {'RED_DEV'} $qossettings {'RED_DEV_SEL'}> $qossettings {'RED_DEV'}</option>
495 <option value= $qossettings {'IMQ_DEV'} $qossettings {'IMQ_DEV_SEL'}> $qossettings {'IMQ_DEV'}</option></select>
496 <td width='33%' align='center'>
497 <tr><td width='33%' align='right'>Klasse:<td width='33%' align='left'>
500 if ( $qossettings { 'EDIT' } eq 'yes' ) {
501 print "<select name='CLASS' disabled>" ;
503 print "<select name='CLASS'>" ;
505 for ( $c = 100 ; $c <= 120 ; $c ++ )
507 if ( $qossettings { 'CLASS' } ne $c )
508 { print "<option value=' $c '> $c </option> \n " ; }
509 else { print "<option selected value=' $c '> $c </option> \n " ; }
511 for ( $c = 200 ; $c <= 220 ; $c ++ )
513 if ( $qossettings { 'CLASS' } ne $c )
514 { print "<option value=' $c '> $c </option> \n " ; }
515 else { print "<option selected value=' $c '> $c </option> \n " ; }
519 <td width='33%' align='center'>
520 <tr><td width='33%' align='right'>Prioritaet:<td width='33%' align='left'><select name='PRIO'>
523 for ( $c = 1 ; $c <= 7 ; $c ++ )
525 if ( $qossettings { 'PRIO' } ne $c )
526 { print "<option value=' $c '> $c </option> \n " ; }
527 else { print "<option selected value=' $c '> $c </option> \n " ; }
530 <td width='33%' align='center'>
531 <tr><td width='33%' align='right'>Garantierte Bandbreite:
532 <td width='33%' align='left'><input type='text' name='MINBWDTH' maxlength='8' required='1' value= $qossettings {'MINBWDTH'} >
533 <td width='33%' align='center'>
534 <tr><td width='33%' align='right'>Maximale Bandbreite:
535 <td width='33%' align='left'><input type='text' name='MAXBWDTH' maxlength='8' required='1' value= $qossettings {'MAXBWDTH'}>
536 <td width='33%' align='center'>
537 <tr><td width='33%' align='right'>Burst:
538 <td width='33%' align='left'><input type='text' name='BURST' maxlength='8' value= $qossettings {'BURST'}>
539 <td width='33%' align='center'>
540 <tr><td width='33%' align='right'>Ceilburst:
541 <td width='33%' align='left'><input type='text' name='CBURST' maxlength='8' value= $qossettings {'CBURST'}>
542 <td width='33%' align='center'><input type='submit' name='DO_CLASS' value= $Lang ::tr{'save'} /> <input type='reset' value= $Lang ::tr{'reset'} />
550 & Header
:: openbox
( '100%' , 'center' , 'Unterklasse' );
552 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
556 if ( $message ne "" ) {
557 print "<tr><td colspan='3' align='center'> $message " ;
560 <tr><td colspan='3' width='100%'>Aktuelle Klasse: $qossettings {'CLASS'}
561 <tr><td width='100%' colspan='3'>Geben sie die Daten ein <br> und klicken Sie danach auf <i>Speichern</i>.
562 <tr><td width='33%' align='right'>Unterklasse:<td width='33%' align='left'><select name='SCLASS'>
565 if ( $qossettings { 'CLASS' } >= 100 && $qossettings { 'CLASS' } < 121 ) {
566 $qossettings { 'DEVICE' } = $qossettings { 'RED_DEV' };
567 for ( $c = 1000 ; $c <= 1020 ; $c ++ )
569 if ( $qossettings { 'SCLASS' } ne $c )
570 { print "<option value=' $c '> $c </option> \n " ; }
571 else { print "<option selected value=' $c '> $c </option> \n " ; }
573 } elsif ( $qossettings { 'CLASS' } >= 200 && $qossettings { 'CLASS' } < 221 ) {
574 $qossettings { 'DEVICE' } = $qossettings { 'IMQ_DEV' };
575 for ( $c = 2000 ; $c <= 2020 ; $c ++ )
577 if ( $qossettings { 'SCLASS' } ne $c )
578 { print "<option value=' $c '> $c </option> \n " ; }
579 else { print "<option selected value=' $c '> $c </option> \n " ; }
584 <td width='33%' align='center'>
585 <tr><td width='33%' align='right'>Prioritaet:<td width='33%' align='left'><select name='PRIO'>
588 for ( $c = 1 ; $c <= 7 ; $c ++ )
590 if ( $qossettings { 'PRIO' } ne $c )
591 { print "<option value=' $c '> $c </option> \n " ; }
592 else { print "<option selected value=' $c '> $c </option> \n " ; }
595 <td width='33%' align='center'>
596 <tr><td width='33%' align='right'>Garantierte Bandbreite:
597 <td width='33%' align='left'><input type='text' name='MINBWDTH' maxlength='8' required='1' value= $qossettings {'MINBWDTH'} >
598 <td width='33%' align='center'>
599 <tr><td width='33%' align='right'>Maximale Bandbreite:
600 <td width='33%' align='left'><input type='text' name='MAXBWDTH' maxlength='8' required='1' value= $qossettings {'MAXBWDTH'}>
601 <td width='33%' align='center'>
602 <tr><td width='33%' align='right'>Burst:
603 <td width='33%' align='left'><input type='text' name='BURST' maxlength='8' value= $qossettings {'BURST'}>
604 <td width='33%' align='center'>
605 <tr><td width='33%' align='right'>Ceilburst:
606 <td width='33%' align='left'><input type='text' name='CBURST' maxlength='8' value= $qossettings {'CBURST'}>
607 <td width='33%' align='center'><input type='hidden' name='CLASS' value= $qossettings {'CLASS'}><input type='submit' name='DO_SCLASS' value= $Lang ::tr{'save'} /> <input type='reset' value= $Lang ::tr{'reset'} />
616 & Header
:: openbox
( '100%' , 'center' , 'Level7-Regel' );
618 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
622 if ( $message ne "" ) {
623 print "<tr><td colspan='3' align='center'><font color='red'> $message </font>" ;
626 <tr><td colspan='3' width='100%'>Aktuelle Klasse: $qossettings {'CLASS'}
627 <tr><td width='100%' colspan='3'>Geben sie die Daten ein <br> und klicken Sie danach auf <i>Speichern</i>.
628 <tr><td width='33%' align='right'>Protokoll:
629 <td width='33%' align='left'><select name='L7PROT'>
632 opendir ( DIR
, "/etc/l7-protocols/protocols" );
633 foreach $direntry ( sort readdir ( DIR
) )
635 next if $direntry eq "." ;
636 next if $direntry eq ".." ;
637 next if - d
"/etc/l7-protocols/protocols/ $direntry " ;
638 @proto = split ( /\./ , $direntry );
639 if ( $proto [ 0 ] eq $qossettings { 'L7PROT' } ) {
640 print "<option value=' $proto [0]' selected> $proto [0]</option> \n " ;
642 print "<option value=' $proto [0]'> $proto [0]</option> \n " ;
647 </select><td width='33%' align='center'>
648 <tr><td width='33%' align='right'>Quell-IP-Adresse:
649 <td width='33%' align='left'><input type='text' name='QIP' maxlength='15' value= $qossettings {'QIP'}>
650 <td width='33%' align='center'>
651 <tr><td width='33%' align='right'>Ziel-IP-Adresse:
652 <td width='33%' align='left'><input type='text' name='DIP' maxlength='15' value= $qossettings {'DIP'}>
653 <td width='33%' align='center'><input type='hidden' name='CLASS' value= $qossettings {'CLASS'}><input type='submit' name='DO_LEVEL7' value= $Lang ::tr{'save'} />
661 & Header
:: openbox
( '100%' , 'center' , 'Port-Regel hinzufuegen' );
663 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
665 <tr><td width='100%' colspan='3'>Geben sie die Daten ein <br> und klicken Sie danach auf <i>Speichern</i>.
666 <tr><td width='33%' align='right'>Name:
667 <td width='33%' align='left'><input type='text' name='NAME' maxlength='20' value= $qossettings {'NAME'}>
668 <td width='33%' align='center'>
669 <tr><td width='33%' align='right'>Protokoll:
670 <td width='33%' align='left'><select name='PPROT'>
673 open ( FILE
, "< /etc/protocols" );
676 foreach $direntry ( sort @proto )
678 @tmpline = split ( /\ / , $direntry );
679 next if $tmpline [ 0 ] =~ "#" ;
680 if ( $tmpline [ 0 ] eq $qossettings { 'PPROT' } ) {
681 print "<option value=' $tmpline [0]' selected> $tmpline [0]</option> \n " ;
683 print "<option value=' $tmpline [0]'> $tmpline [0]</option> \n " ;
687 </select><td width='33%' align='center'>
688 <tr><td width='33%' align='right'>Quell-Port:
689 <td width='33%' align='left'><input type='text' name='QPORT' maxlength='5' value= $qossettings {'QPORT'}>
690 <td width='33%' align='center'>
691 <tr><td width='33%' align='right'>Ziel-Port:
692 <td width='33%' align='left'><input type='text' name='DPORT' maxlength='5' value= $qossettings {'DPORT'}>
693 <td width='33%' align='center'>
694 <tr><td width='33%' align='right'>Quell-IP-Adresse:
695 <td width='33%' align='left'><input type='text' name='QIP' maxlength='15' value= $qossettings {'QIP'}>
696 <td width='33%' align='center'>
697 <tr><td width='33%' align='right'>Ziel-IP-Adresse:
698 <td width='33%' align='left'><input type='text' name='DIP' maxlength='15' value= $qossettings {'DIP'}>
699 <td width='33%' align='center'><input type='hidden' name='CLASS' value=' $qossettings {'CLASS'}><input type='submit' name='ACTION' value= $Lang ::tr{'save'} />
707 open ( FILE
, "< $classfile " ) or die "Unable to read $classfile " ;
711 open ( FILE
, "< $subclassfile " ) or die "Unable to read $subclassfile " ;
712 @subclasses = < FILE
>;
714 & Header
:: openbox
( '100%' , 'center' , 'Klassen' );
716 <table border='0' width='100%' cellspacing='0'>
717 <tr><td bgcolor='lightgrey' width='10%'>Interface
718 <td bgcolor='lightgrey' width='10%'>Klasse
719 <td bgcolor='lightgrey' width='10%'>Prioritaet
720 <td bgcolor='lightgrey' width='10%'>Garantierte Bandbreite
721 <td bgcolor='lightgrey' width='10%'>Maximale Bandbreite
722 <td bgcolor='lightgrey' width='10%'>Burst
723 <td bgcolor='lightgrey' width='10%'>Ceil Burst
724 <td bgcolor='lightgrey' width='30%'>Aktionen
727 foreach $classentry ( sort @classes )
729 @classline = split ( /\;/ , $classentry );
730 if ( $classline [ 0 ] eq $qossettings { 'RED_DEV' } )
733 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
734 <tr><td align='center' bgcolor='#EAEAEA'> $classline [0]
735 <td align='center' bgcolor='#EAEAEA'> $classline [1]
736 <td align='center' bgcolor='#EAEAEA'> $classline [2]
737 <td align='center' bgcolor='#EAEAEA'> $classline [3]
738 <td align='center' bgcolor='#EAEAEA'> $classline [4]
739 <td align='center' bgcolor='#EAEAEA'> $classline [5]
740 <td align='center' bgcolor='#EAEAEA'> $classline [6]
741 <td align='right' bgcolor='#EAEAEA'><input type='hidden' name='CLASS' value=' $classline [1]'>
742 <button type='submit' name='DO_CLASS' value='Bearbeiten' class='btnOff' onmouseover='BorderOn(this)' onmouseout='BorderOff(this)'><img src='/images/edit.gif' width="20" height="20" alt="Klasse bearbeiten"></button>
743 <button type='submit' name='ACTION' value='Unterklasse hinzufuegen' class='btnOff' onmouseover='BorderOn(this)' onmouseout='BorderOff(this)'><img src='/images/addblue.gif' width="20" height="20" alt="Unterklasse hinzufuegen"></button>
744 <button type='submit' name='ACTION' value='Level7-Regel hinzufuegen' class='btnOff' onmouseover='BorderOn(this)' onmouseout='BorderOff(this)'><img src='/images/addgreen.gif' width="20" height="20" alt="Level7-Regel hinzufuegen"></button>
745 <button type='submit' name='ACTION' value='Port-Regel hinzufuegen' class='btnOff' onmouseover='BorderOn(this)' onmouseout='BorderOff(this)'><img src='/images/add.gif' width="20" height="20" alt="Port-Regel hinzufuegen"></button>
746 <button type='submit' name='DO_CLASS' value='Loeschen' class='btnOff' onmouseover='BorderOn(this)' onmouseout='BorderOff(this)'><img src='/images/delete.gif' width="20" height="20" alt="Klasse loeschen"></button>
750 foreach $subclassentry ( sort @subclasses )
752 @subclassline = split ( /\;/ , $subclassentry );
753 if ( $subclassline [ 1 ] eq $classline [ 1 ] ) {
755 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
756 <tr><td align='center' bgcolor='#FFFFFF'>Subklasse:
757 <td align='center' bgcolor='#FAFAFA'> $subclassline [2]
758 <td align='center' bgcolor='#FAFAFA'> $subclassline [3]
759 <td align='center' bgcolor='#FAFAFA'> $subclassline [4]
760 <td align='center' bgcolor='#FAFAFA'> $subclassline [5]
761 <td align='center' bgcolor='#FAFAFA'> $subclassline [6]
762 <td align='center' bgcolor='#FAFAFA'> $subclassline [7]
763 <td align='right' bgcolor='#FAFAFA'><input type='hidden' name='CLASS' value=' $subclassline [2]'>
764 <button type='submit' name='DO_SCLASS' value='Bearbeiten' class='btnOff' onmouseover='BorderOn(this)' onmouseout='BorderOff(this)'><img src='/images/edit.gif' width="20" height="20" alt="Klasse bearbeiten"></button>
765 <button type='submit' name='ACTION' value='Level7-Regel hinzufuegen' class='btnOff' onmouseover='BorderOn(this)' onmouseout='BorderOff(this)'><img src='/images/addgreen.gif' width="20" height="20" alt="Level7-Regel hinzufuegen"></button>
766 <button type='submit' name='ACTION' value='Port-Regel hinzufuegen' class='btnOff' onmouseover='BorderOn(this)' onmouseout='BorderOff(this)'><img src='/images/add.gif' width="20" height="20" alt="Port-Regel hinzufuegen"></button>
767 <button type='submit' name='DO_SCLASS' value='Loeschen' class='btnOff' onmouseover='BorderOn(this)' onmouseout='BorderOff(this)'><img src='/images/delete.gif' width="20" height="20" alt="Klasse loeschen"></button>
775 print " \t <tr><td colspan='8' bgcolor='lightgrey' height='2'>" ;
776 foreach $classentry ( sort @classes )
778 @classline = split ( /\;/ , $classentry );
779 if ( $classline [ 0 ] eq $qossettings { 'IMQ_DEV' } )
782 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
783 <tr><td align='center' bgcolor='#EAEAEA'> $classline [0]
784 <td align='center' bgcolor='#EAEAEA'> $classline [1]
785 <td align='center' bgcolor='#EAEAEA'> $classline [2]
786 <td align='center' bgcolor='#EAEAEA'> $classline [3]
787 <td align='center' bgcolor='#EAEAEA'> $classline [4]
788 <td align='center' bgcolor='#EAEAEA'> $classline [5]
789 <td align='center' bgcolor='#EAEAEA'> $classline [6]
790 <td align='right' bgcolor='#EAEAEA'><input type='hidden' name='CLASS' value=' $classline [1]'>
791 <button type='submit' name='DO_CLASS' value='Bearbeiten' class='btnOff' onmouseover='BorderOn(this)' onmouseout='BorderOff(this)'><img src='/images/edit.gif' width="20" height="20" alt="Klasse bearbeiten"></button>
792 <button type='submit' name='ACTION' value='Unterklasse hinzufuegen' class='btnOff' onmouseover='BorderOn(this)' onmouseout='BorderOff(this)'><img src='/images/addblue.gif' width="20" height="20" alt="Unterklasse hinzufuegen"></button>
793 <button type='submit' name='ACTION' value='Level7-Regel hinzufuegen' class='btnOff' onmouseover='BorderOn(this)' onmouseout='BorderOff(this)'><img src='/images/addgreen.gif' width="20" height="20" alt="Level7-Regel hinzufuegen"></button>
794 <button type='submit' name='ACTION' value='Port-Regel hinzufuegen' class='btnOff' onmouseover='BorderOn(this)' onmouseout='BorderOff(this)'><img src='/images/add.gif' width="20" height="20" alt="Port-Regel hinzufuegen"></button>
795 <button type='submit' name='DO_CLASS' value='Loeschen' class='btnOff' onmouseover='BorderOn(this)' onmouseout='BorderOff(this)'><img src='/images/delete.gif' width="20" height="20" alt="Klasse loeschen"></button>
799 foreach $subclassentry ( sort @subclasses )
801 @subclassline = split ( /\;/ , $subclassentry );
802 if ( $subclassline [ 1 ] eq $classline [ 1 ] ) {
804 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
805 <tr><td align='center' bgcolor='#FFFFFF'>Subklasse:
806 <td align='center' bgcolor='#FAFAFA'> $subclassline [2]
807 <td align='center' bgcolor='#FAFAFA'> $subclassline [3]
808 <td align='center' bgcolor='#FAFAFA'> $subclassline [4]
809 <td align='center' bgcolor='#FAFAFA'> $subclassline [5]
810 <td align='center' bgcolor='#FAFAFA'> $subclassline [6]
811 <td align='center' bgcolor='#FAFAFA'> $subclassline [7]
812 <td align='right' bgcolor='#FAFAFA'><input type='hidden' name='CLASS' value=' $subclassline [2]'>
813 <button type='submit' name='DO_SCLASS' value='Bearbeiten' class='btnOff' onmouseover='BorderOn(this)' onmouseout='BorderOff(this)'><img src='/images/edit.gif' width="20" height="20" alt="Klasse bearbeiten"></button>
814 <button type='submit' name='ACTION' value='Level7-Regel hinzufuegen' class='btnOff' onmouseover='BorderOn(this)' onmouseout='BorderOff(this)'><img src='/images/addgreen.gif' width="20" height="20" alt="Level7-Regel hinzufuegen"></button>
815 <button type='submit' name='ACTION' value='Port-Regel hinzufuegen' class='btnOff' onmouseover='BorderOn(this)' onmouseout='BorderOff(this)'><img src='/images/add.gif' width="20" height="20" alt="Port-Regel hinzufuegen"></button>
816 <button type='submit' name='DO_SCLASS' value='Loeschen' class='btnOff' onmouseover='BorderOn(this)' onmouseout='BorderOff(this)'><img src='/images/delete.gif' width="20" height="20" alt="Klasse loeschen"></button>
824 print " \t </table> \n " ;
830 open ( FILE
, "< $level7file " ) or die "Unable to read $level7file " ;
834 & Header
:: openbox
( '100%' , 'center' , 'Level7-Regeln' );
836 <table border='0' width='100%' cellspacing='0'>
837 <tr><td bgcolor='lightgrey' width='14%'>Interface
838 <td bgcolor='lightgrey' width='14%'>Klasse
839 <td bgcolor='lightgrey' width='14%'>Protokoll
840 <td bgcolor='lightgrey' width='14%'>Quell-IP-Adresse
841 <td bgcolor='lightgrey' width='14%'>Ziel-IP-Adresse
842 <td bgcolor='lightgrey' width='30%'>Aktionen
845 foreach $l7ruleentry ( sort @l7rules )
847 @l7ruleline = split ( /\;/ , $l7ruleentry );
848 if ( $l7ruleline [ 1 ] eq $qossettings { 'RED_DEV' } )
851 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
852 <tr><td align='center' bgcolor='#EAEAEA'> $l7ruleline [1]
853 <td align='center' bgcolor='#EAEAEA'> $l7ruleline [0]
854 <td align='center' bgcolor='#EAEAEA'> $l7ruleline [2]
855 <td align='center' bgcolor='#EAEAEA'> $l7ruleline [3]
856 <td align='center' bgcolor='#EAEAEA'> $l7ruleline [4]
857 <td align='right' bgcolor='#EAEAEA'><input type='hidden' name='CLASS' value=' $l7ruleline [0]'><input type='hidden' name='L7PROT' value=' $l7ruleline [2]'>
858 <button type='submit' name='DO_LEVEL7' value='Bearbeiten' class='btnOff' onmouseover='BorderOn(this)' onmouseout='BorderOff(this)'><img src='/images/edit.gif' width="20" height="20" alt="Klasse bearbeiten"></button>
859 <button type='submit' name='DO_LEVEL7' value='Loeschen' class='btnOff' onmouseover='BorderOn(this)' onmouseout='BorderOff(this)'><img src='/images/delete.gif' width="20" height="20" alt="Klasse loeschen"></button>
865 print " \t <tr><td colspan='8' bgcolor='lightgrey' height='2'>" ;
866 foreach $l7ruleentry ( sort @l7rules )
868 @l7ruleline = split ( /\;/ , $l7ruleentry );
869 if ( $l7ruleline [ 1 ] eq $qossettings { 'IMQ_DEV' } )
872 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
873 <tr><td align='center' bgcolor='#EAEAEA'> $l7ruleline [1]
874 <td align='center' bgcolor='#EAEAEA'> $l7ruleline [0]
875 <td align='center' bgcolor='#EAEAEA'> $l7ruleline [2]
876 <td align='center' bgcolor='#EAEAEA'> $l7ruleline [3]
877 <td align='center' bgcolor='#EAEAEA'> $l7ruleline [4]
878 <td align='right' bgcolor='#EAEAEA'><input type='hidden' name='CLASS' value=' $l7ruleline [0]'><input type='hidden' name='L7PROT' value=' $l7ruleline [2]'>
879 <button type='submit' name='DO_LEVEL7' value='Bearbeiten' class='btnOff' onmouseover='BorderOn(this)' onmouseout='BorderOff(this)'><img src='/images/edit.gif' width="20" height="20" alt="Klasse bearbeiten"></button>
880 <button type='submit' name='DO_LEVEL7' value='Loeschen' class='btnOff' onmouseover='BorderOn(this)' onmouseout='BorderOff(this)'><img src='/images/delete.gif' width="20" height="20" alt="Klasse loeschen"></button>
886 print " \t </table> \n " ;
893 if ( $qossettings { 'VALID' } eq 'yes' ) {
894 if ( $qossettings { 'DEVICE' } eq $qossettings { 'RED_DEV' } ) {
895 $qossettings { 'SPD' } = $qossettings { 'OUT_SPD' };
896 } elsif ( $qossettings { 'DEVICE' } eq $qossettings { 'IMQ_DEV' } ) {
897 $qossettings { 'SPD' } = $qossettings { 'INC_SPD' };
899 unless ( ( $qossettings { 'MINBDWTH' } >= 0 ) && ( $qossettings { 'MINBDWTH' } <= $qossettings { 'SPD' } ) ) {
900 $qossettings { 'VALID' } = 'no' ;
901 $message = "Mindestbandbreite ist ungueltig." ;
903 $qossettings { 'SPD' } = '' ;
907 if ( $qossettings { 'VALID' } eq 'yes' ) {
908 if ( $qossettings { 'DEVICE' } eq $qossettings { 'RED_DEV' } ) {
909 $qossettings { 'SPD' } = $qossettings { 'OUT_SPD' };
910 } elsif ( $qossettings { 'DEVICE' } eq $qossettings { 'IMQ_DEV' } ) {
911 $qossettings { 'SPD' } = $qossettings { 'INC_SPD' };
913 unless ( ( $qossettings { 'MAXBDWTH' } >= 0 ) && ( $qossettings { 'MAXBDWTH' } >= $qossettings { 'MINBDWTH' }) &&( $qossettings { 'MAXBDWTH' } <= $qossettings { 'SPD' } ) ) {
914 $qossettings { 'VALID' } = 'no' ;
915 $message = "Mamimalbandbreite ist ungueltig." ;
917 $qossettings { 'SPD' } = '' ;
922 if ( $qossettings { 'VALID' } eq 'yes' ) {
923 if ( $qossettings { 'DEVICE' } eq $qossettings { 'RED_DEV' } ) {
924 if ( $qossettings { 'CLASS' } lt 100 || $qossettings { 'CLASS' } ge 121 ) {
925 $qossettings { 'VALID' } = 'no' ;
926 $message = "Die Klassennummer passt nicht zum angegebenen Interface." ;
928 } elsif ( $qossettings { 'DEVICE' } eq $qossettings { 'IMQ_DEV' } ) {
929 if ( $qossettings { 'CLASS' } lt 200 || $qossettings { 'CLASS' } ge 221 ) {
930 $qossettings { 'VALID' } = 'no' ;
931 $message = "Die Klassennummer passt nicht zum angegebenen Interface." ;
934 open ( FILE
, "< $classfile " ) or die "Unable to read $classfile " ;
937 foreach $classentry ( sort @tmp )
939 @tmpline = split ( /\;/ , $classentry );
940 if ( $tmpline [ 1 ] eq $qossettings { 'CLASS' } )
942 $qossettings { 'VALID' } = 'no' ;
943 $message = "Die aktuelle Klasse wird bereits verwendet." ;
950 if ( $qossettings { 'VALID' } eq 'yes' ) {
951 open ( FILE
, "< $subclassfile " ) or die "Unable to read $subclassfile " ;
954 foreach $subclassentry ( sort @tmp )
956 @tmpline = split ( /\;/ , $subclassentry );
957 if ( $tmpline [ 2 ] eq $qossettings { 'SCLASS' } )
959 $qossettings { 'VALID' } = 'no' ;
960 $message = "Die aktuelle Klasse wird bereits verwendet." ;