]>
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 strict; | |
23 | ||
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 | ||
32 | our %pppsettings=(); | |
33 | my %temppppsettings=(); | |
34 | our %modemsettings=(); | |
35 | our %isdnsettings=(); | |
36 | our %netsettings=(); | |
37 | my %selected=(); | |
38 | my %checked=(); | |
39 | my @profilenames=(); | |
40 | my $errormessage = ''; | |
41 | my $maxprofiles = 5; | |
42 | my $kernel=`/bin/uname -r | /usr/bin/tr -d '\012'`; | |
43 | ||
44 | my %color = (); | |
45 | my %mainsettings = (); | |
46 | &General::readhash("${General::swroot}/main/settings", \%mainsettings); | |
47 | &General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color); | |
48 | ||
49 | &Header::showhttpheaders(); | |
50 | ||
51 | $pppsettings{'ACTION'} = ''; | |
52 | &initprofile(); | |
53 | &Header::getcgihash(\%pppsettings); | |
54 | ||
55 | if ($pppsettings{'ACTION'} ne '' && | |
56 | ( -e "${General::swroot}/red/active")){ | |
57 | $errormessage = $Lang::tr{'unable to alter profiles while red is active'}; | |
58 | # read in the current vars | |
59 | %pppsettings = (); | |
60 | $pppsettings{'VALID'} = ''; | |
61 | &General::readhash("${General::swroot}/ppp/settings", \%pppsettings);} | |
62 | elsif ($pppsettings{'ACTION'} eq $Lang::tr{'refresh'}) | |
63 | { | |
64 | unless ($pppsettings{'TYPE'} =~ /^(modem|serial|isdn|pppoe|pptp|vdsl|pppoeatm|pptpatm)$/) { | |
65 | $errormessage = $Lang::tr{'invalid input'}; | |
66 | goto ERROR; } | |
67 | my $type = $pppsettings{'TYPE'}; | |
68 | &General::readhash("${General::swroot}/ppp/settings", \%pppsettings); | |
69 | $pppsettings{'TYPE'} = $type; | |
70 | } | |
71 | elsif ($pppsettings{'ACTION'} eq $Lang::tr{'save'}) | |
72 | { | |
73 | if ($pppsettings{'TYPE'} =~ /^(modem|serial|isdn)$/ && $pppsettings{'COMPORT'} !~ /^(ttyS0|ttyS1|ttyS2|ttyS3|ttyS4|ttyACM0|ttyACM1|ttyACM2|ttyACM3|ttyUSB0|ttyUSB1|ttyUSB2|ttyUSB3|rfcomm0|rfcomm1|isdn1|isdn2)$/) { | |
74 | $errormessage = $Lang::tr{'invalid input'}; | |
75 | goto ERROR; } | |
76 | if ($pppsettings{'TYPE'} =~ /^(modem|serial|isdn)$/ && $pppsettings{'MONPORT'} !~ /^(ttyUSB0|ttyUSB1|ttyUSB2|ttyUSB3)$/) { | |
77 | $errormessage = $Lang::tr{'invalid input'}; | |
78 | goto ERROR; } | |
79 | if ($pppsettings{'TYPE'} =~ /^(modem|serial)$/ && $pppsettings{'DTERATE'} !~ /^(9600|19200|38400|57600|115200|230400|460800|921600)$/) { | |
80 | $errormessage = $Lang::tr{'invalid input'}; | |
81 | goto ERROR; } | |
82 | if ($pppsettings{'TYPE'} eq 'modem' && $pppsettings{'DIALMODE'} !~ /^(T|P)$/) { | |
83 | $errormessage = $Lang::tr{'invalid input'}; | |
84 | goto ERROR; } | |
85 | if ($pppsettings{'AUTH'} !~ /^(pap-or-chap|pap|chap|standard-login-script|demon-login-script|other-login-script)$/) { | |
86 | $errormessage = $Lang::tr{'invalid input'}; | |
87 | goto ERROR; | |
88 | } | |
89 | ||
90 | if ($pppsettings{'PROFILENAME'} eq '') { | |
91 | $errormessage = $Lang::tr{'profile name not given'}; | |
92 | $pppsettings{'PROFILENAME'} = ''; | |
93 | goto ERROR; } | |
94 | if ($pppsettings{'TYPE'} =~ /^(modem|isdn)$/) { | |
95 | if ($pppsettings{'TELEPHONE'} eq '') { | |
96 | $errormessage = $Lang::tr{'telephone not set'}; | |
97 | goto ERROR; } | |
98 | if (!($pppsettings{'TELEPHONE'} =~ /^[\d\*\#\,]+$/)) { | |
99 | $errormessage = $Lang::tr{'bad characters in the telephone number field'}; | |
100 | goto ERROR; } | |
101 | } | |
102 | unless (($pppsettings{'PROTOCOL'} eq 'RFC1483' && $pppsettings{'METHOD'} =~ /^(STATIC|DHCP)$/)) { | |
103 | if ($pppsettings{'USERNAME'} eq '') { | |
104 | $errormessage = $Lang::tr{'username not set'}; | |
105 | goto ERROR; } | |
106 | if ($pppsettings{'PASSWORD'} eq '') { | |
107 | $errormessage = $Lang::tr{'password not set'}; | |
108 | goto ERROR; } | |
109 | } | |
110 | ||
111 | if ($pppsettings{'TIMEOUT'} eq '') { | |
112 | $errormessage = $Lang::tr{'idle timeout not set'}; | |
113 | goto ERROR; } | |
114 | if (!($pppsettings{'TIMEOUT'} =~ /^\d+$/)) { | |
115 | $errormessage = $Lang::tr{'only digits allowed in the idle timeout'}; | |
116 | goto ERROR; } | |
117 | ||
118 | if ($pppsettings{'LOGINSCRIPT'} =~ /[.\/ ]/ ) { | |
119 | $errormessage = $Lang::tr{'bad characters in script field'}; | |
120 | goto ERROR; } | |
121 | ||
122 | if ($pppsettings{'DNS1'}) | |
123 | { | |
124 | if (!(&General::validip($pppsettings{'DNS1'}))) { | |
125 | $errormessage = $Lang::tr{'invalid primary dns'}; | |
126 | goto ERROR; } | |
127 | } | |
128 | if ($pppsettings{'DNS2'}) | |
129 | { | |
130 | if (!(&General::validip($pppsettings{'DNS2'}))) { | |
131 | $errormessage = $Lang::tr{'invalid secondary dns'}; | |
132 | goto ERROR; } | |
133 | } | |
134 | ||
135 | if ($pppsettings{'MAXRETRIES'} eq '') { | |
136 | $errormessage = $Lang::tr{'max retries not set'}; | |
137 | goto ERROR; } | |
138 | if (!($pppsettings{'MAXRETRIES'} =~ /^\d+$/)) { | |
139 | $errormessage = $Lang::tr{'only digits allowed in max retries field'}; | |
140 | goto ERROR; } | |
141 | ||
142 | if (!($pppsettings{'HOLDOFF'} =~ /^\d+$/)) { | |
143 | $errormessage = $Lang::tr{'only digits allowed in holdoff field'}; | |
144 | goto ERROR; } | |
145 | ||
146 | if ($pppsettings{'TYPE'} =~ /^(pppoeatm|pptpatm)$/) { | |
147 | if ( ($pppsettings{'VPI'} eq '') || ($pppsettings{'VCI'} eq '') ) { | |
148 | $errormessage = $Lang::tr{'invalid vpi vpci'}; | |
149 | goto ERROR; } | |
150 | if ( (!($pppsettings{'VPI'} =~ /^\d+$/)) || (!($pppsettings{'VCI'} =~ /^\d+$/)) ) { | |
151 | $errormessage = $Lang::tr{'invalid vpi vpci'}; | |
152 | goto ERROR; } | |
153 | if (($pppsettings{'VPI'} eq '0') && ($pppsettings{'VCI'} eq '0')) { | |
154 | $errormessage = $Lang::tr{'invalid vpi vpci'}; | |
155 | goto ERROR; } | |
156 | if ( $pppsettings{'PROTOCOL'} eq '' ) { | |
157 | $errormessage = $Lang::tr{'invalid input'}; | |
158 | goto ERROR; } | |
159 | } | |
160 | ||
161 | if ( ($pppsettings{'PROTOCOL'} eq 'RFC1483') && ($pppsettings{'METHOD'} eq '') && \ | |
162 | ($pppsettings{'TYPE'} !~ /^(alcatelusb|fritzdsl)$/)) { | |
163 | $errormessage = $Lang::tr{'invalid input'}; | |
164 | goto ERROR; } | |
165 | ||
166 | if (($pppsettings{'PROTOCOL'} eq 'RFC1483' && $pppsettings{'METHOD'} eq 'DHCP')) { | |
167 | if ($pppsettings{'DHCP_HOSTNAME'} ne '') { | |
168 | if (! &General::validfqdn($pppsettings{'DHCP_HOSTNAME'})) { | |
169 | $errormessage = $errormessage.' '.$Lang::tr{'hostname'}.': '.$Lang::tr{'invalid hostname'}; } | |
170 | } | |
171 | } | |
172 | ||
173 | if (($pppsettings{'PROTOCOL'} eq 'RFC1483' && $pppsettings{'METHOD'} eq 'STATIC')) { | |
174 | $errormessage = ''; | |
175 | if (! &General::validip($pppsettings{'IP'})) { | |
176 | $errormessage = $Lang::tr{'static ip'}.' '.$Lang::tr{'invalid ip'}; } | |
177 | if (! &General::validip($pppsettings{'GATEWAY'})) { | |
178 | $errormessage = $errormessage.' '.$Lang::tr{'gateway ip'}.' '.$Lang::tr{'invalid ip'}; } | |
179 | if (! &General::validmask($pppsettings{'NETMASK'})) { | |
180 | $errormessage = $errormessage.' '.$Lang::tr{'netmask'}.' '.$Lang::tr{'invalid netmask'}; } | |
181 | if ($pppsettings{'BROADCAST'} ne '') { | |
182 | if (! &General::validip($pppsettings{'BROADCAST'})) { | |
183 | $errormessage = $errormessage.' '.$Lang::tr{'broadcast'}.' '.$Lang::tr{'invalid broadcast ip'}; } | |
184 | } | |
185 | if( $pppsettings{'DNS'} eq 'Automatic') { | |
186 | $errormessage = $Lang::tr{'invalid input'}; } | |
187 | if ($errormessage ne '') {goto ERROR; } | |
188 | } | |
189 | ||
190 | if( $pppsettings{'PROTOCOL'} eq 'RFC1483' && $pppsettings{'METHOD'} ne 'PPPOE' && \ | |
191 | $pppsettings{'RECONNECTION'} eq 'dialondemand' ) { | |
192 | $errormessage = $Lang::tr{'invalid input'}; | |
193 | goto ERROR; } | |
194 | ||
195 | if( $pppsettings{'RECONNECTION'} eq 'dialondemand' && `/bin/cat ${General::swroot}/ddns/config` =~ /,on$/m ) { | |
196 | $errormessage = $Lang::tr{'dod not compatible with ddns'}; | |
197 | goto ERROR; } | |
198 | ||
199 | # if( $pppsettings{'PROTOCOL'} eq 'RFC1483') { | |
200 | # $pppsettings{'ENCAP'} = $pppsettings{'ENCAP_RFC1483'}; } | |
201 | # if( $pppsettings{'PROTOCOL'} eq 'RFC2364') { | |
202 | # $pppsettings{'ENCAP'} = $pppsettings{'ENCAP_RFC2364'}; } | |
203 | delete $pppsettings{'ENCAP_RFC1483'}; | |
204 | delete $pppsettings{'ENCAP_RFC2364'}; | |
205 | ||
206 | if ((!($pppsettings{'INET_VLAN'} =~ /^\d+$/)) || | |
207 | ($pppsettings{'INET_VLAN'} eq '') || | |
208 | ($pppsettings{'INET_VLAN'} > 4095) ) { | |
209 | $errormessage = 'INET_VLAN - '.$Lang::tr{'invalid input'}; } | |
210 | ||
211 | if ((!($pppsettings{'IPTV_VLAN'} =~ /^\d+$/)) || | |
212 | ($pppsettings{'IPTV_VLAN'} eq '') || | |
213 | ($pppsettings{'IPTV_VLAN'} > 4095) ) { | |
214 | $errormessage = 'IPTV_VLAN - '.$Lang::tr{'invalid input'}; } | |
215 | ||
216 | ERROR: | |
217 | if ($errormessage) { | |
218 | $pppsettings{'VALID'} = 'no'; } | |
219 | else { | |
220 | $pppsettings{'VALID'} = 'yes'; } | |
221 | ||
222 | # write cgi vars to the file. | |
223 | &General::writehash("${General::swroot}/ppp/settings-$pppsettings{'PROFILE'}", | |
224 | \%pppsettings); | |
225 | ||
226 | # make link and write secret file. | |
227 | &updatesettings(); | |
228 | &writesecrets(); | |
229 | ||
230 | &General::log("$Lang::tr{'profile saved'} $pppsettings{'PROFILENAME'}"); | |
231 | } | |
232 | if ($pppsettings{'ACTION'} eq $Lang::tr{'select'}) | |
233 | { | |
234 | my $profile = $pppsettings{'PROFILE'}; | |
235 | %temppppsettings = (); | |
236 | $temppppsettings{'PROFILE'} = ''; | |
237 | &General::readhash("${General::swroot}/ppp/settings-$pppsettings{'PROFILE'}", | |
238 | \%temppppsettings); | |
239 | ||
240 | # make link. | |
241 | &updatesettings(); | |
242 | ||
243 | # read in the new params "early" so we can write secrets. | |
244 | %pppsettings = (); | |
245 | &General::readhash("${General::swroot}/ppp/settings", \%pppsettings); | |
246 | $pppsettings{'PROFILE'} = $profile; | |
247 | &General::writehash("${General::swroot}/ppp/settings-$pppsettings{'PROFILE'}", | |
248 | \%pppsettings); | |
249 | ||
250 | &writesecrets(); | |
251 | ||
252 | &General::log("$Lang::tr{'profile made current'} $pppsettings{'PROFILENAME'}"); | |
253 | } | |
254 | elsif ($pppsettings{'ACTION'} eq $Lang::tr{'delete'}) | |
255 | { | |
256 | &General::log("$Lang::tr{'profile deleted'} $pppsettings{'PROFILENAME'}"); | |
257 | ||
258 | my $profile = $pppsettings{'PROFILE'}; | |
259 | truncate ("${General::swroot}/ppp/settings-$pppsettings{'PROFILE'}", 0); | |
260 | ||
261 | %temppppsettings = (); | |
262 | $temppppsettings{'PROFILE'} = ''; | |
263 | &General::readhash("${General::swroot}/ppp/settings-$pppsettings{'PROFILE'}", | |
264 | \%temppppsettings); | |
265 | ||
266 | # make link. | |
267 | &updatesettings(); | |
268 | ||
269 | # read in the new params "early" so we can write secrets. | |
270 | %pppsettings = (); | |
271 | &General::readhash("${General::swroot}/ppp/settings", \%pppsettings); | |
272 | $pppsettings{'PROFILE'} = $profile; | |
273 | &initprofile; | |
274 | &General::writehash("${General::swroot}/ppp/settings-$pppsettings{'PROFILE'}", | |
275 | \%pppsettings); | |
276 | } | |
277 | elsif ($pppsettings{'ACTION'} eq $Lang::tr{'refresh'}) | |
278 | { | |
279 | } | |
280 | else | |
281 | { | |
282 | # read in the current vars | |
283 | %pppsettings = (); | |
284 | $pppsettings{'VALID'} = ''; | |
285 | &General::readhash("${General::swroot}/ppp/settings", \%pppsettings); | |
286 | } | |
287 | ||
288 | # read in the profile names into @profilenames. | |
289 | my $c=0; | |
290 | for ($c = 1; $c <= $maxprofiles; $c++) | |
291 | { | |
292 | %temppppsettings = (); | |
293 | $temppppsettings{'PROFILENAME'} = $Lang::tr{'empty profile'}; | |
294 | &General::readhash("${General::swroot}/ppp/settings-$c", \%temppppsettings); | |
295 | $profilenames[$c] = $temppppsettings{'PROFILENAME'}; | |
296 | } | |
297 | ||
298 | if ($pppsettings{'VALID'} eq '') | |
299 | { | |
300 | if ($pppsettings{'PROFILE'} eq '') { | |
301 | $pppsettings{'PROFILE'} = '1'; | |
302 | &initprofile(); | |
303 | } | |
304 | } | |
305 | for ($c = 1; $c <= $maxprofiles; $c++) { | |
306 | $selected{'PROFILE'}{$c} = ''; } | |
307 | $selected{'PROFILE'}{$pppsettings{'PROFILE'}} = "selected='selected'"; | |
308 | for ($c = 1; $c <= $maxprofiles; $c++) { | |
309 | $selected{'BACKUPPROFILE'}{$c} = ''; } | |
310 | $selected{'BACKUPPROFILE'}{$pppsettings{'BACKUPPROFILE'}} = "selected='selected'"; | |
311 | ||
312 | $selected{'TYPE'}{'modem'} = ''; | |
313 | $selected{'TYPE'}{'serial'} = ''; | |
314 | $selected{'TYPE'}{'pppoe'} = ''; | |
315 | $selected{'TYPE'}{'pptp'} = ''; | |
316 | $selected{'TYPE'}{'vdsl'} = ''; | |
317 | $selected{'TYPE'}{'pppoeatm'} = ''; | |
318 | $selected{'TYPE'}{'pptpatm'} = ''; | |
319 | $selected{'TYPE'}{$pppsettings{'TYPE'}} = "selected='selected'"; | |
320 | $checked{'DEBUG'}{'off'} = ''; | |
321 | $checked{'DEBUG'}{'on'} = ''; | |
322 | $checked{'DEBUG'}{$pppsettings{'DEBUG'}} = "checked='checked'"; | |
323 | ||
324 | $selected{'COMPORT'}{'ttyS0'} = ''; | |
325 | $selected{'COMPORT'}{'ttyS1'} = ''; | |
326 | $selected{'COMPORT'}{'ttyS2'} = ''; | |
327 | $selected{'COMPORT'}{'ttyS3'} = ''; | |
328 | $selected{'COMPORT'}{'ttyS4'} = ''; | |
329 | $selected{'COMPORT'}{'ttyACM0'} = ''; | |
330 | $selected{'COMPORT'}{'ttyACM1'} = ''; | |
331 | $selected{'COMPORT'}{'ttyACM2'} = ''; | |
332 | $selected{'COMPORT'}{'ttyACM3'} = ''; | |
333 | $selected{'COMPORT'}{'ttyUSB0'} = ''; | |
334 | $selected{'COMPORT'}{'ttyUSB1'} = ''; | |
335 | $selected{'COMPORT'}{'ttyUSB2'} = ''; | |
336 | $selected{'COMPORT'}{'ttyUSB3'} = ''; | |
337 | $selected{'COMPORT'}{'rfcomm0'} = ''; | |
338 | $selected{'COMPORT'}{'rfcomm1'} = ''; | |
339 | $selected{'COMPORT'}{$pppsettings{'COMPORT'}} = "selected='selected'"; | |
340 | ||
341 | $selected{'MONPORT'}{''} = ''; | |
342 | $selected{'MONPORT'}{'ttyUSB0'} = ''; | |
343 | $selected{'MONPORT'}{'ttyUSB1'} = ''; | |
344 | $selected{'MONPORT'}{'ttyUSB2'} = ''; | |
345 | $selected{'MONPORT'}{'ttyUSB3'} = ''; | |
346 | $selected{'MONPORT'}{$pppsettings{'MONPORT'}} = "selected='selected'"; | |
347 | ||
348 | $selected{'DTERATE'}{'9600'} = ''; | |
349 | $selected{'DTERATE'}{'19200'} = ''; | |
350 | $selected{'DTERATE'}{'38400'} = ''; | |
351 | $selected{'DTERATE'}{'57600'} = ''; | |
352 | $selected{'DTERATE'}{'115200'} = ''; | |
353 | $selected{'DTERATE'}{'230400'} = ''; | |
354 | $selected{'DTERATE'}{'460800'} = ''; | |
355 | $selected{'DTERATE'}{'921600'} = ''; | |
356 | $selected{'DTERATE'}{$pppsettings{'DTERATE'}} = "selected='selected'"; | |
357 | ||
358 | $checked{'SPEAKER'}{'off'} = ''; | |
359 | $checked{'SPEAKER'}{'on'} = ''; | |
360 | $checked{'SPEAKER'}{$pppsettings{'SPEAKER'}} = "checked='checked'"; | |
361 | ||
362 | $selected{'DIALMODE'}{'T'} = ''; | |
363 | $selected{'DIALMODE'}{'P'} = ''; | |
364 | $selected{'DIALMODE'}{$pppsettings{'DIALMODE'}} = "selected='selected'"; | |
365 | ||
366 | $checked{'RECONNECTION'}{'persistent'} = ''; | |
367 | $checked{'RECONNECTION'}{'dialondemand'} = ''; | |
368 | $checked{'RECONNECTION'}{$pppsettings{'RECONNECTION'}} = "checked='checked'"; | |
369 | ||
370 | $checked{'DIALONDEMANDDNS'}{'off'} = ''; | |
371 | $checked{'DIALONDEMANDDNS'}{'on'} = ''; | |
372 | $checked{'DIALONDEMANDDNS'}{$pppsettings{'DIALONDEMANDDNS'}} = "checked='checked'"; | |
373 | ||
374 | $checked{'AUTOCONNECT'}{'off'} = ''; | |
375 | $checked{'AUTOCONNECT'}{'on'} = ''; | |
376 | $checked{'AUTOCONNECT'}{$pppsettings{'AUTOCONNECT'}} = "checked='checked'"; | |
377 | ||
378 | $checked{'SENDCR'}{'off'} = ''; | |
379 | $checked{'SENDCR'}{'on'} = ''; | |
380 | $checked{'SENDCR'}{$pppsettings{'SENDCR'}} = "checked='checked'"; | |
381 | $checked{'USEDOV'}{'off'} = ''; | |
382 | $checked{'USEDOV'}{'on'} = ''; | |
383 | $checked{'USEDOV'}{$pppsettings{'USEDOV'}} = "checked='checked'"; | |
384 | ||
385 | $checked{'MODEM'}{'PCIST'} = ''; | |
386 | $checked{'MODEM'}{'USB'} = ''; | |
387 | $checked{'MODEM'}{$pppsettings{'MODEM'}} = "checked='checked'"; | |
388 | ||
389 | $selected{'LINE'}{'WO'} = ''; | |
390 | $selected{'LINE'}{'ES'} = ''; | |
391 | $selected{'LINE'}{'ES03'} = ''; | |
392 | $selected{'LINE'}{'FR'} = ''; | |
393 | $selected{'LINE'}{'FR04'} = ''; | |
394 | $selected{'LINE'}{'FR10'} = ''; | |
395 | $selected{'LINE'}{'IT'} = ''; | |
396 | $selected{'LINE'}{$pppsettings{'LINE'}} = "selected='selected'"; | |
397 | ||
398 | $checked{'MODULATION'}{'GDMT'} = ''; | |
399 | $checked{'MODULATION'}{'ANSI'} = ''; | |
400 | $checked{'MODULATION'}{'GLITE'} = ''; | |
401 | $checked{'MODULATION'}{'AUTO'} = ''; | |
402 | $checked{'MODULATION'}{$pppsettings{'MODULATION'}} = "checked='checked'"; | |
403 | ||
404 | $checked{'PROTOCOL'}{'RFC1483'} = ''; | |
405 | $checked{'PROTOCOL'}{'RFC2364'} = ''; | |
406 | $checked{'PROTOCOL'}{$pppsettings{'PROTOCOL'}} = "checked='checked'"; | |
407 | ||
408 | $selected{'ENCAP'}{'0'} = ''; | |
409 | $selected{'ENCAP'}{'1'} = ''; | |
410 | #$selected{'ENCAP'}{'2'} = ''; | |
411 | #$selected{'ENCAP'}{'3'} = ''; | |
412 | #$selected{'ENCAP'}{'4'} = ''; | |
413 | $selected{'ENCAP'}{$pppsettings{'ENCAP'}} = "selected='selected'"; | |
414 | ||
415 | $checked{'METHOD'}{'STATIC'} = ''; | |
416 | $checked{'METHOD'}{'PPPOE'} = ''; | |
417 | $checked{'METHOD'}{'DHCP'} = ''; | |
418 | $checked{'METHOD'}{$pppsettings{'METHOD'}} = "checked='checked'"; | |
419 | ||
420 | $selected{'AUTH'}{'pap-or-chap'} = ''; | |
421 | $selected{'AUTH'}{'pap'} = ''; | |
422 | $selected{'AUTH'}{'chap'} = ''; | |
423 | $selected{'AUTH'}{'standard-login-script'} = ''; | |
424 | $selected{'AUTH'}{'demon-login-script'} = ''; | |
425 | $selected{'AUTH'}{'other-login-script'} = ''; | |
426 | $selected{'AUTH'}{$pppsettings{'AUTH'}} = "selected='selected'"; | |
427 | ||
428 | $checked{'DNS'}{'Automatic'} = ''; | |
429 | $checked{'DNS'}{'Manual'} = ''; | |
430 | $checked{'DNS'}{$pppsettings{'DNS'}} = "checked='checked'"; | |
431 | ||
432 | $checked{'IPTV'}{'enable'} = ''; | |
433 | $checked{'IPTV'}{'disable'} = ''; | |
434 | $checked{'IPTV'}{$pppsettings{'IPTV'}} = "checked='checked'"; | |
435 | ||
436 | if ($pppsettings{'INET_VLAN'} eq '') { $pppsettings{'INET_VLAN'}='7'; } | |
437 | if ($pppsettings{'IPTV_VLAN'} eq '') { $pppsettings{'IPTV_VLAN'}='8'; } | |
438 | ||
439 | &Header::openpage($Lang::tr{'ppp setup'}, 1, ''); | |
440 | &Header::openbigbox('100%', 'left', '', $errormessage); | |
441 | ||
442 | if ($netsettings{'RED_TYPE'} ne 'PPPOE') { | |
443 | $errormessage = $Lang::tr{'dialup red not ppp'}; | |
444 | &Header::openbox('100%', 'center', $Lang::tr{'error messages'}); | |
445 | print "<class name='base'>$errormessage\n"; | |
446 | print " </class>\n"; | |
447 | &Header::closebox(); | |
448 | &Header::closebigbox(); | |
449 | ||
450 | &Header::closepage(); | |
451 | exit(1); | |
452 | } | |
453 | ||
454 | if ($errormessage) { | |
455 | &Header::openbox('100%', 'center', $Lang::tr{'error messages'}); | |
456 | print "<class name='base'>$errormessage\n"; | |
457 | print " </class>\n"; | |
458 | &Header::closebox(); | |
459 | } | |
460 | ||
461 | ||
462 | ### | |
463 | ### Box for selecting profile | |
464 | ### | |
465 | print "<form method='post' action='$ENV{'SCRIPT_NAME'}'>\n"; | |
466 | &Header::openbox('100%', 'center', $Lang::tr{'profile'}); | |
467 | print <<END | |
468 | <table width='95%' cellspacing='0'> | |
469 | <tr> | |
470 | <td align='left'>$Lang::tr{'profile'}</td> | |
471 | <td align='left'> | |
472 | <select name='PROFILE' style="width: 165px"> | |
473 | END | |
474 | ; | |
475 | for ($c = 1; $c <= $maxprofiles; $c++) | |
476 | { | |
477 | print "\t<option value='$c' $selected{'PROFILE'}{$c}>$c. $profilenames[$c]</option>\n"; | |
478 | } | |
479 | print <<END | |
480 | </select></td> | |
481 | <td align='left'><input type='submit' name='ACTION' value='$Lang::tr{'select'}' /></td> | |
482 | <td align='left'><input type='submit' name='ACTION' value='$Lang::tr{'delete'}' /></td> | |
483 | <td align='left'><input type='submit' name='ACTION' value='$Lang::tr{'restore'}' /></td> | |
484 | </tr> | |
485 | </table> | |
486 | <br></br> | |
487 | <hr></hr> | |
488 | END | |
489 | ; | |
490 | ||
491 | &Header::closebox(); | |
492 | &Header::openbox('100%', 'center', $Lang::tr{'connection'}); | |
493 | ||
494 | print <<END | |
495 | <table width='95%' cellspacing='0'> | |
496 | <tr> | |
497 | <td width='25%'>$Lang::tr{'interface'}:</td> | |
498 | <td width='25%'> | |
499 | <select name='TYPE' style="width: 165px"> | |
500 | END | |
501 | ; | |
502 | if ($netsettings{'RED_TYPE'} eq 'PPPOE' ) { | |
503 | print <<END | |
504 | <option value='modem' $selected{'TYPE'}{'modem'}>$Lang::tr{'modem'}</option> | |
505 | <option value='serial' $selected{'TYPE'}{'serial'}>$Lang::tr{'serial'}</option> | |
506 | <option value='pppoe' $selected{'TYPE'}{'pppoe'}>PPPoE</option> | |
507 | <option value='pptp' $selected{'TYPE'}{'pptp'}>PPTP</option> | |
508 | <option value='vdsl' $selected{'TYPE'}{'vdsl'}>VDSL</option> | |
509 | END | |
510 | ; | |
511 | ||
512 | my $atmdev=`cat /proc/net/atm/devices 2>/dev/null | grep 0`; | |
513 | chomp ($atmdev); | |
514 | if ($atmdev ne '') { | |
515 | print <<END | |
516 | <option value='pppoeatm' $selected{'TYPE'}{'pppoeatm'}>PPPoE over ATM-BRIDGE</option> | |
517 | <option value='pptpatm' $selected{'TYPE'}{'pptpatm'}>PPTP over ATM-BRIDGE</option> | |
518 | END | |
519 | ; | |
520 | } | |
521 | } | |
522 | #if (0) { | |
523 | # print <<END | |
524 | # <option value='eciadsl' $selected{'TYPE'}{'eciadsl'}>ECI USB ADSL</option> | |
525 | # <option value='eagleusbadsl' $selected{'TYPE'}{'eagleusbadsl'}>Eagle USB ADSL (Acer Allied-Telesyn Comtrend D-Link Sagem USR)</option> | |
526 | # <option value='conexantusbadsl' $selected{'TYPE'}{'conexantusbadsl'}>Conexant USB(Aetra Amigo Draytek Etec Mac Olitec Vitelcom Zoom)</option> | |
527 | # <option value='amedynusbadsl' $selected{'TYPE'}{'amedynusbadsl'}>Zyxel 630-11 / Asus AAM6000UG USB ADSL</option> | |
528 | # <option value='3cp4218usbadsl' $selected{'TYPE'}{'3cp4218usbadsl'}>3Com USB AccessRunner</option> | |
529 | # <option value='alcatelusb' $selected{'TYPE'}{'alcatelusb'}>Speedtouch USB ADSL user mode driver</option> | |
530 | # <option value='alcatelusbk' $selected{'TYPE'}{'alcatelusbk'}>Speedtouch USB ADSL kernel mode driver</option> | |
531 | #END | |
532 | #; | |
533 | #} | |
534 | # print "<option value='fritzdsl' $selected{'TYPE'}{'fritzdsl'}>Fritz!DSL</option>"; | |
535 | ||
536 | print <<END | |
537 | </select></td> | |
538 | <td colspan='1' width='25%'><input type='submit' name='ACTION' value='$Lang::tr{'refresh'}'></td> | |
539 | END | |
540 | ; | |
541 | if ($pppsettings{'TYPE'} =~ /^(modem)$/) { | |
542 | print <<END | |
543 | <td colspan='1' width='25%'><a href='modem.cgi'>$Lang::tr{'modem configuration'}</a></td> | |
544 | END | |
545 | ; | |
546 | } | |
547 | ||
548 | print "</tr>"; | |
549 | ||
550 | #if (-f "/proc/bus/usb/devices") { | |
551 | # <td colspan='2' width='50%'>USB:</td> | |
552 | # my $usb=`lsmod | cut -d ' ' -f1 | grep -E "hci"`; | |
553 | # if ($usb eq '') { | |
554 | # print "\t<td colspan='2' width='50%'>$Lang::tr{'not running'}</td></tr>\n"; | |
555 | # } else { | |
556 | # print "\t<td colspan='2' width='50%'>$usb</td></tr>\n"; | |
557 | # } | |
558 | #} | |
559 | ||
560 | if ($pppsettings{'TYPE'}) { | |
561 | print "<tr><td colspan='4' width='100%'><br></br></td></tr>"; | |
562 | ||
563 | if ($pppsettings{'TYPE'} =~ /^(modem|serial)$/) { | |
564 | print <<END | |
565 | ||
566 | <tr> | |
567 | <td colspan='3' width='75%'>$Lang::tr{'interface'}:</td> | |
568 | <td width='25%'><select name='COMPORT' style="width: 165px"> | |
569 | END | |
570 | ; | |
571 | if ($pppsettings{'TYPE'} =~ /^(modem|serial)$/ ) { | |
572 | print <<END | |
573 | <option value='ttyS0' $selected{'COMPORT'}{'ttyS0'}>COM1</option> | |
574 | <option value='ttyS1' $selected{'COMPORT'}{'ttyS1'}>COM2</option> | |
575 | <option value='ttyS2' $selected{'COMPORT'}{'ttyS2'}>COM3</option> | |
576 | <option value='ttyS3' $selected{'COMPORT'}{'ttyS3'}>COM4</option> | |
577 | <option value='ttyS4' $selected{'COMPORT'}{'ttyS4'}>COM5</option> | |
578 | <option value='ttyUSB0' $selected{'COMPORT'}{'ttyUSB0'}>ttyUSB0</option> | |
579 | <option value='ttyUSB1' $selected{'COMPORT'}{'ttyUSB1'}>ttyUSB1</option> | |
580 | <option value='ttyUSB2' $selected{'COMPORT'}{'ttyUSB2'}>ttyUSB2</option> | |
581 | <option value='ttyUSB3' $selected{'COMPORT'}{'ttyUSB3'}>ttyUSB3</option> | |
582 | <option value='rfcomm0' $selected{'COMPORT'}{'rfcomm0'}>rfcomm0 (bluetooth)</option> | |
583 | <option value='rfcomm1' $selected{'COMPORT'}{'rfcomm1'}>rfcomm1 (bluetooth)</option> | |
584 | END | |
585 | ; | |
586 | if ($pppsettings{'TYPE'} ne 'serial' ) { | |
587 | print <<END | |
588 | <option value='ttyACM0' $selected{'COMPORT'}{'ttyACM0'}>$Lang::tr{'usb modem on acm0'}</option> | |
589 | <option value='ttyACM1' $selected{'COMPORT'}{'ttyACM1'}>$Lang::tr{'usb modem on acm1'}</option> | |
590 | <option value='ttyACM2' $selected{'COMPORT'}{'ttyACM2'}>$Lang::tr{'usb modem on acm2'}</option> | |
591 | <option value='ttyACM3' $selected{'COMPORT'}{'ttyACM3'}>$Lang::tr{'usb modem on acm3'}</option> | |
592 | END | |
593 | ; | |
594 | } | |
595 | print "</select></td> "} | |
596 | ||
597 | if ($pppsettings{'TYPE'} =~ /^(modem|serial)$/) { | |
598 | print <<END; | |
599 | <tr> | |
600 | <td colspan='3' width='75%'>$Lang::tr{'monitor interface'}:</td> | |
601 | <td width='25%'> | |
602 | <select name="MONPORT" style="width: 165px;"> | |
603 | <option value="" $selected{'MONPORT'}{''}>---</option> | |
604 | <option value="ttyUSB0" $selected{'MONPORT'}{'ttyUSB0'}>ttyUSB0</option> | |
605 | <option value="ttyUSB1" $selected{'MONPORT'}{'ttyUSB1'}>ttyUSB1</option> | |
606 | <option value="ttyUSB2" $selected{'MONPORT'}{'ttyUSB2'}>ttyUSB2</option> | |
607 | <option value="ttyUSB3" $selected{'MONPORT'}{'ttyUSB3'}>ttyUSB3</option> | |
608 | </select> | |
609 | </td> | |
610 | </tr> | |
611 | END | |
612 | } | |
613 | ||
614 | if ($pppsettings{'TYPE'} =~ /^(modem|serial)$/ ) { | |
615 | print <<END | |
616 | <tr> | |
617 | <td colspan='3' width='75%'>$Lang::tr{'computer to modem rate'}</td> | |
618 | <td width='25%'><select name='DTERATE' style="width: 165px"> | |
619 | <option value='9600' $selected{'DTERATE'}{'9600'}>9600</option> | |
620 | <option value='19200' $selected{'DTERATE'}{'19200'}>19200</option> | |
621 | <option value='38400' $selected{'DTERATE'}{'38400'}>38400</option> | |
622 | <option value='57600' $selected{'DTERATE'}{'57600'}>57600</option> | |
623 | <option value='115200' $selected{'DTERATE'}{'115200'}>115200</option> | |
624 | <option value='230400' $selected{'DTERATE'}{'230400'}>230400</option> | |
625 | <option value='460800' $selected{'DTERATE'}{'460800'}>460800</option> | |
626 | <option value='921600' $selected{'DTERATE'}{'921600'}>921600</option> | |
627 | </select></td> | |
628 | </tr> | |
629 | END | |
630 | ; | |
631 | } | |
632 | if ($pppsettings{'TYPE'} =~ /^(modem)$/ ) { | |
633 | print "<tr><td colspan='3' width='75%'>$Lang::tr{'number'}</td>\n"; | |
634 | print "<td width='25%'><input type='text' name='TELEPHONE' value='$pppsettings{'TELEPHONE'}'></td><tr>\n"; | |
635 | if ($pppsettings{'TYPE'} eq 'modem' ) { | |
636 | print "<tr><td colspan='3' width='75%'>$Lang::tr{'modem speaker on'}</td>\n"; | |
637 | print "<td width='25%'><input type='checkbox' name='SPEAKER' $checked{'SPEAKER'}{'on'} /></td></tr>\n"; | |
638 | } | |
639 | } | |
640 | } | |
641 | if ($pppsettings{'TYPE'} eq 'modem') { | |
642 | print <<END | |
643 | <tr> | |
644 | <td colspan='3' width='75%'>$Lang::tr{'dialing mode'}</td> | |
645 | <td width='25%'><select name='DIALMODE' style="width: 165px"> | |
646 | <option value='T' $selected{'DIALMODE'}{'T'}>$Lang::tr{'tone'}</option> | |
647 | <option value='P' $selected{'DIALMODE'}{'P'}>$Lang::tr{'pulse'}</option> | |
648 | </select></td> | |
649 | </tr> | |
650 | <tr> | |
651 | <td colspan='3' width='75%'>$Lang::tr{'optional at cmd'} 1 <img src='/blob.gif' alt='*' /></td> | |
652 | <td width='25%'><input type='text' name='ADD_AT1' value='$pppsettings{'ADD_AT1'}'></td> | |
653 | </tr> | |
654 | <tr> | |
655 | <td colspan='3' width='75%'>$Lang::tr{'optional at cmd'} 2 <img src='/blob.gif' alt='*' /></td> | |
656 | <td width='25%'><input type='text' name='ADD_AT2' value='$pppsettings{'ADD_AT2'}'></td> | |
657 | </tr> | |
658 | <tr> | |
659 | <td colspan='3' width='75%'>$Lang::tr{'optional at cmd'} 3 <img src='/blob.gif' alt='*' /></td> | |
660 | <td width='25%'><input type='text' name='ADD_AT3' value='$pppsettings{'ADD_AT3'}'></td> | |
661 | </tr> | |
662 | <tr> | |
663 | <td colspan='3' width='75%'>$Lang::tr{'send cr'}</td> | |
664 | <td width='50%'><input type='checkbox' name='SENDCR' $checked{'SENDCR'}{'on'} /></td> | |
665 | </tr> | |
666 | END | |
667 | ; | |
668 | } | |
669 | ||
670 | print <<END | |
671 | <tr> | |
672 | <td colspan='3' width='75%'>$Lang::tr{'idle timeout'}</td> | |
673 | <td width='25%'><input type='text' name='TIMEOUT' value='$pppsettings{'TIMEOUT'}' /></td> | |
674 | </tr> | |
675 | <tr> | |
676 | <td colspan='3' width='75%'>$Lang::tr{'connection debugging'}:</td> | |
677 | <td width='25%'><input type='checkbox' name='DEBUG' $checked{'DEBUG'}{'on'} /></td> | |
678 | </tr> | |
679 | <tr> | |
680 | <td colspan='4' width='100%'><br></br></td></tr> | |
681 | <tr> | |
682 | <td colspan='4' width='100%' bgcolor='$color{'color20'}'><b>$Lang::tr{'reconnection'}:</b></td> | |
683 | </tr> | |
684 | <tr> | |
685 | <td colspan='4' width='100%'><input type='radio' name='RECONNECTION' value='dialondemand' $checked{'RECONNECTION'}{'dialondemand'}>$Lang::tr{'dod'}</td> | |
686 | </tr> | |
687 | END | |
688 | ; | |
689 | if ($pppsettings{'TYPE'} ne 'isdn') { | |
690 | print <<END | |
691 | <tr> | |
692 | <td colspan='4' width='100%'><input type='radio' name='RECONNECTION' value='persistent' $checked{'RECONNECTION'}{'persistent'}>$Lang::tr{'persistent'}</td> | |
693 | </tr> | |
694 | <tr> | |
695 | <td colspan='3' width='75%'>$Lang::tr{'backupprofile'}:</td> | |
696 | <td width='25%'><select name='BACKUPPROFILE' style="width: 165px"> | |
697 | END | |
698 | ; | |
699 | for ($c = 1; $c <= $maxprofiles; $c++) { | |
700 | print "\t<option value='$c' $selected{'BACKUPPROFILE'}{$c}>$c. $profilenames[$c]</option>\n"; | |
701 | } | |
702 | print <<END | |
703 | </select></td> | |
704 | </tr> | |
705 | END | |
706 | ; | |
707 | } | |
708 | print <<END | |
709 | <tr> | |
710 | <td colspan='3' width='75%'>$Lang::tr{'dod for dns'}</td> | |
711 | <td width='25%'><input type='checkbox' name='DIALONDEMANDDNS' $checked{'DIALONDEMANDDNS'}{'on'} /></td> | |
712 | </tr> | |
713 | <tr> | |
714 | <td colspan='3' width='75%'>$Lang::tr{'holdoff'}:</td> | |
715 | <td width='25%'><input type='text' name='HOLDOFF' value='$pppsettings{'HOLDOFF'}' /></td> | |
716 | </tr> | |
717 | <tr> | |
718 | <td colspan='3' width='75%'>$Lang::tr{'maximum retries'}</td> | |
719 | <td width='25%'><input type='text' name='MAXRETRIES' value='$pppsettings{'MAXRETRIES'}' /></td> | |
720 | </tr> | |
721 | END | |
722 | ; | |
723 | ||
724 | if ($pppsettings{'TYPE'} eq 'pptp') | |
725 | { | |
726 | ||
727 | print <<END | |
728 | <tr><td colspan='4' width='100%'><br></br></td></tr> | |
729 | <tr> | |
730 | <td colspan='4' width='100%' bgcolor='$color{'color20'}'><b>$Lang::tr{'pptp settings'}</b></td> | |
731 | </tr> | |
732 | <tr> | |
733 | <td width='25%'>Peer</td> | |
734 | <td colspan='3'><input size=50 type='text' name='PPTP_PEER' value='$pppsettings{'PPTP_PEER'}' /></td> | |
735 | </tr> | |
736 | <tr> | |
737 | <td width='25%'>My Netconfig</td> | |
738 | <td colspan='3'><input size=50 type='text' name='PPTP_NICCFG' value='$pppsettings{'PPTP_NICCFG'}' /></td> | |
739 | </tr> | |
740 | <tr> | |
741 | <td width='25%'>PPTP Route <img src='/blob.gif' alt='*' /></td> | |
742 | <td colspan='3'><input size=50 type='text' name='PPTP_ROUTE' value='$pppsettings{'PPTP_ROUTE'}' /></td> | |
743 | </tr> | |
744 | ||
745 | END | |
746 | ; | |
747 | } | |
748 | ||
749 | if ($pppsettings{'TYPE'} =~ /^(pppoeatm|pptpatm)$/) | |
750 | { | |
751 | ||
752 | print <<END | |
753 | <tr> | |
754 | <td colspan='4' width='100%' bgcolor='$color{'color20'}'><b>$Lang::tr{'adsl settings'}:</b></td> | |
755 | <tr> | |
756 | ||
757 | <td> $Lang::tr{'encapsulation'}:</td> | |
758 | <td colspan='2' width='30%'> | |
759 | <select name='ENCAP'> | |
760 | <option value='0' $selected{'ENCAP'}{'0'}>LLC</option> | |
761 | <option value='1' $selected{'ENCAP'}{'1'}>VCmux</option> | |
762 | </select> | |
763 | </td> | |
764 | </tr> | |
765 | <tr> | |
766 | ||
767 | <td nowrap='nowrap'>$Lang::tr{'vpi number'}</td> | |
768 | <td><input type='text' size='5' name='VPI' value='$pppsettings{'VPI'}' /></td> | |
769 | <td align='right'>$Lang::tr{'vci number'}</td> | |
770 | <td colspan='2'><input type='text' size='5' name='VCI' value='$pppsettings{'VCI'}' /></td> | |
771 | </tr> | |
772 | END | |
773 | ; | |
774 | } | |
775 | ||
776 | if ($pppsettings{'TYPE'} =~ /^(pppoe|vdsl|pppoeatm)$/) { | |
777 | print <<END | |
778 | <tr> | |
779 | <td colspan='4' width='100%' bgcolor='$color{'color20'}'><b>IPTV/VLAN:</b></td> | |
780 | </tr> | |
781 | END | |
782 | ; | |
783 | if ( -e '/opt/pakfire/db/installed/meta-igmpproxy'){ | |
784 | print <<END | |
785 | <tr> | |
786 | <td colspan='3' width='100%'><input type='radio' name='IPTV' value='enable' $checked{'IPTV'}{'enable'}>$Lang::tr{'on'}</td> | |
787 | <td colspan='1' rowspan='2' width='100%'><textarea name='IPTVSERVERS' cols='16' wrap='off'> | |
788 | END | |
789 | ; | |
790 | print $pppsettings{'IPTVSERVERS'}; | |
791 | print <<END | |
792 | </textarea></td> | |
793 | </tr> | |
794 | <tr> | |
795 | <td colspan='3' width='100%'><input type='radio' name='IPTV' value='disable' $checked{'IPTV'}{'disable'}>$Lang::tr{'off'}</td> | |
796 | </tr> | |
797 | <tr> | |
798 | <td>INET_VLAN</td> | |
799 | <td><input size=5 type='number' name='INET_VLAN' value='$pppsettings{'INET_VLAN'}' /></td> | |
800 | <td>IPTV_VLAN</td> | |
801 | <td><input size=5 type='number' name='IPTV_VLAN' value='$pppsettings{'IPTV_VLAN'}' /></td> | |
802 | </tr> | |
803 | ||
804 | END | |
805 | ; | |
806 | } | |
807 | else { | |
808 | print "<tr><td colspan='4' width='100%'>No IPTV possible install addon igmpproxy</td></tr>"; | |
809 | if ($pppsettings{'TYPE'} eq 'vdsl') { | |
810 | print <<END | |
811 | <tr> | |
812 | <td>INET_VLAN</td> | |
813 | <td><input size=5 type='number' name='INET_VLAN' value='$pppsettings{'INET_VLAN'}' /></td> | |
814 | </tr> | |
815 | END | |
816 | ; | |
817 | } | |
818 | } | |
819 | } | |
820 | ||
821 | if ($pppsettings{'TYPE'} eq 'pppoe' || $pppsettings{'TYPE'} eq 'pppoeatm' || $pppsettings{'TYPE'} eq 'vdsl') | |
822 | { | |
823 | print <<END | |
824 | <tr><td colspan='4' width='100%'><br></br></td></tr> | |
825 | <tr> | |
826 | <td colspan='4' width='100%' bgcolor='$color{'color20'}'><b>$Lang::tr{'pppoe settings'}</b></td> | |
827 | </tr> | |
828 | <tr> | |
829 | <td width='25%'>$Lang::tr{'service name'} <img src='/blob.gif' alt='*' /></td> | |
830 | <td colspan='2' width='50%'></td> | |
831 | <td width='25%'><input type='text' name='SERVICENAME' value='$pppsettings{'SERVICENAME'}' /></td> | |
832 | </tr> | |
833 | <tr> | |
834 | <td width='25%'>$Lang::tr{'concentrator name'} <img src='/blob.gif' alt='*' /></td> | |
835 | <td colspan='2' width='50%'></td> | |
836 | <td width='25%'><input type='text' name='CONCENTRATORNAME' value='$pppsettings{'CONCENTRATORNAME'}' /></td> | |
837 | </tr> | |
838 | END | |
839 | ; | |
840 | } | |
841 | ||
842 | print <<END | |
843 | <tr><td colspan='4' width='100%'><br></br></td></tr> | |
844 | <tr> | |
845 | <td bgcolor='$color{'color20'}' colspan='4' width='100%'><b>MTU/MRU</b></td> | |
846 | </tr> | |
847 | <tr> | |
848 | <tr> | |
849 | <td width='25%'>MTU <img src='/blob.gif' alt='*' /></td> | |
850 | <td width='25%'><input type='text' name='MTU' value='$pppsettings{'MTU'}' /></td> | |
851 | </tr> | |
852 | <tr> | |
853 | <td width='25%'>MRU <img src='/blob.gif' alt='*' /></td> | |
854 | <td width='25%'><input type='text' name='MRU' value='$pppsettings{'MRU'}' /></td> | |
855 | </tr> | |
856 | END | |
857 | ; | |
858 | ||
859 | print <<END | |
860 | <tr><td colspan='4' width='100%'><br></br></td></tr> | |
861 | <tr> | |
862 | <td bgcolor='$color{'color20'}' colspan='4' width='100%'><b>$Lang::tr{'authentication'}</b></td> | |
863 | </tr> | |
864 | <tr> | |
865 | <td width='25%'>$Lang::tr{'username'}</td> | |
866 | <td width='25%'><input type='text' name='USERNAME' value='$pppsettings{'USERNAME'}' /></td> | |
867 | <td width='25%'>$Lang::tr{'password'}</td> | |
868 | <td width='25%'><input type='password' name='PASSWORD' value='$pppsettings{'PASSWORD'}' /></td> | |
869 | </tr> | |
870 | <tr> | |
871 | <td width='25%'>$Lang::tr{'method'}</td> | |
872 | <td width='25%'><select name='AUTH' style="width: 165px"> | |
873 | <option value='pap-or-chap' $selected{'AUTH'}{'pap-or-chap'}>$Lang::tr{'pap or chap'}</option> | |
874 | <option value='pap' $selected{'AUTH'}{'pap'}>PAP</option> | |
875 | <option value='chap' $selected{'AUTH'}{'chap'}>CHAP</option> | |
876 | END | |
877 | ; | |
878 | if ($pppsettings{'TYPE'} eq 'modem') { | |
879 | print <<END | |
880 | <option value='standard-login-script' $selected{'AUTH'}{'standard-login-script'}>$Lang::tr{'standard login script'}</option> | |
881 | <option value='demon-login-script' $selected{'AUTH'}{'demon-login-script'}>$Lang::tr{'demon login script'}</option> | |
882 | <option value='other-login-script' $selected{'AUTH'}{'other-login-script'}>$Lang::tr{'other login script'}</option> | |
883 | END | |
884 | ; | |
885 | } | |
886 | print <<END | |
887 | </select></td> | |
888 | <td width='25%'>$Lang::tr{'script name'} <img src='/blob.gif' alt='*' /></td> | |
889 | <td width='25%'><input type='text' name='LOGINSCRIPT' value='$pppsettings{'LOGINSCRIPT'}' /></td> | |
890 | </tr> | |
891 | <tr><td colspan='4' width='100%'><br></br></td></tr> | |
892 | <tr> | |
893 | <td bgcolor='$color{'color20'}' colspan='4' width='100%'><b>DNS:</b></td> | |
894 | </tr> | |
895 | <tr> | |
896 | <td colspan='4' width='100%'><input type='radio' name='DNS' value='Automatic' $checked{'DNS'}{'Automatic'} />$Lang::tr{'automatic'}</td> | |
897 | </tr> | |
898 | <tr> | |
899 | <td colspan='4' width='100%'><input type='radio' name='DNS' value='Manual' $checked{'DNS'}{'Manual'} />$Lang::tr{'manual'}</td> | |
900 | </tr> | |
901 | <tr> | |
902 | <td width='25%'>$Lang::tr{'primary dns'}</td> | |
903 | <td width='25%'><input type='text' name='DNS1' value='$pppsettings{'DNS1'}'></td> | |
904 | <td width='25%'>$Lang::tr{'secondary dns'}</td> | |
905 | <td width='25%'><input type='text' name='DNS2' value='$pppsettings{'DNS2'}'></td> | |
906 | </tr> | |
907 | <tr><td colspan='4' width='100%'><br></br><hr></hr><br></br></td></tr> | |
908 | <tr> | |
909 | <td width='25%'>$Lang::tr{'profile name'}</td> | |
910 | <td width='25%'><input type='text' name='PROFILENAME' value='$pppsettings{'PROFILENAME'}'> | |
911 | <td colspan='2' width='50%'></td> | |
912 | </tr> | |
913 | <tr> | |
914 | <td align='center' colspan='4' width='100%'><input type='submit' name='ACTION' value='$Lang::tr{'save'}'></td> | |
915 | </tr> | |
916 | <tr> | |
917 | <td colspan='2' width='50%'>$Lang::tr{'legend'}:</td> | |
918 | <td colspan='2' width='50%'><img src='/blob.gif' alt='*' /> $Lang::tr{'this field may be blank'}</td> | |
919 | </tr> | |
920 | </table> | |
921 | END | |
922 | ; | |
923 | &Header::closebox(); | |
924 | } | |
925 | ||
926 | print "</form>\n"; | |
927 | ||
928 | &Header::closebigbox(); | |
929 | ||
930 | &Header::closepage(); | |
931 | ||
932 | sub updatesettings | |
933 | { | |
934 | # make a link from the selected profile to the "default" one. | |
935 | unlink("${General::swroot}/ppp/settings"); | |
936 | link("${General::swroot}/ppp/settings-$pppsettings{'PROFILE'}", | |
937 | "${General::swroot}/ppp/settings"); | |
938 | system ("/usr/bin/touch", "${General::swroot}/ppp/updatesettings"); | |
939 | } | |
940 | ||
941 | sub writesecrets | |
942 | { | |
943 | # write secrets file. | |
944 | open(FILE, ">/${General::swroot}/ppp/secrets") or die "Unable to write secrets file."; | |
945 | flock(FILE, 2); | |
946 | my $username = $pppsettings{'USERNAME'}; | |
947 | my $password = $pppsettings{'PASSWORD'}; | |
948 | print FILE "'$username' * '$password'\n"; | |
949 | chmod 0600, "${General::swroot}/ppp/secrets"; | |
950 | close FILE; | |
951 | } | |
952 | ||
953 | sub initprofile | |
954 | { | |
955 | $pppsettings{'PROFILENAME'} = $Lang::tr{'unnamed'}; | |
956 | $pppsettings{'COMPORT'} = 'ttyS0'; | |
957 | $pppsettings{'MONPORT'} = ''; | |
958 | $pppsettings{'DTERATE'} = 115200; | |
959 | $pppsettings{'SPEAKER'} = 'off'; | |
960 | $pppsettings{'RECONNECTION'} = 'persistent'; | |
961 | $pppsettings{'DIALONDEMANDDNS'} = 'off'; | |
962 | $pppsettings{'AUTOCONNECT'} = 'on'; | |
963 | $pppsettings{'SENDCR'} = 'off'; | |
964 | $pppsettings{'USEIBOD'} = 'off'; | |
965 | $pppsettings{'USEDOV'} = 'off'; | |
966 | $pppsettings{'MODEM'} = 'PCIST'; | |
967 | $pppsettings{'LINE'} = 'WO'; | |
968 | $pppsettings{'ENCAP'} = '0'; | |
969 | $pppsettings{'VPI'} = '1'; | |
970 | $pppsettings{'VCI'} = '32'; | |
971 | $pppsettings{'PPTP_PEER'} = '10.0.0.138'; | |
972 | $pppsettings{'PPTP_NICCFG'} = '10.0.0.140/24 broadcast 10.0.0.255'; | |
973 | $pppsettings{'PPTP_ROUTE'} = ''; | |
974 | $pppsettings{'PROTOCOL'} = 'RFC2364'; | |
975 | $pppsettings{'MTU'} = ''; | |
976 | $pppsettings{'MRU'} = ''; | |
977 | $pppsettings{'DIALMODE'} = 'T'; | |
978 | $pppsettings{'MAXRETRIES'} = 5; | |
979 | $pppsettings{'HOLDOFF'} = 30; | |
980 | $pppsettings{'TIMEOUT'} = 15; | |
981 | $pppsettings{'MODULATION'} = 'AUTO'; | |
982 | $pppsettings{'AUTH'} = 'pap-or-chap'; | |
983 | $pppsettings{'DNS'} = 'Automatic'; | |
984 | $pppsettings{'DEBUG'} = 'off'; | |
985 | $pppsettings{'BACKUPPROFILE'} = $pppsettings{'PROFILE'}; | |
986 | $pppsettings{'IPTVSERVERS'} = '192.168.2.51/32'; | |
987 | $pppsettings{'IPTV'} = 'disable'; | |
988 | $pppsettings{'INET_VLAN'} = '7'; | |
989 | $pppsettings{'IPTV_VLAN'} = '8'; | |
990 | ||
991 | if ( -e '/usr/local/bin/igmpproxy'){ | |
992 | $pppsettings{'IPTV'} = 'enable'; | |
993 | } | |
994 | ||
995 | # Get PPPoE settings so we can see if PPPoE is enabled or not. | |
996 | &General::readhash("${General::swroot}/ethernet/settings", \%netsettings); | |
997 | ||
998 | # empty profile partial pre-initialization | |
999 | if ($netsettings{'CONFIG_TYPE'} =~ /^(1|2|3|4)$/) { | |
1000 | $pppsettings{'TYPE'}=lc($netsettings{'RED_TYPE'}); | |
1001 | } else { | |
1002 | $pppsettings{'TYPE'}='modem'; | |
1003 | } | |
1004 | } | |
1005 |