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