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