Bash bearbeitet, da der Bootpromt nicht richtig arbeitete.
[people/pmueller/ipfire-2.x.git] / html / cgi-bin / qos.cgi
1 #!/usr/bin/perl
2 #
3 # IPFire CGIs
4 #
5 # This code is distributed under the terms of the GPL
6 #
7 # (c) The IPFire Team
8 #
9
10 use RRDs;
11 use strict;
12 # enable only the following on debugging purpose
13 # use warnings;
14 use CGI::Carp 'fatalsToBrowser';
15
16 require '/var/ipfire/general-functions.pl';
17 require "${General::swroot}/lang.pl";
18 require "${General::swroot}/header.pl";
19
20 my %qossettings = ();
21 my %checked = ();
22 my %netsettings = ();
23 my $message = '';
24 my $errormessage = "";
25 my $c = "";
26 my $direntry = "";
27 my $classentry = "";
28 my $subclassentry = "";
29 my $l7ruleentry = "";
30 my $portruleentry = "";
31 my $tosruleentry = "";
32 my @tmp = ();
33 my @classes = ();
34 my @subclasses = ();
35 my @l7rules = ();
36 my @portrules = ();
37 my @tosrules = ();
38 my @tmpline = ();
39 my @classline = ();
40 my @subclassline = ();
41 my @l7ruleline = ();
42 my @portruleline = ();
43 my @tosruleline = ();
44 my @proto = ();
45 my %selected= ();
46 my @checked = ();
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);
53
54 &Header::showhttpheaders();
55
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'} = '';
100
101
102 &General::readhash("${General::swroot}/qos/settings", \%qossettings);
103 &Header::getcgihash(\%qossettings);
104
105 &Header::openpage('QoS', 1, '');
106 &Header::openbigbox('100%', 'left', '', $errormessage);
107
108 ############################################################################################################################
109 ############################################################################################################################
110
111 if ($qossettings{'DOCLASS'} eq $Lang::tr{'save'})
112 {
113 &validclass();
114 &validminbwdth();
115 &validmaxbwdth();
116 if ( $qossettings{'VALID'} eq 'yes' ) {
117 open( FILE, ">> $classfile" ) or die "Unable to write $classfile";
118 print FILE <<END
119 $qossettings{'DEVICE'};$qossettings{'CLASS'};$qossettings{'PRIO'};$qossettings{'MINBWDTH'};$qossettings{'MAXBWDTH'};$qossettings{'BURST'};$qossettings{'CBURST'};$qossettings{'TOS'};
120 END
121 ;
122 close FILE;
123 } else {
124 $qossettings{'ACTION'} = 'Parentklasse hinzufuegen';
125 }
126 }
127 elsif ($qossettings{'DOCLASS'} eq 'Bearbeiten')
128 {
129 open( FILE, "< $classfile" ) or die "Unable to read $classfile";
130 @classes = <FILE>;
131 close FILE;
132 open( FILE, "> $classfile" ) or die "Unable to write $classfile";
133 foreach $classentry (sort @classes)
134 {
135 @classline = split( /\;/, $classentry );
136 if ( $classline[1] ne $qossettings{'CLASS'} ) {
137 print FILE $classentry;
138 } else {
139 $qossettings{'DEVICE'} = $classline[0];
140 $qossettings{'PRIO'} = $classline[2];
141 $qossettings{'MINBWDTH'} = $classline[3];
142 $qossettings{'MAXBWDTH'} = $classline[4];
143 $qossettings{'BURST'} = $classline[5];
144 $qossettings{'CBURST'} = $classline[6];
145 $qossettings{'EDIT'} = 'yes';
146 }
147 }
148 close FILE;
149 &parentclass();
150 &Header::closebigbox();
151 &Header::closepage();
152 exit
153 }
154 elsif ($qossettings{'DOCLASS'} eq 'Loeschen')
155 {
156 open( FILE, "< $classfile" ) or die "Unable to read $classfile";
157 @tmp = <FILE>;
158 close FILE;
159 open( FILE, "> $classfile" ) or die "Unable to write $classfile";
160 foreach $classentry (sort @tmp)
161 {
162 @tmpline = split( /\;/, $classentry );
163 if ( $tmpline[1] ne $qossettings{'CLASS'} )
164 {
165 print FILE $classentry;
166 }
167 }
168 close FILE;
169 open( FILE, "< $subclassfile" ) or die "Unable to read $classfile";
170 @tmp = <FILE>;
171 close FILE;
172 open( FILE, "> $subclassfile" ) or die "Unable to write $classfile";
173 foreach $subclassentry (sort @tmp)
174 {
175 @tmpline = split( /\;/, $subclassentry );
176 if ( $tmpline[1] ne $qossettings{'CLASS'} )
177 {
178 print FILE $subclassentry;
179 }
180 }
181 close FILE;
182 $message = "Klasse $qossettings{'CLASS'} wurde mit eventuell vorhandenen Unterklassen geloescht.";
183 }
184
185 ############################################################################################################################
186 ############################################################################################################################
187
188 if ($qossettings{'DOSCLASS'} eq $Lang::tr{'save'})
189 {
190 &validsubclass();
191 &validminbwdth();
192 if ( $qossettings{'VALID'} eq 'yes' ) {
193 open( FILE, ">> $subclassfile" ) or die "Unable to write $subclassfile";
194 print FILE <<END
195 $qossettings{'DEVICE'};$qossettings{'CLASS'};$qossettings{'SCLASS'};$qossettings{'PRIO'};$qossettings{'MINBWDTH'};$qossettings{'MAXBWDTH'};$qossettings{'BURST'};$qossettings{'CBURST'};$qossettings{'TOS'};
196 END
197 ;
198 close FILE;
199 } else {
200 $qossettings{'ACTION'} = 'Unterklasse hinzufuegen';
201 }
202 } elsif ($qossettings{'DOSCLASS'} eq 'Loeschen')
203 {
204 open( FILE, "< $subclassfile" ) or die "Unable to read $classfile";
205 @tmp = <FILE>;
206 close FILE;
207 open( FILE, "> $subclassfile" ) or die "Unable to write $classfile";
208 foreach $subclassentry (sort @tmp)
209 {
210 @tmpline = split( /\;/, $subclassentry );
211 if ( $tmpline[2] ne $qossettings{'CLASS'} )
212 {
213 print FILE $subclassentry;
214 }
215 }
216 close FILE;
217 $message = "Unterklasse $qossettings{'CLASS'} wurde geloescht.";
218 }
219
220 ############################################################################################################################
221 ############################################################################################################################
222
223 if ($qossettings{'DOLEVEL7'} eq $Lang::tr{'save'})
224 {
225 if ( $qossettings{'QIP'} ne '' ) {
226 unless ( &General::validip($qossettings{'QIP'}) ) {
227 $qossettings{'VALID'} = 'no';
228 $message = "Die Quell-IP-Adresse ist ungueltig.";
229 }
230 }
231 if ( $qossettings{'DIP'} ne '' ) {
232 unless ( &General::validip($qossettings{'DIP'}) ) {
233 $qossettings{'VALID'} = 'no';
234 $message = "Die Ziel-IP-Adresse ist ungueltig.";
235 }
236 }
237 if ($qossettings{'CLASS'} >= 100 && $qossettings{'CLASS'} < 121) {
238 $qossettings{'DEVICE'} = $qossettings{'RED_DEV'};
239 } elsif ($qossettings{'CLASS'} >= 1000 && $qossettings{'CLASS'} < 1021) {
240 $qossettings{'DEVICE'} = $qossettings{'RED_DEV'};
241 } elsif ($qossettings{'CLASS'} >= 200 && $qossettings{'CLASS'} < 221) {
242 $qossettings{'DEVICE'} = $qossettings{'IMQ_DEV'};
243 } elsif ($qossettings{'CLASS'} >= 2000 && $qossettings{'CLASS'} < 2021) {
244 $qossettings{'DEVICE'} = $qossettings{'IMQ_DEV'};
245 }
246 if ( $qossettings{'VALID'} eq 'yes' ) {
247 open( FILE, ">> $level7file" ) or die "Unable to write $level7file";
248 print FILE <<END
249 $qossettings{'CLASS'};$qossettings{'DEVICE'};$qossettings{'L7PROT'};$qossettings{'QIP'};$qossettings{'DIP'};
250 END
251 ;
252 close FILE;
253 } else {
254 $qossettings{'ACTION'} = 'Level7-Regel hinzufuegen';
255 }
256 }
257 elsif ($qossettings{'DOLEVEL7'} eq 'Loeschen')
258 {
259 open( FILE, "< $level7file" ) or die "Unable to read $level7file";
260 @l7rules = <FILE>;
261 close FILE;
262 open( FILE, "> $level7file" ) or die "Unable to read $level7file";
263 foreach $l7ruleentry (sort @l7rules)
264 {
265 @l7ruleline = split( /\;/, $l7ruleentry );
266 if ( ($l7ruleline[0] ne $qossettings{'CLASS'}) && ($l7ruleline[2] ne $qossettings{'L7PROT'}))
267 {
268 print FILE $l7ruleentry;
269 }
270 }
271 close FILE;
272 $message = "Level7-Regel ($qossettings{'CLASS'} - $qossettings{'L7PROT'}) wurde geloescht.";
273 }
274
275 ############################################################################################################################
276 ############################################################################################################################
277
278 if ($qossettings{'DOPORT'} eq $Lang::tr{'save'})
279 {
280 if ( $qossettings{'QIP'} ne '' ) {
281 unless ( &General::validip($qossettings{'QIP'}) ) {
282 $qossettings{'VALID'} = 'no';
283 $message = "Die Quell-IP-Adresse ist ungueltig.";
284 }
285 }
286 if ( $qossettings{'DIP'} ne '' ) {
287 unless ( &General::validip($qossettings{'DIP'}) ) {
288 $qossettings{'VALID'} = 'no';
289 $message = "Die Ziel-IP-Adresse ist ungueltig.";
290 }
291 }
292 if ($qossettings{'CLASS'} >= 100 && $qossettings{'CLASS'} < 121) {
293 $qossettings{'DEVICE'} = $qossettings{'RED_DEV'};
294 } elsif ($qossettings{'CLASS'} >= 1000 && $qossettings{'CLASS'} < 1021) {
295 $qossettings{'DEVICE'} = $qossettings{'RED_DEV'};
296 } elsif ($qossettings{'CLASS'} >= 200 && $qossettings{'CLASS'} < 221) {
297 $qossettings{'DEVICE'} = $qossettings{'IMQ_DEV'};
298 } elsif ($qossettings{'CLASS'} >= 2000 && $qossettings{'CLASS'} < 2021) {
299 $qossettings{'DEVICE'} = $qossettings{'IMQ_DEV'};
300 }
301 if ( $qossettings{'VALID'} eq 'yes' ) {
302 open( FILE, ">> $portfile" ) or die "Unable to write $portfile";
303 print FILE <<END
304 $qossettings{'CLASS'};$qossettings{'DEVICE'};$qossettings{'PPROT'};$qossettings{'QIP'};$qossettings{'QPORT'};$qossettings{'DIP'};$qossettings{'DPORT'};
305 END
306 ;
307 close FILE;
308 } else {
309 $qossettings{'ACTION'} = 'Port-Regel hinzufuegen';
310 }
311 } elsif ($qossettings{'DOPORT'} eq 'Loeschen')
312 {
313 open( FILE, "< $portfile" ) or die "Unable to read $portfile";
314 @portrules = <FILE>;
315 close FILE;
316 open( FILE, "> $portfile" ) or die "Unable to read $portfile";
317 foreach $portruleentry (sort @portrules)
318 {
319 @portruleline = split( /\;/, $portruleentry );
320 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'}))
321 {
322 print FILE $portruleentry;
323 }
324 }
325 close FILE;
326 $message = "Port-Regel ($qossettings{'CLASS'} - $qossettings{'PPROT'}) wurde geloescht.";
327 }
328
329 ############################################################################################################################
330 ############################################################################################################################
331
332 if ($qossettings{'DOTOS'} eq $Lang::tr{'save'})
333 {
334 if ($qossettings{'CLASS'} >= 100 && $qossettings{'CLASS'} < 121) {
335 $qossettings{'DEVICE'} = $qossettings{'RED_DEV'};
336 } elsif ($qossettings{'CLASS'} >= 1000 && $qossettings{'CLASS'} < 1021) {
337 $qossettings{'DEVICE'} = $qossettings{'RED_DEV'};
338 } elsif ($qossettings{'CLASS'} >= 200 && $qossettings{'CLASS'} < 221) {
339 $qossettings{'DEVICE'} = $qossettings{'IMQ_DEV'};
340 } elsif ($qossettings{'CLASS'} >= 2000 && $qossettings{'CLASS'} < 2021) {
341 $qossettings{'DEVICE'} = $qossettings{'IMQ_DEV'};
342 }
343 open( FILE, ">> $tosfile" ) or die "Unable to write $tosfile";
344 print FILE <<END
345 $qossettings{'CLASS'};$qossettings{'DEVICE'};$qossettings{'TOS'};
346 END
347 ;
348 close FILE;
349 }
350 elsif ($qossettings{'DOTOS'} eq 'Loeschen')
351 {
352 open( FILE, "< $tosfile" ) or die "Unable to read $tosfile";
353 @tosrules = <FILE>;
354 close FILE;
355 open( FILE, "> $tosfile" ) or die "Unable to read $tosfile";
356 foreach $tosruleentry (sort @tosrules)
357 {
358 @tosruleline = split( /\;/, $tosruleentry );
359 unless ( ($tosruleline[0] eq $qossettings{'CLASS'}) && ($tosruleline[2] eq $qossettings{'TOS'}))
360 {
361 print FILE $tosruleentry;
362 }
363 }
364 close FILE;
365 $message = "TOS-Regel ($qossettings{'CLASS'} - $qossettings{'TOS'}) wurde geloescht.";
366 } elsif ($qossettings{'DOTOS'} eq 'Bearbeiten')
367 {
368 open( FILE, "< $tosfile" ) or die "Unable to read $tosfile";
369 @tosrules = <FILE>;
370 close FILE;
371 open( FILE, "> $tosfile" ) or die "Unable to write $tosfile";
372 foreach $tosruleentry (sort @tosrules)
373 {
374 @tosruleline = split( /\;/, $tosruleentry );
375 if (( $tosruleline[0] eq $qossettings{'CLASS'} ) && ( $tosruleline[2] eq $qossettings{'TOS'} )) {
376 $qossettings{'DEVICE'} = $tosruleline[1];
377 $qossettings{'CLASS'} = $tosruleline[0];
378 $qossettings{'TOS'} = $tosruleline[2];
379 $qossettings{'EDIT'} = 'yes';
380 } else {
381 print FILE $tosruleentry;
382 }
383 }
384 close FILE;
385 &tosrule();
386 &Header::closebigbox();
387 &Header::closepage();
388 exit
389 }
390
391 ############################################################################################################################
392 ############################################################################################################################
393
394 if ($qossettings{'ACTION'} eq 'Start')
395 {
396 system("/usr/local/bin/qosctrl generate >/dev/null 2>&1");
397 system("/bin/touch /var/ipfire/qos/enable");
398 system("/usr/local/bin/qosctrl start >/dev/null 2>&1");
399 system("logger -t ipfire 'QoS started'");
400 $qossettings{'ENABLED'} = 'on';
401 &General::writehash("${General::swroot}/qos/settings", \%qossettings);
402 }
403 elsif ($qossettings{'ACTION'} eq 'Stop')
404 {
405 system("/usr/local/bin/qosctrl stop >/dev/null 2>&1");
406 unlink "/var/ipfire/qos/bin/qos.sh";
407 unlink "/var/ipfire/qos/enable";
408 system("logger -t ipfire 'QoS stopped'");
409 $qossettings{'ENABLED'} = 'off';
410 &General::writehash("${General::swroot}/qos/settings", \%qossettings);
411 }
412 elsif ($qossettings{'ACTION'} eq 'Neustart')
413 {
414 if ($qossettings{'ENABLED'} eq 'on'){
415 system("/usr/local/bin/qosctrl stop >/dev/null 2>&1");
416 system("/usr/local/bin/qosctrl generate >/dev/null 2>&1");
417 system("/usr/local/bin/qosctrl start >/dev/null 2>&1");
418 system("logger -t ipfire 'QoS restarted'");
419 }
420 }
421 elsif ($qossettings{'ACTION'} eq $Lang::tr{'save'})
422 {
423 if ($qossettings{'DEF_INC_SPD'} eq '') {
424 $qossettings{'DEF_INC_SPD'} = int($qossettings{'INC_SPD'} * 0.9);
425 }
426 if ($qossettings{'DEF_OUT_SPD'} eq '') {
427 $qossettings{'DEF_OUT_SPD'} = int($qossettings{'OUT_SPD'} * 0.9);
428 }
429 &General::writehash("${General::swroot}/qos/settings", \%qossettings);
430 }
431 elsif ($qossettings{'ACTION'} eq 'Statusinformationen')
432 {
433 &Header::openbox('100%', 'left', 'QoS Status');
434 if ($qossettings{'ENABLED'} eq 'on'){
435 my $output = "";
436 $output = `/usr/local/bin/qosctrl status`;
437 $output = &Header::cleanhtml($output,"y");
438 print "<pre>$output</pre>\n";
439 } else { print "QoS ist nicht aktiviert!"; }
440 &Header::closebox();
441 &Header::closebigbox();
442 &Header::closepage();
443 exit
444 }
445 elsif ($qossettings{'ACTION'} eq 'Grafische Auswertung')
446 {
447 open( FILE, "< $classfile" ) or die "Unable to read $classfile";
448 @classes = <FILE>;
449 close FILE;
450 open( FILE, "< $subclassfile" ) or die "Unable to read $subclassfile";
451 @subclasses = <FILE>;
452 close FILE;
453 &Header::openbox('100%', 'left', 'QoS Graphen');
454 print <<END
455 <table width='100%'> <tr><td align='center'><font color='red'>Diese Seite braucht je nach Geschwindigkeit des Computers laenger zum Laden.</font>
456 <tr><td align='center'><b>Klasse:</b>
457 END
458 ;
459 foreach $classentry (sort @classes)
460 {
461 @classline = split( /\;/, $classentry );
462 $qossettings{'CLASS'}=$classline[1];
463 print <<END
464 <input type="button" onClick="swapVisibility('$qossettings{'CLASS'}')" value='$qossettings{'CLASS'}'>
465 END
466 ;
467 }
468 print <<END
469 </table>
470 END
471 ;
472 &Header::closebox();
473 foreach $classentry (sort @classes)
474 {
475 @classline = split( /\;/, $classentry );
476 $qossettings{'DEV'}=$classline[0];
477 $qossettings{'CLASS'}=$classline[1];
478 &gengraph($qossettings{'DEV'},$qossettings{'CLASS'});
479 print "<div id='$qossettings{'CLASS'}' style='display: none'>";
480 &Header::openbox('100%', 'center', "$qossettings{'CLASS'} ($qossettings{'DEV'})");
481 print <<END
482 <table>
483 <tr><td colspan='2' align='center'><img src='/graphs/class_$qossettings{'CLASSPRFX'}-$qossettings{'CLASS'}_$qossettings{'DEV'}-packets.png'>
484 <tr><td colspan='2' align='center'><img src='/graphs/class_$qossettings{'CLASSPRFX'}-$qossettings{'CLASS'}_$qossettings{'DEV'}-borrowed.png'>
485 <tr><td colspan='2' align='center'><img src='/graphs/class_$qossettings{'CLASSPRFX'}-$qossettings{'CLASS'}_$qossettings{'DEV'}-bytes.png'>
486 END
487 ;
488 foreach $subclassentry (sort @subclasses)
489 {
490 @subclassline = split( /\;/, $subclassentry );
491 if ($subclassline[1] eq $classline[1]) {
492 $qossettings{'DEV'}=$subclassline[0];
493 $qossettings{'SCLASS'}=$subclassline[2];
494 &gengraph($qossettings{'DEV'},$qossettings{'SCLASS'});
495 print <<END
496 <tr><td colspan='2' align='center'><img src='/graphs/class_$qossettings{'CLASSPRFX'}-$qossettings{'SCLASS'}_$qossettings{'DEV'}-packets.png'>
497 <tr><td colspan='2' align='center'><img src='/graphs/class_$qossettings{'CLASSPRFX'}-$qossettings{'SCLASS'}_$qossettings{'DEV'}-borrowed.png'>
498 <tr><td colspan='2' align='center'><img src='/graphs/class_$qossettings{'CLASSPRFX'}-$qossettings{'SCLASS'}_$qossettings{'DEV'}-bytes.png'>
499 END
500 ;
501 }
502 }
503 print "\t\t</table>";
504 &Header::closebox();
505 print "</div>\n";
506 }
507 print <<END
508 </table>
509 END
510 ;
511 &Header::closebox();
512 &Header::closebigbox();
513 &Header::closepage();
514 exit
515 }
516 elsif ($qossettings{'ACTION'} eq 'Parentklasse hinzufuegen')
517 {
518 &parentclass();
519 &Header::closebigbox();
520 &Header::closepage();
521 exit
522 }
523 elsif ($qossettings{'ACTION'} eq 'Unterklasse hinzufuegen')
524 {
525 &subclass();
526 &Header::closebigbox();
527 &Header::closepage();
528 exit
529 }
530 elsif ($qossettings{'ACTION'} eq 'Regel hinzufuegen')
531 {
532 &Header::openbox('100%', 'center', 'Regel hinzufuegen');
533 print <<END
534 <table>
535 <tr><td align='center'>Waehlen sie <u>eine</u> der untenstehenden Regeln aus.
536 <tr><td align='center'>
537 <input type="button" onClick="swapVisibility('l7rule')" value='Level7-Regel'>
538 <input type="button" onClick="swapVisibility('portrule')" value='Port-Regel'>
539 <input type="button" onClick="swapVisibility('tosrule')" value='TOS-Regel'>
540 </table>
541 END
542 ;
543 &Header::closebox();
544 print <<END
545 <div id='l7rule' style='display: none'>
546 END
547 ;
548 &level7rule();
549 print <<END
550 </div>
551 <div id='portrule' style='display: none'>
552 END
553 ;
554 &portrule();
555 print <<END
556 </div>
557 <div id='tosrule' style='display: none'>
558 END
559 ;
560 &tosrule();
561 print <<END
562 </div>
563 END
564 ;
565 &Header::closebigbox();
566 &Header::closepage();
567 exit
568 }
569 elsif ($qossettings{'ACTION'} eq 'Erweiterte Einstellungen')
570 {
571 &expert();
572 &Header::closebigbox();
573 &Header::closepage();
574 exit
575 }
576 if ($qossettings{'ACTIONBW'} eq 'Andern')
577 {
578 &changebandwidth();
579 &Header::closebigbox();
580 &Header::closepage();
581 exit
582 }
583 if ($qossettings{'ACTIONDEF'} eq 'Andern')
584 {
585 &changedefclasses();
586 &Header::closebigbox();
587 &Header::closepage();
588 exit
589 }
590
591 &General::readhash("${General::swroot}/qos/settings", \%qossettings);
592
593 my $status = $Lang::tr{'stopped'};
594 my $statuscolor = '#993333';
595 if ( $qossettings{'ENABLED'} eq 'on' ) {
596 $status = $Lang::tr{'running'};
597 $statuscolor = '#339933';
598 }
599
600 if ( $netsettings{'RED_TYPE'} ne 'PPPOE' ) {
601 $qossettings{'RED_DEV'} = $netsettings{'RED_DEV'};
602 }
603
604 if ($errormessage) {
605 &Header::openbox('100%', 'left', $Lang::tr{'error messages'});
606 print "<class name='base'>$errormessage\n";
607 print "&nbsp;</class>\n";
608 &Header::closebox();
609 }
610
611 ############################################################################################################################
612 ############################################################################################################################
613
614 &Header::openbox('100%', 'center', 'Quality of Service');
615 print <<END
616 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
617 <table width='33%'>
618 END
619 ;
620 if ( $message ne "" ) {
621 print "<tr><td colspan='2' align='center'><font color='red'>$message</font>";
622 }
623 print <<END
624 <tr><td width='50%' align='left'><b>Quality of Service:</b>
625 <td width='50%' align='center' bgcolor='$statuscolor'><font color='white'>$status</font>
626 <tr><td width='100%' align='center' colspan='2'>
627 <input type='submit' name='ACTION' value='Start' />
628 <input type='submit' name='ACTION' value='Stop' />
629 <input type='submit' name='ACTION' value='$Lang::tr{'restart'}' />
630 END
631 ;
632 if (($qossettings{'OUT_SPD'} ne '') && ($qossettings{'INC_SPD'} ne '')) {
633 print <<END
634 <tr><td colspan='3'>&nbsp;
635 <tr><td width='40%' align='right'>Downloadgeschwindigkeit: <td width='40%' align='left'>$qossettings{'INC_SPD'} kbps
636 <td width='20%' rowspan='2' align='center' valign='middle'><input type='submit' name='ACTIONBW' value='Andern'>
637 <tr><td width='40%' align='right'>Uploadgeschwindigkeit: <td width='40%' align='left'>$qossettings{'OUT_SPD'} kbps
638 END
639 ;
640 }
641 if (($qossettings{'DEFCLASS_OUT'} ne '') && ($qossettings{'DEFCLASS_INC'} ne '')&& ($qossettings{'ACK'} ne '')) {
642 print <<END
643 <tr><td colspan='3'><hr>
644 <tr><td width='40%' align='right'>Downloadstandardklasse: <td width='40%' align='left'>$qossettings{'DEFCLASS_INC'}
645 <td width='20%' rowspan='3' align='center' valign='middle'><input type='submit' name='ACTIONDEF' value='Andern'>
646 <tr><td width='40%' align='right'>Uploadstandardklasse: <td width='40%' align='left'>$qossettings{'DEFCLASS_OUT'}
647 <tr><td width='40%' align='right'>ACKs: <td width='40%' align='left'>$qossettings{'ACK'}
648 <tr><td colspan='3' width='100%'><hr>
649 <tr><td colspan='3' width='100%' align='center'>
650 <table boder='0' cellpadding='0' cellspacing='0'>
651 <tr><td><input type='submit' name='ACTION' value='Parentklasse hinzufuegen'>
652 <td><input type='submit' name='ACTION' value='Erweiterte Einstellungen'>
653 <tr><td><input type='submit' name='ACTION' value='Statusinformationen'>
654 <td><input type='submit' name='ACTION' value='Grafische Auswertung'>
655 </table>
656 </form>
657 END
658 ;
659 }
660 print "</table>";
661 &Header::closebox();
662
663 if ( ($qossettings{'OUT_SPD'} eq '') || ($qossettings{'INC_SPD'} eq '') ) {
664 &changebandwidth();
665 &Header::closebox();
666 &Header::closebigbox();
667 &Header::closepage();
668 exit
669 }
670
671 if ( ($qossettings{'DEFCLASS_INC'} eq '') || ($qossettings{'DEFCLASS_OUT'} eq '') || ($qossettings{'ACK'} eq '') ) {
672 &changedefclasses();
673 &Header::closebigbox();
674 &Header::closepage();
675 exit
676 }
677
678 &showclasses();
679 &showl7rules();
680 &showtosrules();
681 &showportrules();
682
683 &Header::closebigbox();
684 &Header::closepage();
685
686 ############################################################################################################################
687 ############################################################################################################################
688
689 sub changedefclasses {
690 &Header::openbox('100%', 'center', 'Standardklassen:');
691 print <<END
692 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
693 <table width='66%'>
694 <tr><td width='100%' colspan='3'>Legen sie hier die Standardklassen fest durch die nicht-gefilterte Pakete gehen.
695 <tr><td width='33%' align='right'>Download:<td width='33%' align='left'><select name='DEFCLASS_INC'>
696 END
697 ;
698 for ( $c = 200 ; $c <= 220 ; $c++ )
699 {
700 if ( $qossettings{'DEFCLASS_INC'} ne $c )
701 { print "<option value='$c'>$c</option>\n"; }
702 else { print "<option selected value='$c'>$c</option>\n"; }
703 }
704 print <<END
705 </select><td width='33%' align='center'>&nbsp;
706 <tr><td width='33%' align='right'>Upload:<td width='33%' align='left'><select name='DEFCLASS_OUT'>
707 END
708 ;
709 for ( $c = 100 ; $c <= 120 ; $c++ )
710 {
711 if ( $qossettings{'DEFCLASS_OUT'} ne $c )
712 { print "<option value='$c'>$c</option>\n"; }
713 else { print "<option selected value='$c'>$c</option>\n"; }
714 }
715 print <<END
716 </select><td width='33%' align='center'>&nbsp;
717 </table>
718 <hr>
719 <table width='66%'>
720 <tr><td width='100%' colspan='3'>Legen sie hier die ACK-Klasse fest <br> und klicken Sie danach auf <i>Speichern</i>.
721 <tr><td width='33%' align='right'>ACKs:<td width='33%' align='left'><select name='ACK'>
722 END
723 ;
724 for ( $c = 100 ; $c <= 120 ; $c++ )
725 {
726 if ( $qossettings{'ACK'} ne $c )
727 { print "<option value='$c'>$c</option>\n"; }
728 else { print "<option selected value='$c'>$c</option>\n"; }
729 }
730 print <<END
731 </select><td width='33%' align='center'><input type='submit' name='ACTION' value=$Lang::tr{'save'} />
732 </table>
733 </form>
734 END
735 ;
736 &Header::closebox();
737 }
738
739 sub changebandwidth {
740 &Header::openbox('100%', 'center', 'Bandbreiteneinstellungen');
741 if ($qossettings{'ENABLED'} eq 'on') {
742 print "Sie koennen die Bandbreiteneinstellungen nicht bearbeiten, wenn QoS eingeschaltet ist. Schalten sie es zuerst dazu aus.<p>";
743 print "<a href='/cgi-bin/qos.cgi'>Zurueck</a>";
744 } else {
745 print <<END
746 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
747 <input type='hidden' name='DEF_OUT_SPD' value=''><input type='hidden' name='DEF_INC_SPD' value=''>
748 <table width='66%'>
749 <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>.
750 <tr><td width='33%' align='right'>Download-Geschwindigkeit:
751 <td width='33%' align='left'><input type='text' name='INC_SPD' maxlength='8' value=$qossettings{'INC_SPD'}> &nbsp; kbps
752 <td width='33%' align='center'>&nbsp;
753 <tr><td width='33%' align='right'>Upload-Geschwindigkeit:
754 <td width='33%' align='left'><input type='text' name='OUT_SPD' maxlength='8' value=$qossettings{'OUT_SPD'}> &nbsp; kbps
755 <td width='33%' align='center'><input type='submit' name='ACTION' value=$Lang::tr{'save'} />&nbsp;<input type='reset' name='ACTION' value=$Lang::tr{'reset'} />
756 </table>
757 </form>
758 END
759 ;
760 }
761 &Header::closebox();
762 }
763
764 sub parentclass {
765 &Header::openbox('100%', 'center', 'Parentklasse');
766 print <<END
767 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
768 <table width='66%'>
769 END
770 ;
771 if ( $message ne "" ) {
772 print "<tr><td colspan='3' align='center'>$message";
773 }
774 if ( $qossettings{'EDIT'} eq 'yes' ) {
775 print "<input type='hidden' name='CLASS' value=$qossettings{'CLASS'}>";
776 print "<input type='hidden' name='DEVICE' value=$qossettings{'DEVICE'}>";
777 }
778 print <<END
779 <tr><td width='100%' colspan='3'>Geben sie die Daten ein <br> und klicken Sie danach auf <i>Speichern</i>.
780 <tr><td width='33%' align='right'>Interface:
781 <td width='33%' align='left'>
782 END
783 ;
784 if ( $qossettings{'EDIT'} eq 'yes' ) {
785 print "<select name='DEVICE' disabled>";
786 } else {
787 print "<select name='DEVICE'>";
788 }
789 if ( $qossettings{'DEVICE'} eq $qossettings{'RED_DEV'} ) {
790 $qossettings{'RED_DEV_SEL'} = 'selected';
791 } elsif ( $qossettings{'DEVICE'} eq $qossettings{'IMQ_DEV'} ) {
792 $qossettings{'IMQ_DEV_SEL'} = 'selected';
793 }
794 print <<END
795 <option value=$qossettings{'RED_DEV'} $qossettings{'RED_DEV_SEL'}>$qossettings{'RED_DEV'}</option>
796 <option value=$qossettings{'IMQ_DEV'} $qossettings{'IMQ_DEV_SEL'}>$qossettings{'IMQ_DEV'}</option></select>
797 <td width='33%' align='center'>&nbsp;
798 <tr><td width='33%' align='right'>Klasse:<td width='33%' align='left'>
799 END
800 ;
801 if ( $qossettings{'EDIT'} eq 'yes' ) {
802 print "<select name='CLASS' disabled>";
803 } else {
804 print "<select name='CLASS'>";
805 }
806 for ( $c = 100 ; $c <= 120 ; $c++ )
807 {
808 if ( $qossettings{'CLASS'} ne $c )
809 { print "<option value='$c'>$c</option>\n"; }
810 else { print "<option selected value='$c'>$c</option>\n"; }
811 }
812 for ( $c = 200 ; $c <= 220 ; $c++ )
813 {
814 if ( $qossettings{'CLASS'} ne $c )
815 { print "<option value='$c'>$c</option>\n"; }
816 else { print "<option selected value='$c'>$c</option>\n"; }
817 }
818 print <<END
819 </select>
820 <td width='33%' align='center'>&nbsp;
821 <tr><td width='33%' align='right'>Prioritaet:<td width='33%' align='left'><select name='PRIO'>
822 END
823 ;
824 for ( $c = 1 ; $c <= 7 ; $c++ )
825 {
826 if ( $qossettings{'PRIO'} ne $c )
827 { print "<option value='$c'>$c</option>\n"; }
828 else { print "<option selected value='$c'>$c</option>\n"; }
829 }
830 print <<END
831 <td width='33%' align='center'>&nbsp;
832 <tr><td width='33%' align='right'>Garantierte Bandbreite:
833 <td width='33%' align='left'><input type='text' name='MINBWDTH' maxlength='8' required='1' value=$qossettings{'MINBWDTH'} >
834 <td width='33%' align='center'>&nbsp;
835 <tr><td width='33%' align='right'>Maximale Bandbreite:
836 <td width='33%' align='left'><input type='text' name='MAXBWDTH' maxlength='8' required='1' value=$qossettings{'MAXBWDTH'}>
837 <td width='33%' align='center'>&nbsp;
838 <tr><td width='33%' align='right'>Burst:
839 <td width='33%' align='left'><input type='text' name='BURST' maxlength='8' value=$qossettings{'BURST'}>
840 <td width='33%' align='center'>&nbsp;
841 <tr><td width='33%' align='right'>Ceilburst:
842 <td width='33%' align='left'><input type='text' name='CBURST' maxlength='8' value=$qossettings{'CBURST'}>
843 <td width='33%' align='center'>&nbsp;
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'><input type='submit' name='DOCLASS' value=$Lang::tr{'save'} />&nbsp;<input type='reset' value=$Lang::tr{'reset'} />
852 </table></form>
853 END
854 ;
855 &Header::closebox();
856 }
857
858 sub subclass {
859 &Header::openbox('100%', 'center', 'Unterklasse');
860 print <<END
861 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
862 <table width='66%'>
863 END
864 ;
865 if ( $message ne "" ) {
866 print "<tr><td colspan='3' align='center'>$message";
867 }
868 print <<END
869 <tr><td colspan='3' width='100%'>Aktuelle Klasse: $qossettings{'CLASS'}
870 <tr><td width='100%' colspan='3'>Geben sie die Daten ein <br> und klicken Sie danach auf <i>Speichern</i>.
871 <tr><td width='33%' align='right'>Unterklasse:<td width='33%' align='left'><select name='SCLASS'>
872 END
873 ;
874 if ($qossettings{'CLASS'} >= 100 && $qossettings{'CLASS'} < 121) {
875 $qossettings{'DEVICE'} = $qossettings{'RED_DEV'};
876 for ( $c = 1000 ; $c <= 1020 ; $c++ )
877 {
878 if ( $qossettings{'SCLASS'} ne $c )
879 { print "<option value='$c'>$c</option>\n"; }
880 else { print "<option selected value='$c'>$c</option>\n"; }
881 }
882 } elsif ($qossettings{'CLASS'} >= 200 && $qossettings{'CLASS'} < 221) {
883 $qossettings{'DEVICE'} = $qossettings{'IMQ_DEV'};
884 for ( $c = 2000 ; $c <= 2020 ; $c++ )
885 {
886 if ( $qossettings{'SCLASS'} ne $c )
887 { print "<option value='$c'>$c</option>\n"; }
888 else { print "<option selected value='$c'>$c</option>\n"; }
889 }
890 }
891 print <<END
892 </select>
893 <td width='33%' align='center'>&nbsp;
894 <tr><td width='33%' align='right'>Prioritaet:<td width='33%' align='left'><select name='PRIO'>
895 END
896 ;
897 for ( $c = 1 ; $c <= 7 ; $c++ )
898 {
899 if ( $qossettings{'PRIO'} ne $c )
900 { print "<option value='$c'>$c</option>\n"; }
901 else { print "<option selected value='$c'>$c</option>\n"; }
902 }
903 print <<END
904 <td width='33%' align='center'>&nbsp;
905 <tr><td width='33%' align='right'>Garantierte Bandbreite:
906 <td width='33%' align='left'><input type='text' name='MINBWDTH' maxlength='8' required='1' value=$qossettings{'MINBWDTH'} >
907 <td width='33%' align='center'>&nbsp;
908 <tr><td width='33%' align='right'>Maximale Bandbreite:
909 <td width='33%' align='left'><input type='text' name='MAXBWDTH' maxlength='8' required='1' value=$qossettings{'MAXBWDTH'}>
910 <td width='33%' align='center'>&nbsp;
911 <tr><td width='33%' align='right'>Burst:
912 <td width='33%' align='left'><input type='text' name='BURST' maxlength='8' value=$qossettings{'BURST'}>
913 <td width='33%' align='center'>&nbsp;
914 <tr><td width='33%' align='right'>Ceilburst:
915 <td width='33%' align='left'><input type='text' name='CBURST' maxlength='8' value=$qossettings{'CBURST'}>
916 <td width='33%' align='center'>&nbsp;
917 <tr><td width='33%' align='right'>TOS-Bit:
918 <td width='33%' align='left'><select name='TOS'>
919 <option value='0'>Ausgeschaltet (0)</option>
920 <option value='8'>Minimale Verzoegerung (8)</option>
921 <option value='4'>Maximaler Durchsatz (4)</option>
922 <option value='2'>Maximale Zuverlaessigkeit (2)</option>
923 <option value='1'>Minimale Kosten (1)</option></select>
924 <td width='33%' align='center'><input type='hidden' name='CLASS' value=$qossettings{'CLASS'}>
925 <input type='hidden' name='DEVICE' value=$qossettings{'DEVICE'}>
926 <input type='submit' name='DOSCLASS' value=$Lang::tr{'save'} />&nbsp;<input type='reset' value=$Lang::tr{'reset'} />
927 </table></form>
928 END
929 ;
930 &Header::closebox();
931 }
932
933 sub level7rule {
934 &Header::openbox('100%', 'center', 'Level7-Regel');
935 print <<END
936 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
937 <table width='66%'>
938 END
939 ;
940 if ( $message ne "" ) {
941 print "<tr><td colspan='3' align='center'><font color='red'>$message</font>";
942 }
943 print <<END
944 <tr><td colspan='3' width='100%'>Aktuelle Klasse: $qossettings{'CLASS'}
945 <tr><td width='100%' colspan='3'>Geben sie die Daten ein <br> und klicken Sie danach auf <i>Speichern</i>.
946 <tr><td width='33%' align='right'>Protokoll:
947 <td width='33%' align='left'><select name='L7PROT'>
948 END
949 ;
950 opendir( DIR, "/etc/l7-protocols/protocols" );
951 foreach $direntry ( sort readdir(DIR) )
952 {
953 next if $direntry eq ".";
954 next if $direntry eq "..";
955 next if -d "/etc/l7-protocols/protocols/$direntry";
956 @proto = split( /\./, $direntry );
957 if ( $proto[0] eq $qossettings{'L7PROT'} ) {
958 print "<option value='$proto[0]' selected>$proto[0]</option>\n";
959 } else {
960 print "<option value='$proto[0]'>$proto[0]</option>\n";
961 }
962 }
963 closedir DIR;
964 print <<END
965 </select><td width='33%' align='center'>&nbsp;
966 <tr><td width='33%' align='right'>Quell-IP-Adresse:
967 <td width='33%' align='left'><input type='text' name='QIP' maxlength='15' value=$qossettings{'QIP'}>
968 <td width='33%' align='center'>&nbsp;
969 <tr><td width='33%' align='right'>Ziel-IP-Adresse:
970 <td width='33%' align='left'><input type='text' name='DIP' maxlength='15' value=$qossettings{'DIP'}>
971 <td width='33%' align='center'><input type='hidden' name='CLASS' value=$qossettings{'CLASS'}><input type='submit' name='DOLEVEL7' value=$Lang::tr{'save'} />
972 </table></form>
973 END
974 ;
975 &Header::closebox();
976 }
977
978 sub portrule {
979 &Header::openbox('100%', 'center', 'Port-Regel hinzufuegen');
980 print <<END
981 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
982 <table width='66%'>
983 <tr><td width='100%' colspan='3'>Geben sie die Daten ein <br> und klicken Sie danach auf <i>Speichern</i>.
984 <tr><td width='33%' align='right'>Protokoll:
985 <td width='33%' align='left'><select name='PPROT'>
986 END
987 ;
988 open( FILE, "< /etc/protocols" );
989 @proto = <FILE>;
990 close FILE;
991 foreach $direntry (sort @proto)
992 {
993 @tmpline = split( /\ /, $direntry );
994 next if $tmpline[0] =~ "#";
995 if ( $tmpline[0] eq $qossettings{'PPROT'} ) {
996 print "<option value='$tmpline[0]' selected>$tmpline[0]</option>\n";
997 } else {
998 print "<option value='$tmpline[0]'>$tmpline[0]</option>\n";
999 }
1000 }
1001 print <<END
1002 </select><td width='33%' align='center'>&nbsp;
1003 <tr><td width='33%' align='right'>Quell-Port:
1004 <td width='33%' align='left'><input type='text' name='QPORT' maxlength='5' value=$qossettings{'QPORT'}>
1005 <td width='33%' align='center'>&nbsp;
1006 <tr><td width='33%' align='right'>Ziel-Port:
1007 <td width='33%' align='left'><input type='text' name='DPORT' maxlength='5' value=$qossettings{'DPORT'}>
1008 <td width='33%' align='center'>&nbsp;
1009 <tr><td width='33%' align='right'>Quell-IP-Adresse:
1010 <td width='33%' align='left'><input type='text' name='QIP' maxlength='15' value=$qossettings{'QIP'}>
1011 <td width='33%' align='center'>&nbsp;
1012 <tr><td width='33%' align='right'>Ziel-IP-Adresse:
1013 <td width='33%' align='left'><input type='text' name='DIP' maxlength='15' value=$qossettings{'DIP'}>
1014 <td width='33%' align='center'><input type='hidden' name='CLASS' value='$qossettings{'CLASS'}'><input type='submit' name='DOPORT' value=$Lang::tr{'save'} />
1015 </table></form>
1016 END
1017 ;
1018 &Header::closebox();
1019 }
1020
1021 sub tosrule {
1022 &Header::openbox('100%', 'center', 'TOS-Regel');
1023 if ($qossettings{'TOS'}) {
1024 $checked[$qossettings{'TOS'}] = "checked";
1025 }
1026 print <<END
1027 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
1028 <table width='66%'>
1029 END
1030 ;
1031 if ( $message ne "" ) {
1032 print "<tr><td colspan='3' align='center'><font color='red'>$message</font>";
1033 }
1034 print <<END
1035 <tr><td colspan='2' width='100%'>Aktuelle Klasse: $qossettings{'CLASS'}
1036 <tr><td width='100%' colspan='2'>Aktivieren oder deaktivieren sie die TOS-Bits <br> und klicken Sie danach auf <i>Speichern</i>.
1037 <tr><td width='50%' align='left'>Minimale Verzoegerung (8) <td width='50%'><input type="radio" name="TOS" value="8" $checked[8]>
1038 <tr><td width='50%' align='left'>Maximaler Durchsatz (4) <td width='50%'><input type="radio" name="TOS" value="4" $checked[4]>
1039 <tr><td width='50%' align='left'>Maximale Zuverlaessigkeit (2) <td width='50%'><input type="radio" name="TOS" value="2" $checked[2]>
1040 <tr><td width='50%' align='left'>Minimale Kosten (1) <td width='50%'><input type="radio" name="TOS" value="1" $checked[1]>
1041 <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'} />
1042 </table></form>
1043 END
1044 ;
1045 &Header::closebox();
1046 }
1047
1048 sub showclasses {
1049 open( FILE, "< $classfile" ) or die "Unable to read $classfile";
1050 @classes = <FILE>;
1051 close FILE;
1052 if (@classes) {
1053 open( FILE, "< $subclassfile" ) or die "Unable to read $subclassfile";
1054 @subclasses = <FILE>;
1055 close FILE;
1056 &Header::openbox('100%', 'center', 'Klassen');
1057 print <<END
1058 <table border='0' width='100%' cellspacing='0'>
1059 <tr><td bgcolor='lightgrey' width='10%'>Interface
1060 <td bgcolor='lightgrey' width='10%'>Klasse
1061 <td bgcolor='lightgrey' width='10%'>Prioritaet
1062 <td bgcolor='lightgrey' width='10%'>Garantierte Bandbreite
1063 <td bgcolor='lightgrey' width='10%'>Maximale Bandbreite
1064 <td bgcolor='lightgrey' width='10%'>Burst
1065 <td bgcolor='lightgrey' width='10%'>Ceil Burst
1066 <td bgcolor='lightgrey' width='10%'>TOS
1067 <td bgcolor='lightgrey' width='20%'>Aktionen
1068 END
1069 ;
1070 foreach $classentry (sort @classes)
1071 {
1072 @classline = split( /\;/, $classentry );
1073 if ( $classline[0] eq $qossettings{'RED_DEV'} )
1074 {
1075 print <<END
1076 <tr><td align='center' bgcolor='#EAEAEA'>$classline[0]
1077 <td align='center' bgcolor='#EAEAEA'>$classline[1]
1078 <td align='center' bgcolor='#EAEAEA'>$classline[2]
1079 <td align='center' bgcolor='#EAEAEA'>$classline[3]
1080 <td align='center' bgcolor='#EAEAEA'>$classline[4]
1081 <td align='center' bgcolor='#EAEAEA'>$classline[5]
1082 <td align='center' bgcolor='#EAEAEA'>$classline[6]
1083 <td align='center' bgcolor='#EAEAEA'>$classline[7]
1084 <td align='right' bgcolor='#EAEAEA'>
1085 <table border='0'><tr>
1086 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1087 <input type='hidden' name='CLASS' value='$classline[1]'>
1088 <input type='hidden' name='ACTION' value='Unterklasse hinzufuegen'>
1089 <input type='image' alt='Unterklasse hinzufuegen' src='/images/addblue.gif'>
1090 </form>
1091 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1092 <input type='hidden' name='CLASS' value='$classline[1]'>
1093 <input type='hidden' name='ACTION' value='Regel hinzufuegen'>
1094 <input type='image' alt='Regel hinzufuegen' src='/images/addgreen.gif'>
1095 </form>
1096 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1097 <input type='hidden' name='CLASS' value='$classline[1]'>
1098 <input type='hidden' name='DOCLASS' value='Bearbeiten'>
1099 <input type='image' alt='Bearbeiten' src='/images/edit.gif'>
1100 </form>
1101 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1102 <input type='hidden' name='CLASS' value='$classline[1]'>
1103 <input type='hidden' name='DOCLASS' value='Loeschen'>
1104 <input type='image' alt='Loeschen' src='/images/delete.gif'>
1105 </form>
1106 </table>
1107 END
1108 ;
1109 foreach $subclassentry (sort @subclasses)
1110 {
1111 @subclassline = split( /\;/, $subclassentry );
1112 if ( $subclassline[1] eq $classline[1] ) {
1113 print <<END
1114 <tr><td align='center' bgcolor='#FFFFFF'>Subklasse:
1115 <td align='center' bgcolor='#FAFAFA'>$subclassline[2]
1116 <td align='center' bgcolor='#FAFAFA'>$subclassline[3]
1117 <td align='center' bgcolor='#FAFAFA'>$subclassline[4]
1118 <td align='center' bgcolor='#FAFAFA'>$subclassline[5]
1119 <td align='center' bgcolor='#FAFAFA'>$subclassline[6]
1120 <td align='center' bgcolor='#FAFAFA'>$subclassline[7]
1121 <td align='center' bgcolor='#FAFAFA'>$subclassline[8]
1122 <td align='right' bgcolor='#FAFAFA'>
1123 <table border='0'><tr>
1124 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1125 <input type='hidden' name='CLASS' value='$subclassline[2]'>
1126 <input type='hidden' name='ACTION' value='Regel hinzufuegen'>
1127 <input type='image' alt='Regel hinzufuegen' src='/images/addgreen.gif'>
1128 </form>
1129 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1130 <input type='hidden' name='CLASS' value='$subclassline[2]'>
1131 <input type='hidden' name='DOSCLASS' value='Bearbeiten'>
1132 <input type='image' alt='Bearbeiten' src='/images/edit.gif'>
1133 </form>
1134 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1135 <input type='hidden' name='CLASS' value='$subclassline[2]'>
1136 <input type='hidden' name='DOSCLASS' value='Loeschen'>
1137 <input type='image' alt='Loeschen' src='/images/delete.gif'>
1138 </form>
1139 </table>
1140 END
1141 ;
1142 }
1143 }
1144 }
1145 }
1146 print "\t<tr><td colspan='9' bgcolor='lightgrey' height='2'>";
1147 foreach $classentry (sort @classes)
1148 {
1149 @classline = split( /\;/, $classentry );
1150 if ( $classline[0] eq $qossettings{'IMQ_DEV'} )
1151 {
1152 print <<END
1153 <tr><td align='center' bgcolor='#EAEAEA'>$classline[0]
1154 <td align='center' bgcolor='#EAEAEA'>$classline[1]
1155 <td align='center' bgcolor='#EAEAEA'>$classline[2]
1156 <td align='center' bgcolor='#EAEAEA'>$classline[3]
1157 <td align='center' bgcolor='#EAEAEA'>$classline[4]
1158 <td align='center' bgcolor='#EAEAEA'>$classline[5]
1159 <td align='center' bgcolor='#EAEAEA'>$classline[6]
1160 <td align='center' bgcolor='#EAEAEA'>$classline[7]
1161 <td align='right' bgcolor='#EAEAEA'>
1162 <table border='0'><tr>
1163 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1164 <input type='hidden' name='CLASS' value='$classline[1]'>
1165 <input type='hidden' name='ACTION' value='Unterklasse hinzufuegen'>
1166 <input type='image' alt='Unterklasse hinzufuegen' src='/images/addblue.gif'>
1167 </form>
1168 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1169 <input type='hidden' name='CLASS' value='$classline[1]'>
1170 <input type='hidden' name='ACTION' value='Regel hinzufuegen'>
1171 <input type='image' alt='Regel hinzufuegen' src='/images/addgreen.gif'>
1172 </form>
1173 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1174 <input type='hidden' name='CLASS' value='$classline[1]'>
1175 <input type='hidden' name='DOCLASS' value='Bearbeiten'>
1176 <input type='image' alt='Bearbeiten' src='/images/edit.gif'>
1177 </form>
1178 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1179 <input type='hidden' name='CLASS' value='$classline[1]'>
1180 <input type='hidden' name='DOCLASS' value='Loeschen'>
1181 <input type='image' alt='Loeschen' src='/images/delete.gif'>
1182 </form>
1183 </table>
1184 END
1185 ;
1186 foreach $subclassentry (sort @subclasses)
1187 {
1188 @subclassline = split( /\;/, $subclassentry );
1189 if ( $subclassline[1] eq $classline[1] ) {
1190 print <<END
1191 <tr><td align='center' bgcolor='#FFFFFF'>Subklasse:
1192 <td align='center' bgcolor='#FAFAFA'>$subclassline[2]
1193 <td align='center' bgcolor='#FAFAFA'>$subclassline[3]
1194 <td align='center' bgcolor='#FAFAFA'>$subclassline[4]
1195 <td align='center' bgcolor='#FAFAFA'>$subclassline[5]
1196 <td align='center' bgcolor='#FAFAFA'>$subclassline[6]
1197 <td align='center' bgcolor='#FAFAFA'>$subclassline[7]
1198 <td align='center' bgcolor='#FAFAFA'>$subclassline[8]
1199 <td align='right' bgcolor='#FAFAFA'>
1200 <table border='0'><tr>
1201 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1202 <input type='hidden' name='CLASS' value='$subclassline[2]'>
1203 <input type='hidden' name='ACTION' value='Regel hinzufuegen'>
1204 <input type='image' alt='Regel hinzufuegen' src='/images/addgreen.gif'>
1205 </form>
1206 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1207 <input type='hidden' name='CLASS' value='$subclassline[2]'>
1208 <input type='hidden' name='DOSCLASS' value='Bearbeiten'>
1209 <input type='image' alt='Bearbeiten' src='/images/edit.gif'>
1210 </form>
1211 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1212 <input type='hidden' name='CLASS' value='$subclassline[2]'>
1213 <input type='hidden' name='DOSCLASS' value='Loeschen'>
1214 <input type='image' alt='Loeschen' src='/images/delete.gif'>
1215 </form>
1216 </table>
1217 END
1218 ;
1219 }
1220 }
1221 }
1222 }
1223 print <<END
1224 <tr><td colspan='9' align='right' valign='middle'><b>Legende:</b>&nbsp;&nbsp;<img src='/images/addblue.gif'>&nbsp;Unterklasse hinzufuegen | <img src='/images/addgreen.gif'>&nbsp;Regel hinzufuegen | <img src='/images/edit.gif'>&nbsp;Klasse bearbeiten | <img src='/images/delete.gif'>&nbsp;Klasse loeschen &nbsp;
1225 <tr><td colspan='9' align='right' valign='middle'><b>TOS-Bits:</b>&nbsp;&nbsp;<b>0</b> - Deaktiviert | <b>8</b> - Minimale Verzoegerung | <b>4</b> - Maximaler Durchsatz | <b>2</b> - Maximale Zuverlaessigkeit | <b>1</b> - Minimale Kosten &nbsp;
1226 </table>
1227 END
1228 ;
1229 &Header::closebox();
1230 }
1231 }
1232
1233 sub showl7rules {
1234 open( FILE, "< $level7file" ) or die "Unable to read $level7file";
1235 @l7rules = <FILE>;
1236 close FILE;
1237 if (@l7rules) {
1238 &Header::openbox('100%', 'center', 'Level7-Regeln');
1239 print <<END
1240 <table border='0' width='100%' cellspacing='0'>
1241 <tr><td bgcolor='lightgrey' width='14%'>Interface
1242 <td bgcolor='lightgrey' width='14%'>Klasse
1243 <td bgcolor='lightgrey' width='14%'>Protokoll
1244 <td bgcolor='lightgrey' width='14%'>Quell-IP-Adresse
1245 <td bgcolor='lightgrey' width='14%'>Ziel-IP-Adresse
1246 <td bgcolor='lightgrey' width='30%'>Aktionen
1247 END
1248 ;
1249 foreach $l7ruleentry (sort @l7rules)
1250 {
1251 @l7ruleline = split( /\;/, $l7ruleentry );
1252 if ( $l7ruleline[1] eq $qossettings{'RED_DEV'} )
1253 {
1254 print <<END
1255 <tr><td align='center' bgcolor='#EAEAEA'>$l7ruleline[1]
1256 <td align='center' bgcolor='#EAEAEA'>$l7ruleline[0]
1257 <td align='center' bgcolor='#EAEAEA'>$l7ruleline[2]
1258 <td align='center' bgcolor='#EAEAEA'>$l7ruleline[3]
1259 <td align='center' bgcolor='#EAEAEA'>$l7ruleline[4]
1260 <td align='right' bgcolor='#EAEAEA'>
1261 <table border='0'><tr>
1262 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1263 <input type='hidden' name='CLASS' value='$l7ruleline[0]'>
1264 <input type='hidden' name='L7PROT' value='$l7ruleline[2]'>
1265 <input type='hidden' name='DOLEVEL7' value='Bearbeiten'>
1266 <input type='image' alt='Bearbeiten' src='/images/edit.gif'>
1267 </form>
1268 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1269 <input type='hidden' name='CLASS' value='$l7ruleline[0]'>
1270 <input type='hidden' name='L7PROT' value='$l7ruleline[2]'>
1271 <input type='hidden' name='DOLEVEL7' value='Loeschen'>
1272 <input type='image' alt='Loeschen' src='/images/delete.gif'>
1273 </form>
1274 </table>
1275 END
1276 ;
1277 }
1278 }
1279 print "\t<tr><td colspan='8' bgcolor='lightgrey' height='2'>";
1280 foreach $l7ruleentry (sort @l7rules)
1281 {
1282 @l7ruleline = split( /\;/, $l7ruleentry );
1283 if ( $l7ruleline[1] eq $qossettings{'IMQ_DEV'} )
1284 {
1285 print <<END
1286 <tr><td align='center' bgcolor='#EAEAEA'>$l7ruleline[1]
1287 <td align='center' bgcolor='#EAEAEA'>$l7ruleline[0]
1288 <td align='center' bgcolor='#EAEAEA'>$l7ruleline[2]
1289 <td align='center' bgcolor='#EAEAEA'>$l7ruleline[3]
1290 <td align='center' bgcolor='#EAEAEA'>$l7ruleline[4]
1291 <td align='right' bgcolor='#EAEAEA'>
1292 <table border='0'><tr>
1293 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1294 <input type='hidden' name='CLASS' value='$l7ruleline[0]'>
1295 <input type='hidden' name='L7PROT' value='$l7ruleline[2]'>
1296 <input type='hidden' name='DOLEVEL7' value='Bearbeiten'>
1297 <input type='image' alt='Bearbeiten' src='/images/edit.gif'>
1298 </form>
1299 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1300 <input type='hidden' name='CLASS' value='$l7ruleline[0]'>
1301 <input type='hidden' name='L7PROT' value='$l7ruleline[2]'>
1302 <input type='hidden' name='DOLEVEL7' value='Loeschen'>
1303 <input type='image' alt='Loeschen' src='/images/delete.gif'>
1304 </form>
1305 </table>
1306 END
1307 ;
1308 }
1309 }
1310 print <<END
1311 <tr><td colspan='8' align='right' valign='middle'><b>Legende:</b>&nbsp;&nbsp;<img src='/images/edit.gif'>&nbsp;Regel bearbeiten | <img src='/images/delete.gif'>&nbsp;Regel loeschen &nbsp;
1312 </table>
1313 END
1314 ;
1315 &Header::closebox();
1316 }
1317 }
1318
1319 sub showportrules {
1320 open( FILE, "< $portfile" ) or die "Unable to read $portfile";
1321 @portrules = <FILE>;
1322 close FILE;
1323 if (@portrules) {
1324 &Header::openbox('100%', 'center', 'Port-Regeln');
1325 print <<END
1326 <table border='0' width='100%' cellspacing='0'>
1327 <tr><td bgcolor='lightgrey' width='10%'>Interface
1328 <td bgcolor='lightgrey' width='10%'>Klasse
1329 <td bgcolor='lightgrey' width='10%'>Protokoll
1330 <td bgcolor='lightgrey' width='10%'>Quell-IP-Adresse
1331 <td bgcolor='lightgrey' width='10%'>Quell-Port
1332 <td bgcolor='lightgrey' width='10%'>Ziel-IP-Adresse
1333 <td bgcolor='lightgrey' width='10%'>Ziel-Port
1334 <td bgcolor='lightgrey' width='30%'>Aktionen
1335 END
1336 ;
1337 foreach $portruleentry (sort @portrules)
1338 {
1339 @portruleline = split( /\;/, $portruleentry );
1340 if ( $portruleline[1] eq $qossettings{'RED_DEV'} )
1341 {
1342 print <<END
1343 <tr><td align='center' bgcolor='#EAEAEA'>$portruleline[1]
1344 <td align='center' bgcolor='#EAEAEA'>$portruleline[0]
1345 <td align='center' bgcolor='#EAEAEA'>$portruleline[2]
1346 <td align='center' bgcolor='#EAEAEA'>$portruleline[3]
1347 <td align='center' bgcolor='#EAEAEA'>$portruleline[4]
1348 <td align='center' bgcolor='#EAEAEA'>$portruleline[5]
1349 <td align='center' bgcolor='#EAEAEA'>$portruleline[6]
1350 <td align='right' bgcolor='#EAEAEA'>
1351 <table border='0'><tr>
1352 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1353 <input type='hidden' name='CLASS' value='$portruleline[0]'>
1354 <input type='hidden' name='PPROT' value='$portruleline[2]'>
1355 <input type='hidden' name='QIP' value='$portruleline[3]'>
1356 <input type='hidden' name='QPORT' value='$portruleline[4]'>
1357 <input type='hidden' name='DIP' value='$portruleline[5]'>
1358 <input type='hidden' name='DPORT' value='$portruleline[6]'>
1359 <input type='hidden' name='DOPORT' value='Bearbeiten'>
1360 <input type='image' alt='Bearbeiten' src='/images/edit.gif'>
1361 </form>
1362 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1363 <input type='hidden' name='CLASS' value='$portruleline[0]'>
1364 <input type='hidden' name='PPROT' value='$portruleline[2]'>
1365 <input type='hidden' name='QIP' value='$portruleline[3]'>
1366 <input type='hidden' name='QPORT' value='$portruleline[4]'>
1367 <input type='hidden' name='DIP' value='$portruleline[5]'>
1368 <input type='hidden' name='DPORT' value='$portruleline[6]'>
1369 <input type='hidden' name='DOPORT' value='Loeschen'>
1370 <input type='image' alt='Loeschen' src='/images/delete.gif'>
1371 </form>
1372 </table>
1373 END
1374 ;
1375 }
1376 }
1377 print "\t<tr><td colspan='8' bgcolor='lightgrey' height='2'>";
1378 foreach $portruleentry (sort @portrules)
1379 {
1380 @portruleline = split( /\;/, $portruleentry );
1381 if ( $portruleline[1] eq $qossettings{'IMQ_DEV'} )
1382 {
1383 print <<END
1384 <tr><td align='center' bgcolor='#EAEAEA'>$portruleline[1]
1385 <td align='center' bgcolor='#EAEAEA'>$portruleline[0]
1386 <td align='center' bgcolor='#EAEAEA'>$portruleline[2]
1387 <td align='center' bgcolor='#EAEAEA'>$portruleline[3]
1388 <td align='center' bgcolor='#EAEAEA'>$portruleline[4]
1389 <td align='center' bgcolor='#EAEAEA'>$portruleline[5]
1390 <td align='center' bgcolor='#EAEAEA'>$portruleline[6]
1391 <td align='right' bgcolor='#EAEAEA'>
1392 <table border='0'><tr>
1393 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1394 <input type='hidden' name='CLASS' value='$portruleline[0]'>
1395 <input type='hidden' name='PPROT' value='$portruleline[2]'>
1396 <input type='hidden' name='QIP' value='$portruleline[3]'>
1397 <input type='hidden' name='QPORT' value='$portruleline[4]'>
1398 <input type='hidden' name='DIP' value='$portruleline[5]'>
1399 <input type='hidden' name='DPORT' value='$portruleline[6]'>
1400 <input type='hidden' name='DOPORT' value='Bearbeiten'>
1401 <input type='image' alt='Bearbeiten' src='/images/edit.gif'>
1402 </form>
1403 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1404 <input type='hidden' name='CLASS' value='$portruleline[0]'>
1405 <input type='hidden' name='PPROT' value='$portruleline[2]'>
1406 <input type='hidden' name='QIP' value='$portruleline[3]'>
1407 <input type='hidden' name='QPORT' value='$portruleline[4]'>
1408 <input type='hidden' name='DIP' value='$portruleline[5]'>
1409 <input type='hidden' name='DPORT' value='$portruleline[6]'>
1410 <input type='hidden' name='DOPORT' value='Loeschen'>
1411 <input type='image' alt='Loeschen' src='/images/delete.gif'>
1412 </form>
1413 </table>
1414 END
1415 ;
1416 }
1417 }
1418 print <<END
1419 <tr><td colspan='8' align='right' valign='middle'><b>Legende:</b>&nbsp;&nbsp;<img src='/images/edit.gif'>&nbsp;Regel bearbeiten | <img src='/images/delete.gif'>&nbsp;Regel loeschen &nbsp;
1420 </table>
1421 END
1422 ;
1423 &Header::closebox();
1424 }
1425 }
1426
1427 sub showtosrules {
1428 open( FILE, "< $tosfile" ) or die "Unable to read $tosfile";
1429 @tosrules = <FILE>;
1430 close FILE;
1431 if (@tosrules) {
1432 &Header::openbox('100%', 'center', 'TOS-Regeln');
1433 print <<END
1434 <table border='0' width='100%' cellspacing='0'>
1435 <tr><td bgcolor='lightgrey' width='10%'>Interface
1436 <td bgcolor='lightgrey' width='10%'>Klasse
1437 <td bgcolor='lightgrey' width='10%'>TOS-Bit
1438 <td bgcolor='lightgrey' width='50%'>TOS-Beschreibung
1439 <td bgcolor='lightgrey' width='20%'>Aktionen
1440 END
1441 ;
1442 foreach $tosruleentry (sort @tosrules)
1443 {
1444 @tosruleline = split( /\;/, $tosruleentry );
1445 if ( $tosruleline[1] eq $qossettings{'RED_DEV'} )
1446 {
1447 print <<END
1448 <tr><td align='center' bgcolor='#EAEAEA'>$tosruleline[1]
1449 <td align='center' bgcolor='#EAEAEA'>$tosruleline[0]
1450 <td align='center' bgcolor='#EAEAEA'>$tosruleline[2]
1451 <td align='center' bgcolor='#EAEAEA'>
1452 END
1453 ;
1454 if ( $tosruleline[2] eq "8") {
1455 print "Minimale Verzoegerung\n";
1456 } elsif ( $tosruleline[2] eq "4") {
1457 print "Maximaler Durchsatz\n";
1458 } elsif ( $tosruleline[2] eq "2") {
1459 print "Maximaler Durchsatz\n";
1460 } elsif ( $tosruleline[2] eq "1") {
1461 print "Minimale Kosten\n";
1462 } else { print "&nbsp;\n"; }
1463 print <<END
1464 <td align='right' bgcolor='#EAEAEA'>
1465 <table border='0'><tr>
1466 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1467 <input type='hidden' name='CLASS' value='$tosruleline[0]'>
1468 <input type='hidden' name='DEV' value='$tosruleline[1]'>
1469 <input type='hidden' name='TOS' value='$tosruleline[2]'>
1470 <input type='hidden' name='DOTOS' value='Bearbeiten'>
1471 <input type='image' alt='Bearbeiten' src='/images/edit.gif'>
1472 </form>
1473 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1474 <input type='hidden' name='CLASS' value='$tosruleline[0]'>
1475 <input type='hidden' name='DEV' value='$tosruleline[1]'>
1476 <input type='hidden' name='TOS' value='$tosruleline[2]'>
1477 <input type='hidden' name='DOTOS' value='Loeschen'>
1478 <input type='image' alt='Loeschen' src='/images/delete.gif'>
1479 </form>
1480 </table>
1481 END
1482 ;
1483 }
1484 }
1485 print "\t<tr><td colspan='8' bgcolor='lightgrey' height='2'>";
1486 foreach $tosruleentry (sort @tosrules)
1487 {
1488 @tosruleline = split( /\;/, $tosruleentry );
1489 if ( $tosruleline[1] eq $qossettings{'IMQ_DEV'} )
1490 {
1491 print <<END
1492 <tr><td align='center' bgcolor='#EAEAEA'>$tosruleline[1]
1493 <td align='center' bgcolor='#EAEAEA'>$tosruleline[0]
1494 <td align='center' bgcolor='#EAEAEA'>$tosruleline[2]
1495 <td align='center' bgcolor='#EAEAEA'>
1496 END
1497 ;
1498 if ( $tosruleline[2] eq "8") {
1499 print "Minimale Verzoegerung\n";
1500 } elsif ( $tosruleline[2] eq "4") {
1501 print "Maximaler Durchsatz\n";
1502 } elsif ( $tosruleline[2] eq "2") {
1503 print "Maximaler Durchsatz\n";
1504 } elsif ( $tosruleline[2] eq "1") {
1505 print "Minimale Kosten\n";
1506 } else { print "&nbsp;\n"; }
1507 print <<END
1508 <td align='right' bgcolor='#EAEAEA'>
1509 <table border='0'><tr>
1510 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1511 <input type='hidden' name='CLASS' value='$tosruleline[0]'>
1512 <input type='hidden' name='DEV' value='$tosruleline[1]'>
1513 <input type='hidden' name='TOS' value='$tosruleline[2]'>
1514 <input type='hidden' name='DOTOS' value='Bearbeiten'>
1515 <input type='image' alt='Bearbeiten' src='/images/edit.gif'>
1516 </form>
1517 <td><form method='post' action='$ENV{'SCRIPT_NAME'}'>
1518 <input type='hidden' name='CLASS' value='$tosruleline[0]'>
1519 <input type='hidden' name='DEV' value='$tosruleline[1]'>
1520 <input type='hidden' name='TOS' value='$tosruleline[2]'>
1521 <input type='hidden' name='DOTOS' value='Loeschen'>
1522 <input type='image' alt='Loeschen' src='/images/delete.gif'>
1523 </form>
1524 </table>
1525 END
1526 ;
1527 }
1528 }
1529 print <<END
1530 <tr><td colspan='8' align='right' valign='middle'><b>Legende:</b>&nbsp;&nbsp;<img src='/images/edit.gif'>&nbsp;Regel bearbeiten | <img src='/images/delete.gif'>&nbsp;Regel loeschen &nbsp;
1531 </table>
1532 END
1533 ;
1534 &Header::closebox();
1535 }
1536 }
1537
1538 sub expert
1539 {
1540 &Header::openbox('100%', 'center', 'Expertenoptionen:');
1541 print <<END
1542 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
1543 <table width='66%'>
1544 <tr><td width='33%' align='right'>MTU:<td width='33%' align='left'>
1545 <input type='text' name='MTU' maxlength='8' required='4' value=$qossettings{'MTU'}>
1546 <td width='33%' align='center'>Diese Einstellung aendert die MTU nicht global sondern nur fuer das QoS.
1547 <tr><td width='33%' align='right'>Queue Laenge:<td width='33%' align='left'>
1548 <input type='text' name='QLENGTH' maxlength='8' required='2' value=$qossettings{'QLENGTH'}>
1549 <td width='33%' align='center'>&nbsp;
1550 <tr><td width='33%' align='right'>SFQ Perturb:<td width='33%' align='left'>
1551 <input type='text' name='SFQ_PERTUB' maxlength='8' required='1' value=$qossettings{'SFQ_PERTUB'}>
1552 <td width='33%' align='center'><input type='submit' name='ACTION' value=$Lang::tr{'save'} />
1553 </table>
1554 </form>
1555 END
1556 ;
1557 &Header::closebox();
1558 }
1559
1560 sub validminbwdth {
1561 if ( $qossettings{'VALID'} eq 'yes' ) {
1562 if ( $qossettings{'DEVICE'} eq $qossettings{'RED_DEV'} ) {
1563 $qossettings{'SPD'} = $qossettings{'OUT_SPD'};
1564 } elsif ( $qossettings{'DEVICE'} eq $qossettings{'IMQ_DEV'} ) {
1565 $qossettings{'SPD'} = $qossettings{'INC_SPD'};
1566 }
1567 unless ( ( $qossettings{'MINBWDTH'} >= 1 ) && ( $qossettings{'MINBWDTH'} <= $qossettings{'SPD'} ) ) {
1568 $qossettings{'VALID'} = 'no';
1569 $message = "Mindestbandbreite ist ungueltig.";
1570 }
1571 $qossettings{'SPD'} = '';
1572 }
1573 }
1574
1575 sub validmaxbwdth {
1576 if ( $qossettings{'VALID'} eq 'yes' ) {
1577 if ( $qossettings{'DEVICE'} eq $qossettings{'RED_DEV'} ) {
1578 $qossettings{'SPD'} = $qossettings{'OUT_SPD'};
1579 } elsif ( $qossettings{'DEVICE'} eq $qossettings{'IMQ_DEV'} ) {
1580 $qossettings{'SPD'} = $qossettings{'INC_SPD'};
1581 }
1582 unless ( ( $qossettings{'MAXBDWTH'} >= 0 ) && ($qossettings{'MAXBDWTH'} >= $qossettings{'MINBDWTH'}) &&( $qossettings{'MAXBDWTH'} <= $qossettings{'SPD'} ) ) {
1583 $qossettings{'VALID'} = 'no';
1584 $message = "Mamimalbandbreite ist ungueltig.";
1585 }
1586 $qossettings{'SPD'} = '';
1587 }
1588 }
1589
1590 sub validclass {
1591 if ( $qossettings{'VALID'} eq 'yes' ) {
1592 if ( $qossettings{'DEVICE'} eq $qossettings{'RED_DEV'} ) {
1593 if ($qossettings{'CLASS'} lt 100 || $qossettings{'CLASS'} ge 121) {
1594 $qossettings{'VALID'} = 'no';
1595 $message = "Die Klassennummer passt nicht zum angegebenen Interface.";
1596 }
1597 } elsif ( $qossettings{'DEVICE'} eq $qossettings{'IMQ_DEV'} ) {
1598 if ($qossettings{'CLASS'} lt 200 || $qossettings{'CLASS'} ge 221) {
1599 $qossettings{'VALID'} = 'no';
1600 $message = "Die Klassennummer passt nicht zum angegebenen Interface.";
1601 }
1602 }
1603 open( FILE, "< $classfile" ) or die "Unable to read $classfile";
1604 @tmp = <FILE>;
1605 close FILE;
1606 foreach $classentry (sort @tmp)
1607 {
1608 @tmpline = split( /\;/, $classentry );
1609 if ( $tmpline[1] eq $qossettings{'CLASS'} )
1610 {
1611 $qossettings{'VALID'} = 'no';
1612 $message = "Die aktuelle Klasse wird bereits verwendet.";
1613 last
1614 }
1615 }
1616 }
1617 }
1618
1619 sub validsubclass {
1620 if ( $qossettings{'VALID'} eq 'yes' ) {
1621 open( FILE, "< $subclassfile" ) or die "Unable to read $subclassfile";
1622 @tmp = <FILE>;
1623 close FILE;
1624 foreach $subclassentry (sort @tmp)
1625 {
1626 @tmpline = split( /\;/, $subclassentry );
1627 if ( $tmpline[2] eq $qossettings{'SCLASS'} )
1628 {
1629 $qossettings{'VALID'} = 'no';
1630 $message = "Die aktuelle Klasse wird bereits verwendet.";
1631 last
1632 }
1633 }
1634 }
1635 }
1636
1637 sub gengraph {
1638 $qossettings{'DEV'} = shift;
1639 $qossettings{'CLASS'} = shift;
1640 my $ERROR="";
1641 if ( $qossettings{'DEV'} eq $qossettings{'RED_DEV'} ) {
1642 $qossettings{'CLASSPRFX'} = '1';
1643 } else {
1644 $qossettings{'CLASSPRFX'} = '2';
1645 }
1646
1647 RRDs::graph ("/home/httpd/html/graphs/class_$qossettings{'CLASSPRFX'}-$qossettings{'CLASS'}_$qossettings{'DEV'}-packets.png",
1648 "--start", "-3240", "-aPNG", "-i", "-z",
1649 "--alt-y-grid", "-w 600", "-h 150", "-r",
1650 "--color", "SHADEA#EAE9EE",
1651 "--color", "SHADEB#EAE9EE",
1652 "--color", "BACK#FFFFFF",
1653 "-t $qossettings{'CLASS'} ($qossettings{'DEV'})",
1654 "DEF:pkts=/var/log/rrd/class_$qossettings{'CLASSPRFX'}-$qossettings{'CLASS'}_$qossettings{'DEV'}.rrd:pkts:AVERAGE",
1655 "DEF:dropped=/var/log/rrd/class_$qossettings{'CLASSPRFX'}-$qossettings{'CLASS'}_$qossettings{'DEV'}.rrd:dropped:AVERAGE",
1656 "DEF:overlimits=/var/log/rrd/class_$qossettings{'CLASSPRFX'}-$qossettings{'CLASS'}_$qossettings{'DEV'}.rrd:overlimits:AVERAGE",
1657 "AREA:pkts#00FFFF:packets",
1658 "GPRINT:pkts:LAST:total packets\\:%8.3lf %s packets\\j",
1659 "LINE3:dropped#FF0000:dropped",
1660 "GPRINT:dropped:LAST:dropped packets\\:%8.3lf %s packets\\j",
1661 "LINE3:overlimits#0000FF:overlimits",
1662 "GPRINT:overlimits:LAST:overlimits\\:%8.3lf %s packets\\j",
1663 );
1664 $ERROR = RRDs::error;
1665 print "$ERROR";
1666
1667 RRDs::graph ("/home/httpd/html/graphs/class_$qossettings{'CLASSPRFX'}-$qossettings{'CLASS'}_$qossettings{'DEV'}-borrowed.png",
1668 "--start", "-3240", "-aPNG", "-i", "-z",
1669 "--alt-y-grid", "-w 600", "-h 150", "-r",
1670 "--color", "SHADEA#EAE9EE",
1671 "--color", "SHADEB#EAE9EE",
1672 "--color", "BACK#FFFFFF",
1673 "-t $qossettings{'CLASS'} ($qossettings{'DEV'})",
1674 "DEF:lended=/var/log/rrd/class_$qossettings{'CLASSPRFX'}-$qossettings{'CLASS'}_$qossettings{'DEV'}.rrd:lended:AVERAGE",
1675 "DEF:borrowed=/var/log/rrd/class_$qossettings{'CLASSPRFX'}-$qossettings{'CLASS'}_$qossettings{'DEV'}.rrd:borrowed:AVERAGE",
1676 "DEF:giants=/var/log/rrd/class_$qossettings{'CLASSPRFX'}-$qossettings{'CLASS'}_$qossettings{'DEV'}.rrd:giants:AVERAGE",
1677 "AREA:lended#99ff99:lended",
1678 "GPRINT:lended:LAST:lended\\:%8.3lf %s packets\\j",
1679 "LINE3:borrowed#f70566:borrowed",
1680 "GPRINT:borrowed:LAST:borrowed\\:%8.3lf %s packets\\j",
1681 "LINE3:giants#05ad05:giants",
1682 "GPRINT:giants:LAST:giants\\:%8.3lf %s packets\\j",
1683 );
1684 $ERROR = RRDs::error;
1685 print "$ERROR";
1686
1687 RRDs::graph ("/home/httpd/html/graphs/class_$qossettings{'CLASSPRFX'}-$qossettings{'CLASS'}_$qossettings{'DEV'}-bytes.png",
1688 "--start", "-3240", "-aPNG", "-i", "-z",
1689 "--alt-y-grid", "-w 600", "-h 150", "-r",
1690 "--color", "SHADEA#EAE9EE",
1691 "--color", "SHADEB#EAE9EE",
1692 "--color", "BACK#FFFFFF",
1693 "-t $qossettings{'CLASS'} ($qossettings{'DEV'})",
1694 "DEF:bits=/var/log/rrd/class_$qossettings{'CLASSPRFX'}-$qossettings{'CLASS'}_$qossettings{'DEV'}.rrd:bits:AVERAGE",
1695 "DEF:bytes=/var/log/rrd/class_$qossettings{'CLASSPRFX'}-$qossettings{'CLASS'}_$qossettings{'DEV'}.rrd:bytes:AVERAGE",
1696 "CDEF:kbytes=bytes,1024,/",
1697 "CDEF:kbits=bits,1024,/,8,/",
1698 "AREA:kbytes#FFBE7D:kbytes",
1699 "GPRINT:kbytes:LAST:rate\\: %8.3lf kbytes\\j",
1700 );
1701 $ERROR = RRDs::error;
1702 print "$ERROR";
1703
1704
1705 }