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