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