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