]>
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" ;
22 my $errormessage = "" ;
27 & General
:: readhash
( "${General::swroot}/ethernet/settings" , \
%netsettings );
29 & Header
:: showhttpheaders
();
31 $qossettings { 'ENABLED' } = 'off' ;
32 $qossettings { 'OUT_SPD' } = '' ;
33 $qossettings { 'INC_SPD' } = '' ;
34 $qossettings { 'DEFCLASS_INC' } = '' ;
35 $qossettings { 'DEFCLASS_OUT' } = '' ;
36 $qossettings { 'ACK' } = '' ;
37 $qossettings { 'RED_DEV' } = `cat /var/ipfire/red/iface` ;
38 $qossettings { 'IMQ_DEV' } = 'imq0' ;
40 & General
:: readhash
( "${General::swroot}/qos/settings" , \
%qossettings );
41 & Header
:: getcgihash
( \
%qossettings );
43 & Header
:: openpage
( 'QoS' , 1 , '' );
44 & Header
:: openbigbox
( '100%' , 'left' , '' , $errormessage );
46 if ( $qossettings { 'ACTION' } eq 'Start' )
48 system ( "/bin/touch /var/ipfire/qos/enable" );
49 $qossettings { 'ENABLED' } = 'on' ;
50 & General
:: writehash
( "${General::swroot}/qos/settings" , \
%qossettings );
52 elsif ( $qossettings { 'ACTION' } eq 'Stop' )
54 unlink "/var/ipfire/qos/enable" ;
55 $qossettings { 'ENABLED' } = 'off' ;
56 & General
:: writehash
( "${General::swroot}/qos/settings" , \
%qossettings );
58 elsif ( $qossettings { 'ACTION' } eq $Lang :: tr
{ 'save' })
60 & General
:: writehash
( "${General::swroot}/qos/settings" , \
%qossettings );
62 elsif ( $qossettings { 'ACTION' } eq 'Parentklasse hinzufuegen' )
65 & Header
:: closebigbox
();
69 elsif ( $qossettings { 'ACTION' } eq 'Level7-Regel hinzufuegen' )
72 & Header
:: closebigbox
();
76 if ( $qossettings { 'ACTION_BW' } eq 'Andern' )
79 & Header
:: closebigbox
();
83 if ( $qossettings { 'ACTION_DEF' } eq 'Andern' )
86 & Header
:: closebigbox
();
91 & General
:: readhash
( "${General::swroot}/qos/settings" , \
%qossettings );
93 my $status = $Lang :: tr
{ 'stopped' };
94 my $statuscolor = $Header :: colourred
;
95 if ( $qossettings { 'ENABLED' } eq 'on' ) {
96 $status = $Lang :: tr
{ 'running' };
97 $statuscolor = $Header :: colourgreen
;
100 if ( $netsettings { 'RED_TYPE' } ne 'PPPOE' ) {
101 $qossettings { 'RED_DEV' } = $netsettings { 'RED_DEV' };
105 & Header
:: openbox
( '100%' , 'left' , $Lang :: tr
{ 'error messages' });
106 print "<class name='base'> $errormessage \n " ;
107 print " </class> \n " ;
111 & Header
:: openbox
( '100%' , 'center' , 'Quality of Service' );
113 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
115 <tr><td width='50%' align='left'><b>Quality of Service:</b>
116 <td width='50%' align='center' bgcolor=' $statuscolor '><font color='white'> $status </font>
117 <tr><td width='100%' align='center' colspan='2'>
118 <input type='submit' name='ACTION' value='Start' />
119 <input type='submit' name='ACTION' value='Stop' />
120 <input type='submit' name='ACTION' value=' $Lang ::tr{'restart'}' />
123 if (( $qossettings { 'OUT_SPD' } ne '' ) && ( $qossettings { 'INC_SPD' } ne '' )) {
125 <tr><td colspan='3'>
126 <tr><td width='40%' align='right'>Downloadgeschwindigkeit: <td width='40%' align='left'> $qossettings {'INC_SPD'} kbps
127 <td width='20%' rowspan='2' align='center' valign='middle'><input type='submit' name='ACTION_BW' value='Andern'>
128 <tr><td width='40%' align='right'>Uploadgeschwindigkeit: <td width='40%' align='left'> $qossettings {'OUT_SPD'} kbps
132 if (( $qossettings { 'DEFCLASS_OUT' } ne '' ) && ( $qossettings { 'DEFCLASS_INC' } ne '' )&& ( $qossettings { 'ACK' } ne '' )) {
134 <tr><td colspan='3'><hr>
135 <tr><td width='40%' align='right'>Downloadstandardklasse: <td width='40%' align='left'> $qossettings {'DEFCLASS_INC'}
136 <td width='20%' rowspan='3' align='center' valign='middle'><input type='submit' name='ACTION_DEF' value='Andern'>
137 <tr><td width='40%' align='right'>Uploadstandardklasse: <td width='40%' align='left'> $qossettings {'DEFCLASS_OUT'}
138 <tr><td width='40%' align='right'>ACKs: <td width='40%' align='left'> $qossettings {'ACK'}
139 <tr><td colspan='3' width='100%'><hr>
140 <tr><td colspan='3' width='100%' align='center'><input type='submit' name='ACTION' value='Parentklasse hinzufuegen'>
141 <tr><td colspan='3' width='100%' align='center'>Nur temporaer >>> <input type='submit' name='ACTION' value='Level7-Regel hinzufuegen'> <<<
148 if ( ( $qossettings { 'OUT_SPD' } eq '' ) || ( $qossettings { 'INC_SPD' } eq '' ) ) {
151 & Header
:: closebigbox
();
152 & Header
:: closepage
();
156 if ( ( $qossettings { 'DEFCLASS_INC' } eq '' ) || ( $qossettings { 'DEFCLASS_OUT' } eq '' ) || ( $qossettings { 'ACK' } eq '' ) ) {
158 & Header
:: closebigbox
();
159 & Header
:: closepage
();
164 # &Header::openbox('100%', 'center', 'Outgoing Interface');
166 # <table border='0' width='100%' cellspacing='0'>
167 # <tr><td bgcolor='lightgrey' width='20%'>Interface<td bgcolor='lightgrey' width='20%'>Klasse<td bgcolor='lightgrey' width='20%'>Maximale Geschwindigkeit<td bgcolor='lightgrey' width='40%'>Aktionen
171 # &Header::closebox();
173 & Header
:: closebigbox
();
174 & Header
:: closepage
();
176 # ---------------------------------------------------------------------------------------------------------------------------------
178 sub changedefclasses
{
179 & Header
:: openbox
( '100%' , 'center' , 'Standardklassen:' );
181 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
183 <tr><td width='100%' colspan='3'>Legen sie hier die Standardklassen fest durch die nicht-gefilterte Pakete gehen.
184 <tr><td width='33%' align='right'>Download:<td width='33%' align='left'><select name='DEFCLASS_INC'>
187 for ( $c = 100 ; $c <= 120 ; $c ++ )
189 if ( $qossettings { 'DEFCLASS_INC' } ne $c )
191 print "<option value=' $c '> $c </option> \n " ;
195 print "<option selected value=' $c '> $c </option> \n " ;
199 </select><td width='33%' align='center'>
200 <tr><td width='33%' align='right'>Upload:<td width='33%' align='left'><select name='DEFCLASS_OUT'>
203 for ( $c = 200 ; $c <= 220 ; $c ++ )
205 if ( $qossettings { 'DEFCLASS_OUT' } ne $c )
207 print "<option value=' $c '> $c </option> \n " ;
211 print "<option selected value=' $c '> $c </option> \n " ;
215 </select><td width='33%' align='center'>
219 <tr><td width='100%' colspan='3'>Legen sie hier die ACK-Klasse fest <br> und klicken Sie danach auf <i>Speichern</i>.
220 <tr><td width='33%' align='right'>ACKs:<td width='33%' align='left'><select name='ACK'>
223 for ( $c = 200 ; $c <= 220 ; $c ++ )
225 if ( $qossettings { 'ACK' } ne $c )
227 print "<option value=' $c '> $c </option> \n " ;
231 print "<option selected value=' $c '> $c </option> \n " ;
235 </select><td width='33%' align='center'><input type='submit' name='ACTION' value= $Lang ::tr{'save'} />
243 sub changebandwidth
{
244 & Header
:: openbox
( '100%' , 'center' , 'Bandbreiteneinstellungen' );
245 if ( $qossettings { 'ENABLED' } eq 'on' ) {
246 print "Sie koennen die Bandbreiteneinstellungen nicht bearbeiten, wenn QoS eingeschaltet ist. Schalten sie es zuerst dazu aus.<p>" ;
247 print "<a href='/cgi-bin/qos.cgi'>Zurueck</a>" ;
250 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
252 <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>.
253 <tr><td width='33%' align='right'>Download-Geschwindigkeit:
254 <td width='33%' align='left'><input type='text' name='INC_SPD' maxlength='8' value= $qossettings {'INC_SPD'}> kbps
255 <td width='33%' align='center'>
256 <tr><td width='33%' align='right'>Upload-Geschwindigkeit:
257 <td width='33%' align='left'><input type='text' name='OUT_SPD' maxlength='8' value= $qossettings {'OUT_SPD'}> kbps
258 <td width='33%' align='center'><input type='submit' name='ACTION' value= $Lang ::tr{'save'} /> <input type='reset' name='ACTION' value= $Lang ::tr{'reset'} />
268 & Header
:: openbox
( '100%' , 'center' , 'Parentklasse hinzufuegen' );
270 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
272 <tr><td width='100%' colspan='3'>Geben sie die Daten ein <br> und klicken Sie danach auf <i>Speichern</i>.
273 <tr><td width='33%' align='right'>Interface:
274 <td width='33%' align='left'><select name='CLASS'>
275 <option value= $qossettings {'RED_DEV'}> $qossettings {'RED_DEV'}</option>
276 <option value= $qossettings {'IMQ_DEV'}> $qossettings {'IMQ_DEV'}</option></select>
277 <td width='33%' align='center'>
278 <tr><td width='33%' align='right'>Klasse:<td width='33%' align='left'><select name='CLASS'>
281 for ( $c = 100 ; $c <= 120 ; $c ++ )
283 if ( $qossettings { 'CLASS' } ne $c )
285 print "<option value=' $c '> $c </option> \n " ;
289 print "<option selected value=' $c '> $c </option> \n " ;
292 for ( $c = 200 ; $c <= 220 ; $c ++ )
294 if ( $qossettings { 'CLASS' } ne $c )
296 print "<option value=' $c '> $c </option> \n " ;
300 print "<option selected value=' $c '> $c </option> \n " ;
305 <td width='33%' align='center'>
306 <tr><td width='33%' align='right'>Prioritaet:<td width='33%' align='left'><select name='PRIO'>
309 for ( $c = 1 ; $c <= 7 ; $c ++ )
311 if ( $qossettings { 'PRIO' } ne $c )
313 print "<option value=' $c '> $c </option> \n " ;
317 print "<option selected value=' $c '> $c </option> \n " ;
321 <td width='33%' align='center'>
322 <tr><td width='33%' align='right'>Garantierte Bandbreite:
323 <td width='33%' align='left'><input type='text' name='MINBDWTH' maxlength='8' value= $qossettings {'MINBWDTH'}>
324 <td width='33%' align='center'>
325 <tr><td width='33%' align='right'>Maximale Bandbreite:
326 <td width='33%' align='left'><input type='text' name='MAXBDWTH' maxlength='8' value= $qossettings {'MAXBWDTH'}>
327 <td width='33%' align='center'>
328 <tr><td width='33%' align='right'>Burst:
329 <td width='33%' align='left'><input type='text' name='BURST' maxlength='8' value= $qossettings {'BURST'}>
330 <td width='33%' align='center'>
331 <tr><td width='33%' align='right'>Ceilburst:
332 <td width='33%' align='left'><input type='text' name='CBURST' maxlength='8' value= $qossettings {'CBURST'}>
333 <td width='33%' align='center'><input type='submit' name='ACTION' value= $Lang ::tr{'save'} />
341 & Header
:: openbox
( '100%' , 'center' , 'Level7-Regel hinzufuegen' );
343 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
345 <tr><td width='100%' colspan='3'>Geben sie die Daten ein <br> und klicken Sie danach auf <i>Speichern</i>.
346 <tr><td width='33%' align='right'>Name:
347 <td width='33%' align='left'><input type='text' name='NAME' maxlength='20' value= $qossettings {'NAME'}>
348 <td width='33%' align='center'>
349 <tr><td width='33%' align='right'>Protokoll:
350 <td width='33%' align='left'><select name='L7PROT'>
353 opendir ( DIR
, "/etc/l7-protocols/protocols" );
354 foreach $direntry ( sort readdir ( DIR
) )
356 next if $direntry eq "." ;
357 next if $direntry eq ".." ;
358 next if - d
"/etc/l7-protocols/protocols/ $direntry " ;
359 @proto = split ( /\./ , $direntry );
360 if ( $proto [ 0 ] eq $qossettings { 'L7PROT' } ) {
361 print "<option value=' $proto [0]' selected> $proto [0]</option> \n " ;
363 print "<option value=' $proto [0]'> $proto [0]</option> \n " ;
368 </select><td width='33%' align='center'>
369 <tr><td width='33%' align='right'>Quell-IP-Adresse:
370 <td width='33%' align='left'><input type='text' name='QIP' maxlength='15' value= $qossettings {'QIP'}>
371 <td width='33%' align='center'>
372 <tr><td width='33%' align='right'>Ziel-IP-Adresse:
373 <td width='33%' align='left'><input type='text' name='DIP' maxlength='15' value= $qossettings {'DIP'}>
374 <td width='33%' align='center'><input type='submit' name='ACTION' value= $Lang ::tr{'save'} />