]>
Commit | Line | Data |
---|---|---|
ac1cfefa MT |
1 | #!/usr/bin/perl |
2 | # | |
3 | # SmoothWall CGIs | |
4 | # | |
5 | # This code is distributed under the terms of the GPL | |
6 | # | |
7 | # (c) The SmoothWall Team | |
8 | # | |
ac1cfefa MT |
9 | |
10 | use strict; | |
11 | ||
12 | # enable only the following on debugging purpose | |
13 | #use warnings; | |
14 | #use CGI::Carp 'fatalsToBrowser'; | |
15 | ||
986e08d9 | 16 | require '/var/ipfire/general-functions.pl'; |
ac1cfefa MT |
17 | require "${General::swroot}/lang.pl"; |
18 | require "${General::swroot}/header.pl"; | |
19 | ||
20 | our %pppsettings=(); | |
21 | my %temppppsettings=(); | |
22 | our %modemsettings=(); | |
23 | our %isdnsettings=(); | |
24 | our %netsettings=(); | |
25 | my %selected=(); | |
26 | my %checked=(); | |
27 | my @profilenames=(); | |
28 | my $errormessage = ''; | |
29 | my $maxprofiles = 5; | |
30 | my $kernel=`/bin/uname -r | /usr/bin/tr -d '\012'`; | |
31 | ||
f2fdd0c1 CS |
32 | my %color = (); |
33 | my %mainsettings = (); | |
34 | &General::readhash("${General::swroot}/main/settings", \%mainsettings); | |
35 | &General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color); | |
36 | ||
ac1cfefa MT |
37 | &Header::showhttpheaders(); |
38 | ||
39 | $pppsettings{'ACTION'} = ''; | |
40 | &initprofile(); | |
41 | &Header::getcgihash(\%pppsettings); | |
42 | ||
43 | if ($pppsettings{'ACTION'} ne '' && | |
44 | (-e '/var/run/ppp-ipcop.pid' || -e "${General::swroot}/red/active")) | |
45 | { | |
46 | $errormessage = $Lang::tr{'unable to alter profiles while red is active'}; | |
47 | # read in the current vars | |
48 | %pppsettings = (); | |
49 | $pppsettings{'VALID'} = ''; | |
50 | &General::readhash("${General::swroot}/ppp/settings", \%pppsettings); | |
51 | } | |
52 | elsif ($pppsettings{'ACTION'} eq $Lang::tr{'refresh'}) | |
53 | { | |
285c5bbd | 54 | unless ($pppsettings{'TYPE'} =~ /^(modem|serial|isdn|pppoe|pptp)$/) { |
ac1cfefa MT |
55 | $errormessage = $Lang::tr{'invalid input'}; |
56 | goto ERROR; } | |
57 | my $type = $pppsettings{'TYPE'}; | |
58 | &General::readhash("${General::swroot}/ppp/settings", \%pppsettings); | |
59 | $pppsettings{'TYPE'} = $type; | |
60 | } | |
61 | elsif ($pppsettings{'ACTION'} eq $Lang::tr{'save'}) | |
62 | { | |
3e615c37 | 63 | if ($pppsettings{'TYPE'} =~ /^(modem|serial|isdn)$/ && $pppsettings{'COMPORT'} !~ /^(ttyS0|ttyS1|ttyS2|ttyS3|ttyS4|ttyACM0|ttyACM1|ttyACM2|ttyACM3|isdn1|isdn2)$/) { |
ac1cfefa MT |
64 | $errormessage = $Lang::tr{'invalid input'}; |
65 | goto ERROR; } | |
6c666a3b | 66 | if ($pppsettings{'TYPE'} =~ /^(modem|serial)$/ && $pppsettings{'DTERATE'} !~ /^(9600|19200|38400|57600|115200|230400|460800)$/) { |
ac1cfefa MT |
67 | $errormessage = $Lang::tr{'invalid input'}; |
68 | goto ERROR; } | |
69 | if ($pppsettings{'TYPE'} eq 'modem' && $pppsettings{'DIALMODE'} !~ /^(T|P)$/) { | |
70 | $errormessage = $Lang::tr{'invalid input'}; | |
71 | goto ERROR; } | |
72 | if ($pppsettings{'AUTH'} !~ /^(pap-or-chap|pap|chap|standard-login-script|demon-login-script|other-login-script)$/) { | |
73 | $errormessage = $Lang::tr{'invalid input'}; | |
74 | goto ERROR; | |
75 | } | |
76 | ||
77 | if ($pppsettings{'PROFILENAME'} eq '') { | |
78 | $errormessage = $Lang::tr{'profile name not given'}; | |
79 | $pppsettings{'PROFILENAME'} = ''; | |
80 | goto ERROR; } | |
81 | if ($pppsettings{'TYPE'} =~ /^(modem|isdn)$/) { | |
82 | if ($pppsettings{'TELEPHONE'} eq '') { | |
83 | $errormessage = $Lang::tr{'telephone not set'}; | |
84 | goto ERROR; } | |
85 | if (!($pppsettings{'TELEPHONE'} =~ /^[\d\*\#\,]+$/)) { | |
86 | $errormessage = $Lang::tr{'bad characters in the telephone number field'}; | |
87 | goto ERROR; } | |
88 | } | |
89 | unless (($pppsettings{'PROTOCOL'} eq 'RFC1483' && $pppsettings{'METHOD'} =~ /^(STATIC|DHCP)$/)) { | |
90 | if ($pppsettings{'USERNAME'} eq '') { | |
91 | $errormessage = $Lang::tr{'username not set'}; | |
92 | goto ERROR; } | |
93 | if ($pppsettings{'PASSWORD'} eq '') { | |
94 | $errormessage = $Lang::tr{'password not set'}; | |
95 | goto ERROR; } | |
96 | } | |
97 | ||
98 | if ($pppsettings{'TIMEOUT'} eq '') { | |
99 | $errormessage = $Lang::tr{'idle timeout not set'}; | |
100 | goto ERROR; } | |
101 | if (!($pppsettings{'TIMEOUT'} =~ /^\d+$/)) { | |
102 | $errormessage = $Lang::tr{'only digits allowed in the idle timeout'}; | |
103 | goto ERROR; } | |
104 | ||
105 | if ($pppsettings{'LOGINSCRIPT'} =~ /[.\/ ]/ ) { | |
106 | $errormessage = $Lang::tr{'bad characters in script field'}; | |
107 | goto ERROR; } | |
108 | ||
109 | if ($pppsettings{'DNS1'}) | |
110 | { | |
111 | if (!(&General::validip($pppsettings{'DNS1'}))) { | |
112 | $errormessage = $Lang::tr{'invalid primary dns'}; | |
113 | goto ERROR; } | |
114 | } | |
115 | if ($pppsettings{'DNS2'}) | |
116 | { | |
117 | if (!(&General::validip($pppsettings{'DNS2'}))) { | |
118 | $errormessage = $Lang::tr{'invalid secondary dns'}; | |
119 | goto ERROR; } | |
120 | } | |
121 | ||
122 | if ($pppsettings{'MAXRETRIES'} eq '') { | |
123 | $errormessage = $Lang::tr{'max retries not set'}; | |
124 | goto ERROR; } | |
125 | if (!($pppsettings{'MAXRETRIES'} =~ /^\d+$/)) { | |
126 | $errormessage = $Lang::tr{'only digits allowed in max retries field'}; | |
127 | goto ERROR; } | |
128 | ||
129 | if (!($pppsettings{'HOLDOFF'} =~ /^\d+$/)) { | |
130 | $errormessage = $Lang::tr{'only digits allowed in holdoff field'}; | |
131 | goto ERROR; } | |
132 | ||
ac1cfefa MT |
133 | if ($pppsettings{'TYPE'} eq 'pptp') { |
134 | $errormessage = ''; | |
135 | if ($pppsettings{'METHOD'} eq 'STATIC') { | |
136 | if (! &General::validip($pppsettings{'ROUTERIP'})) { | |
137 | $errormessage = $Lang::tr{'router ip'}.' '.$Lang::tr{'invalid ip'}; | |
138 | } | |
139 | } else { | |
140 | if (($pppsettings{'DHCP_HOSTNAME'} ne '') && (! &General::validfqdn($pppsettings{'DHCP_HOSTNAME'})) ) { | |
141 | $errormessage = $errormessage.' '.$Lang::tr{'hostname'}.' '.$Lang::tr{'invalid hostname'}; | |
142 | } | |
143 | } | |
144 | if ($errormessage ne '') {goto ERROR; } | |
145 | } | |
146 | ||
ac1cfefa MT |
147 | if ( ($pppsettings{'PROTOCOL'} eq 'RFC1483') && ($pppsettings{'METHOD'} eq '') && \ |
148 | ($pppsettings{'TYPE'} !~ /^(alcatelusb|fritzdsl)$/)) { | |
149 | $errormessage = $Lang::tr{'invalid input'}; | |
150 | goto ERROR; } | |
151 | ||
152 | if (($pppsettings{'PROTOCOL'} eq 'RFC1483' && $pppsettings{'METHOD'} eq 'DHCP')) { | |
153 | if ($pppsettings{'DHCP_HOSTNAME'} ne '') { | |
154 | if (! &General::validfqdn($pppsettings{'DHCP_HOSTNAME'})) { | |
155 | $errormessage = $errormessage.' '.$Lang::tr{'hostname'}.': '.$Lang::tr{'invalid hostname'}; } | |
156 | } | |
157 | } | |
158 | ||
159 | if (($pppsettings{'PROTOCOL'} eq 'RFC1483' && $pppsettings{'METHOD'} eq 'STATIC')) { | |
160 | $errormessage = ''; | |
161 | if (! &General::validip($pppsettings{'IP'})) { | |
162 | $errormessage = $Lang::tr{'static ip'}.' '.$Lang::tr{'invalid ip'}; } | |
163 | if (! &General::validip($pppsettings{'GATEWAY'})) { | |
164 | $errormessage = $errormessage.' '.$Lang::tr{'gateway ip'}.' '.$Lang::tr{'invalid ip'}; } | |
165 | if (! &General::validmask($pppsettings{'NETMASK'})) { | |
166 | $errormessage = $errormessage.' '.$Lang::tr{'netmask'}.' '.$Lang::tr{'invalid netmask'}; } | |
167 | if ($pppsettings{'BROADCAST'} ne '') { | |
168 | if (! &General::validip($pppsettings{'BROADCAST'})) { | |
169 | $errormessage = $errormessage.' '.$Lang::tr{'broadcast'}.' '.$Lang::tr{'invalid broadcast ip'}; } | |
170 | } | |
171 | if( $pppsettings{'DNS'} eq 'Automatic') { | |
172 | $errormessage = $Lang::tr{'invalid input'}; } | |
173 | if ($errormessage ne '') {goto ERROR; } | |
174 | } | |
175 | ||
176 | if( $pppsettings{'PROTOCOL'} eq 'RFC1483' && $pppsettings{'METHOD'} ne 'PPPOE' && \ | |
177 | $pppsettings{'RECONNECTION'} eq 'dialondemand' ) { | |
178 | $errormessage = $Lang::tr{'invalid input'}; | |
179 | goto ERROR; } | |
180 | ||
181 | if( $pppsettings{'RECONNECTION'} eq 'dialondemand' && `/bin/cat ${General::swroot}/ddns/config` =~ /,on$/m ) { | |
182 | $errormessage = $Lang::tr{'dod not compatible with ddns'}; | |
183 | goto ERROR; } | |
184 | ||
ac1cfefa MT |
185 | if( $pppsettings{'PROTOCOL'} eq 'RFC1483') { |
186 | $pppsettings{'ENCAP'} = $pppsettings{'ENCAP_RFC1483'}; } | |
187 | if( $pppsettings{'PROTOCOL'} eq 'RFC2364') { | |
188 | $pppsettings{'ENCAP'} = $pppsettings{'ENCAP_RFC2364'}; } | |
189 | delete $pppsettings{'ENCAP_RFC1483'}; | |
190 | delete $pppsettings{'ENCAP_RFC2364'}; | |
191 | ||
192 | ERROR: | |
193 | if ($errormessage) { | |
194 | $pppsettings{'VALID'} = 'no'; } | |
195 | else { | |
196 | $pppsettings{'VALID'} = 'yes'; } | |
197 | ||
198 | # write cgi vars to the file. | |
199 | &General::writehash("${General::swroot}/ppp/settings-$pppsettings{'PROFILE'}", | |
200 | \%pppsettings); | |
201 | ||
202 | # make link and write secret file. | |
203 | &updatesettings(); | |
204 | &writesecrets(); | |
205 | ||
206 | &General::log("$Lang::tr{'profile saved'} $pppsettings{'PROFILENAME'}"); | |
ac1cfefa | 207 | } |
cb5e9c6c | 208 | if ($pppsettings{'ACTION'} eq $Lang::tr{'select'}) |
ac1cfefa MT |
209 | { |
210 | my $profile = $pppsettings{'PROFILE'}; | |
211 | %temppppsettings = (); | |
212 | $temppppsettings{'PROFILE'} = ''; | |
213 | &General::readhash("${General::swroot}/ppp/settings-$pppsettings{'PROFILE'}", | |
214 | \%temppppsettings); | |
215 | ||
216 | # make link. | |
217 | &updatesettings(); | |
218 | ||
219 | # read in the new params "early" so we can write secrets. | |
220 | %pppsettings = (); | |
221 | &General::readhash("${General::swroot}/ppp/settings", \%pppsettings); | |
222 | $pppsettings{'PROFILE'} = $profile; | |
223 | &General::writehash("${General::swroot}/ppp/settings-$pppsettings{'PROFILE'}", | |
224 | \%pppsettings); | |
225 | ||
226 | &writesecrets(); | |
227 | ||
228 | &General::log("$Lang::tr{'profile made current'} $pppsettings{'PROFILENAME'}"); | |
229 | } | |
230 | elsif ($pppsettings{'ACTION'} eq $Lang::tr{'delete'}) | |
231 | { | |
232 | &General::log("$Lang::tr{'profile deleted'} $pppsettings{'PROFILENAME'}"); | |
233 | ||
234 | my $profile = $pppsettings{'PROFILE'}; | |
235 | truncate ("${General::swroot}/ppp/settings-$pppsettings{'PROFILE'}", 0); | |
236 | ||
237 | %temppppsettings = (); | |
238 | $temppppsettings{'PROFILE'} = ''; | |
239 | &General::readhash("${General::swroot}/ppp/settings-$pppsettings{'PROFILE'}", | |
240 | \%temppppsettings); | |
241 | ||
242 | # make link. | |
243 | &updatesettings(); | |
244 | ||
245 | # read in the new params "early" so we can write secrets. | |
246 | %pppsettings = (); | |
247 | &General::readhash("${General::swroot}/ppp/settings", \%pppsettings); | |
248 | $pppsettings{'PROFILE'} = $profile; | |
249 | &initprofile; | |
250 | &General::writehash("${General::swroot}/ppp/settings-$pppsettings{'PROFILE'}", | |
251 | \%pppsettings); | |
252 | } | |
253 | else | |
254 | { | |
255 | # read in the current vars | |
256 | %pppsettings = (); | |
257 | $pppsettings{'VALID'} = ''; | |
258 | &General::readhash("${General::swroot}/ppp/settings", \%pppsettings); | |
259 | } | |
260 | ||
261 | # read in the profile names into @profilenames. | |
262 | my $c=0; | |
263 | for ($c = 1; $c <= $maxprofiles; $c++) | |
264 | { | |
265 | %temppppsettings = (); | |
6c666a3b | 266 | $temppppsettings{'PROFILENAME'} = $Lang::tr{'empty profile'}; |
ac1cfefa MT |
267 | &General::readhash("${General::swroot}/ppp/settings-$c", \%temppppsettings); |
268 | $profilenames[$c] = $temppppsettings{'PROFILENAME'}; | |
269 | } | |
270 | ||
271 | if ($pppsettings{'VALID'} eq '') | |
272 | { | |
273 | if ($pppsettings{'PROFILE'} eq '') { | |
274 | $pppsettings{'PROFILE'} = '1'; | |
275 | &initprofile(); | |
276 | } | |
277 | } | |
278 | for ($c = 1; $c <= $maxprofiles; $c++) { | |
279 | $selected{'PROFILE'}{$c} = ''; } | |
280 | $selected{'PROFILE'}{$pppsettings{'PROFILE'}} = "selected='selected'"; | |
281 | for ($c = 1; $c <= $maxprofiles; $c++) { | |
282 | $selected{'BACKUPPROFILE'}{$c} = ''; } | |
283 | $selected{'BACKUPPROFILE'}{$pppsettings{'BACKUPPROFILE'}} = "selected='selected'"; | |
284 | ||
285 | $selected{'TYPE'}{'modem'} = ''; | |
286 | $selected{'TYPE'}{'serial'} = ''; | |
ac1cfefa MT |
287 | $selected{'TYPE'}{'pppoe'} = ''; |
288 | $selected{'TYPE'}{'pptp'} = ''; | |
ac1cfefa MT |
289 | $selected{'TYPE'}{$pppsettings{'TYPE'}} = "selected='selected'"; |
290 | ||
291 | $checked{'DEBUG'}{'off'} = ''; | |
292 | $checked{'DEBUG'}{'on'} = ''; | |
293 | $checked{'DEBUG'}{$pppsettings{'DEBUG'}} = "checked='checked'"; | |
294 | ||
295 | $selected{'COMPORT'}{'ttyS0'} = ''; | |
296 | $selected{'COMPORT'}{'ttyS1'} = ''; | |
297 | $selected{'COMPORT'}{'ttyS2'} = ''; | |
298 | $selected{'COMPORT'}{'ttyS3'} = ''; | |
299 | $selected{'COMPORT'}{'ttyS4'} = ''; | |
3e615c37 MT |
300 | $selected{'COMPORT'}{'ttyACM0'} = ''; |
301 | $selected{'COMPORT'}{'ttyACM1'} = ''; | |
302 | $selected{'COMPORT'}{'ttyACM2'} = ''; | |
303 | $selected{'COMPORT'}{'ttyACM3'} = ''; | |
ac1cfefa MT |
304 | $selected{'COMPORT'}{$pppsettings{'COMPORT'}} = "selected='selected'"; |
305 | ||
306 | $selected{'DTERATE'}{'9600'} = ''; | |
307 | $selected{'DTERATE'}{'19200'} = ''; | |
308 | $selected{'DTERATE'}{'38400'} = ''; | |
309 | $selected{'DTERATE'}{'57600'} = ''; | |
310 | $selected{'DTERATE'}{'115200'} = ''; | |
311 | $selected{'DTERATE'}{'230400'} = ''; | |
6c666a3b | 312 | $selected{'DTERATE'}{'460800'} = ''; |
ac1cfefa MT |
313 | $selected{'DTERATE'}{$pppsettings{'DTERATE'}} = "selected='selected'"; |
314 | ||
315 | $checked{'SPEAKER'}{'off'} = ''; | |
316 | $checked{'SPEAKER'}{'on'} = ''; | |
317 | $checked{'SPEAKER'}{$pppsettings{'SPEAKER'}} = "checked='checked'"; | |
318 | ||
319 | $selected{'DIALMODE'}{'T'} = ''; | |
320 | $selected{'DIALMODE'}{'P'} = ''; | |
321 | $selected{'DIALMODE'}{$pppsettings{'DIALMODE'}} = "selected='selected'"; | |
322 | ||
323 | $checked{'RECONNECTION'}{'manual'} = ''; | |
324 | $checked{'RECONNECTION'}{'persistent'} = ''; | |
325 | $checked{'RECONNECTION'}{'dialondemand'} = ''; | |
326 | $checked{'RECONNECTION'}{$pppsettings{'RECONNECTION'}} = "checked='checked'"; | |
327 | ||
328 | $checked{'DIALONDEMANDDNS'}{'off'} = ''; | |
329 | $checked{'DIALONDEMANDDNS'}{'on'} = ''; | |
330 | $checked{'DIALONDEMANDDNS'}{$pppsettings{'DIALONDEMANDDNS'}} = "checked='checked'"; | |
331 | ||
332 | $checked{'AUTOCONNECT'}{'off'} = ''; | |
333 | $checked{'AUTOCONNECT'}{'on'} = ''; | |
334 | $checked{'AUTOCONNECT'}{$pppsettings{'AUTOCONNECT'}} = "checked='checked'"; | |
335 | ||
336 | $checked{'SENDCR'}{'off'} = ''; | |
337 | $checked{'SENDCR'}{'on'} = ''; | |
338 | $checked{'SENDCR'}{$pppsettings{'SENDCR'}} = "checked='checked'"; | |
339 | $checked{'USEDOV'}{'off'} = ''; | |
340 | $checked{'USEDOV'}{'on'} = ''; | |
341 | $checked{'USEDOV'}{$pppsettings{'USEDOV'}} = "checked='checked'"; | |
ac1cfefa MT |
342 | |
343 | $checked{'MODEM'}{'PCIST'} = ''; | |
344 | $checked{'MODEM'}{'USB'} = ''; | |
345 | $checked{'MODEM'}{$pppsettings{'MODEM'}} = "checked='checked'"; | |
346 | ||
347 | $selected{'LINE'}{'WO'} = ''; | |
348 | $selected{'LINE'}{'ES'} = ''; | |
349 | $selected{'LINE'}{'ES03'} = ''; | |
350 | $selected{'LINE'}{'FR'} = ''; | |
351 | $selected{'LINE'}{'FR04'} = ''; | |
352 | $selected{'LINE'}{'FR10'} = ''; | |
353 | $selected{'LINE'}{'IT'} = ''; | |
354 | $selected{'LINE'}{$pppsettings{'LINE'}} = "selected='selected'"; | |
355 | ||
356 | $checked{'MODULATION'}{'GDMT'} = ''; | |
357 | $checked{'MODULATION'}{'ANSI'} = ''; | |
358 | $checked{'MODULATION'}{'GLITE'} = ''; | |
359 | $checked{'MODULATION'}{'AUTO'} = ''; | |
360 | $checked{'MODULATION'}{$pppsettings{'MODULATION'}} = "checked='checked'"; | |
361 | ||
362 | $checked{'PROTOCOL'}{'RFC1483'} = ''; | |
363 | $checked{'PROTOCOL'}{'RFC2364'} = ''; | |
364 | $checked{'PROTOCOL'}{$pppsettings{'PROTOCOL'}} = "checked='checked'"; | |
365 | ||
366 | $selected{'ENCAP'}{'0'} = ''; | |
367 | $selected{'ENCAP'}{'1'} = ''; | |
368 | $selected{'ENCAP'}{'2'} = ''; | |
369 | $selected{'ENCAP'}{'3'} = ''; | |
370 | $selected{'ENCAP'}{'4'} = ''; | |
371 | $selected{'ENCAP'}{$pppsettings{'ENCAP'}} = "selected='selected'"; | |
372 | $checked{'METHOD'}{'STATIC'} = ''; | |
373 | $checked{'METHOD'}{'PPPOE'} = ''; | |
374 | $checked{'METHOD'}{'PPPOE_PLUGIN'} = ''; | |
375 | $checked{'METHOD'}{'DHCP'} = ''; | |
376 | $checked{'METHOD'}{$pppsettings{'METHOD'}} = "checked='checked'"; | |
377 | ||
378 | $selected{'AUTH'}{'pap-or-chap'} = ''; | |
379 | $selected{'AUTH'}{'pap'} = ''; | |
380 | $selected{'AUTH'}{'chap'} = ''; | |
381 | $selected{'AUTH'}{'standard-login-script'} = ''; | |
382 | $selected{'AUTH'}{'demon-login-script'} = ''; | |
383 | $selected{'AUTH'}{'other-login-script'} = ''; | |
384 | $selected{'AUTH'}{$pppsettings{'AUTH'}} = "selected='selected'"; | |
385 | ||
386 | $checked{'DNS'}{'Automatic'} = ''; | |
387 | $checked{'DNS'}{'Manual'} = ''; | |
388 | $checked{'DNS'}{$pppsettings{'DNS'}} = "checked='checked'"; | |
389 | ||
390 | &Header::openpage($Lang::tr{'ppp setup'}, 1, ''); | |
ac1cfefa MT |
391 | &Header::openbigbox('100%', 'left', '', $errormessage); |
392 | ||
393 | if ($errormessage) { | |
330345c2 | 394 | &Header::openbox('100%', 'center', $Lang::tr{'error messages'}); |
ac1cfefa MT |
395 | print "<CLASS name='base'>$errormessage\n"; |
396 | print " </CLASS>\n"; | |
397 | &Header::closebox(); | |
398 | } | |
399 | ||
400 | ||
401 | ### | |
402 | ### Box for selecting profile | |
403 | ### | |
404 | print "<form method='post' action='$ENV{'SCRIPT_NAME'}'>\n"; | |
330345c2 | 405 | &Header::openbox('100%', 'center', $Lang::tr{'profile'}); |
ac1cfefa | 406 | print <<END |
330345c2 | 407 | <table width='95%' cellspacing='0'> |
ac1cfefa | 408 | <tr> |
330345c2 MT |
409 | <td align='left'>$Lang::tr{'profile'}</td> |
410 | <td align='left'> | |
411 | <select name='PROFILE' style="width: 165px"> | |
ac1cfefa MT |
412 | END |
413 | ; | |
414 | for ($c = 1; $c <= $maxprofiles; $c++) | |
415 | { | |
416 | print "\t<option value='$c' $selected{'PROFILE'}{$c}>$c. $profilenames[$c]</option>\n"; | |
417 | } | |
418 | print <<END | |
419 | </select></td> | |
330345c2 MT |
420 | <td align='left'><input type='submit' name='ACTION' value='$Lang::tr{'select'}' /></td> |
421 | <td align='left'><input type='submit' name='ACTION' value='$Lang::tr{'delete'}' /></td> | |
422 | <td align='left'><input type='submit' name='ACTION' value='$Lang::tr{'restore'}' /></td> | |
ac1cfefa MT |
423 | </tr> |
424 | </table> | |
330345c2 MT |
425 | <br></br> |
426 | <hr></hr> | |
ac1cfefa MT |
427 | END |
428 | ; | |
330345c2 | 429 | |
ac1cfefa | 430 | &Header::closebox(); |
330345c2 MT |
431 | &Header::openbox('100%', 'center', $Lang::tr{'connection'}); |
432 | ||
ac1cfefa | 433 | print <<END |
330345c2 | 434 | <table width='95%' cellspacing='0'> |
ac1cfefa | 435 | <tr> |
330345c2 MT |
436 | <td width='25%'>$Lang::tr{'interface'}:</td> |
437 | <td width='25%'> | |
438 | <select name='TYPE' style="width: 165px"> | |
ac1cfefa MT |
439 | <option value='modem' $selected{'TYPE'}{'modem'}>$Lang::tr{'modem'}</option> |
440 | <option value='serial' $selected{'TYPE'}{'serial'}>$Lang::tr{'serial'}</option> | |
441 | END | |
442 | ; | |
ac1cfefa MT |
443 | if ($netsettings{'RED_TYPE'} eq 'PPPOE') { |
444 | print "\t<option value='pppoe' $selected{'TYPE'}{'pppoe'}>PPPoE</option>\n"; | |
445 | } | |
446 | if ($netsettings{'RED_TYPE'} eq 'PPTP') { | |
447 | print "\t<option value='pptp' $selected{'TYPE'}{'pptp'}>PPTP</option>\n"; | |
448 | } | |
449 | if (-f "/proc/bus/usb/devices") { | |
450 | print <<END | |
451 | <option value='eciadsl' $selected{'TYPE'}{'eciadsl'}>ECI USB ADSL</option> | |
452 | <option value='eagleusbadsl' $selected{'TYPE'}{'eagleusbadsl'}>Eagle USB ADSL (Acer Allied-Telesyn Comtrend D-Link Sagem USR)</option> | |
453 | <option value='conexantusbadsl' $selected{'TYPE'}{'conexantusbadsl'}>Conexant USB(Aetra Amigo Draytek Etec Mac Olitec Vitelcom Zoom)</option> | |
454 | <option value='amedynusbadsl' $selected{'TYPE'}{'amedynusbadsl'}>Zyxel 630-11 / Asus AAM6000UG USB ADSL</option> | |
455 | <option value='3cp4218usbadsl' $selected{'TYPE'}{'3cp4218usbadsl'}>3Com USB AccessRunner</option> | |
456 | <option value='alcatelusb' $selected{'TYPE'}{'alcatelusb'}>Speedtouch USB ADSL user mode driver</option> | |
457 | <option value='alcatelusbk' $selected{'TYPE'}{'alcatelusbk'}>Speedtouch USB ADSL kernel mode driver</option> | |
458 | END | |
459 | ; | |
460 | } | |
8cc01c83 CS |
461 | |
462 | # print "<option value='fritzdsl' $selected{'TYPE'}{'fritzdsl'}>Fritz!DSL</option>"; | |
ac1cfefa | 463 | print <<END |
8cc01c83 | 464 | </select></td> |
330345c2 | 465 | <td colspan='2' width='50%'><input type='submit' name='ACTION' value='$Lang::tr{'refresh'}'></td> |
ac1cfefa MT |
466 | </tr> |
467 | <tr> | |
330345c2 | 468 | <td colspan='2' width='50%'>USB:</td> |
ac1cfefa MT |
469 | END |
470 | ; | |
471 | if (-f "/proc/bus/usb/devices") { | |
472 | my $usb=`lsmod | cut -d ' ' -f1 | grep -E "hci"`; | |
473 | if ($usb eq '') { | |
330345c2 | 474 | print "\t<td colspan='2' width='50%'>$Lang::tr{'not running'}</td></tr>\n"; |
ac1cfefa | 475 | } else { |
330345c2 | 476 | print "\t<td colspan='2' width='50%'>$usb</td></tr>\n"; |
ac1cfefa MT |
477 | } |
478 | } | |
479 | ||
480 | if ($pppsettings{'TYPE'}) { | |
330345c2 | 481 | print "<tr><td colspan='4' width='100%'><br></br></td></tr>"; |
285c5bbd | 482 | if ($pppsettings{'TYPE'} =~ /^(modem|serial)$/) { |
ac1cfefa MT |
483 | print <<END |
484 | <tr> | |
330345c2 MT |
485 | <td colspan='3' width='75%'>$Lang::tr{'interface'}:</td> |
486 | <td width='25%'><select name='COMPORT' style="width: 165px"> | |
ac1cfefa MT |
487 | END |
488 | ; | |
489 | if ($pppsettings{'TYPE'} =~ /^(modem|serial)$/ ) { | |
490 | print <<END | |
491 | <option value='ttyS0' $selected{'COMPORT'}{'ttyS0'}>$Lang::tr{'modem on com1'}</option> | |
492 | <option value='ttyS1' $selected{'COMPORT'}{'ttyS1'}>$Lang::tr{'modem on com2'}</option> | |
493 | <option value='ttyS2' $selected{'COMPORT'}{'ttyS2'}>$Lang::tr{'modem on com3'}</option> | |
494 | <option value='ttyS3' $selected{'COMPORT'}{'ttyS3'}>$Lang::tr{'modem on com4'}</option> | |
495 | <option value='ttyS4' $selected{'COMPORT'}{'ttyS4'}>$Lang::tr{'modem on com5'}</option> | |
a29b2d7b MT |
496 | <option value='ttyACM0' $selected{'COMPORT'}{'ttyACM0'}>$Lang::tr{'usb modem on acm0'}</option> |
497 | <option value='ttyACM1' $selected{'COMPORT'}{'ttyACM1'}>$Lang::tr{'usb modem on acm1'}</option> | |
498 | <option value='ttyACM2' $selected{'COMPORT'}{'ttyACM2'}>$Lang::tr{'usb modem on acm2'}</option> | |
499 | <option value='ttyACM3' $selected{'COMPORT'}{'ttyACM3'}>$Lang::tr{'usb modem on acm3'}</option> | |
ac1cfefa MT |
500 | </select></td> |
501 | END | |
ac1cfefa MT |
502 | ; |
503 | } | |
504 | if ($pppsettings{'TYPE'} =~ /^(modem|serial)$/ ) { | |
505 | print <<END | |
330345c2 MT |
506 | <tr> |
507 | <td colspan='3' width='75%'>$Lang::tr{'computer to modem rate'}</td> | |
508 | <td width='25%'><select name='DTERATE' style="width: 165px"> | |
ac1cfefa MT |
509 | <option value='9600' $selected{'DTERATE'}{'9600'}>9600</option> |
510 | <option value='19200' $selected{'DTERATE'}{'19200'}>19200</option> | |
511 | <option value='38400' $selected{'DTERATE'}{'38400'}>38400</option> | |
512 | <option value='57600' $selected{'DTERATE'}{'57600'}>57600</option> | |
513 | <option value='115200' $selected{'DTERATE'}{'115200'}>115200</option> | |
514 | <option value='230400' $selected{'DTERATE'}{'230400'}>230400</option> | |
6c666a3b | 515 | <option value='460800' $selected{'DTERATE'}{'460800'}>460800</option> |
ac1cfefa MT |
516 | </select></td> |
517 | </tr> | |
518 | END | |
519 | ; | |
330345c2 | 520 | } |
285c5bbd | 521 | if ($pppsettings{'TYPE'} =~ /^(modem)$/ ) { |
330345c2 MT |
522 | print "<tr><td colspan='3' width='75%'>$Lang::tr{'number'}</td>\n"; |
523 | print "<td width='25%'><input type='text' name='TELEPHONE' value='$pppsettings{'TELEPHONE'}'></td><tr>\n"; | |
ac1cfefa | 524 | if ($pppsettings{'TYPE'} eq 'modem' ) { |
330345c2 MT |
525 | print "<tr><td colspan='3' width='75%'>$Lang::tr{'modem speaker on'}</td>\n"; |
526 | print "<td width='25%'><input type='checkbox' name='SPEAKER' $checked{'SPEAKER'}{'on'} /></td></tr>\n"; | |
527 | } | |
ac1cfefa MT |
528 | } |
529 | } | |
530 | if ($pppsettings{'TYPE'} eq 'modem') { | |
531 | print <<END | |
532 | <tr> | |
330345c2 MT |
533 | <td colspan='3' width='75%'>$Lang::tr{'dialing mode'}</td> |
534 | <td width='25%'><select name='DIALMODE' style="width: 165px"> | |
ac1cfefa MT |
535 | <option value='T' $selected{'DIALMODE'}{'T'}>$Lang::tr{'tone'}</option> |
536 | <option value='P' $selected{'DIALMODE'}{'P'}>$Lang::tr{'pulse'}</option> | |
537 | </select></td> | |
330345c2 MT |
538 | </tr> |
539 | <tr> | |
540 | <td colspan='3' width='75%'>$Lang::tr{'send cr'}</td> | |
541 | <td width='50%'><input type='checkbox' name='SENDCR' $checked{'SENDCR'}{'on'} /></td> | |
ac1cfefa MT |
542 | </tr> |
543 | END | |
544 | ; | |
545 | } | |
546 | ||
547 | print <<END | |
548 | <tr> | |
330345c2 MT |
549 | <td colspan='3' width='75%'>$Lang::tr{'idle timeout'}</td> |
550 | <td width='25%'><input type='text' name='TIMEOUT' value='$pppsettings{'TIMEOUT'}' /></td> | |
ac1cfefa MT |
551 | </tr> |
552 | END | |
553 | ; | |
cb5e9c6c | 554 | if ( $netsettings{'CONFIG_TYPE'} =~ /^(1|2|3|4)$/ && ( $netsettings{'RED_TYPE'} eq "DHCP" || $netsettings{'RED_TYPE'} eq "STATIC") ) { |
ac1cfefa | 555 | $pppsettings{'AUTOCONNECT'} = 'on'; |
330345c2 MT |
556 | print "<tr><td colspan='3' width='75%'>$Lang::tr{'connect on ipfire restart'}</td>\n"; |
557 | print "<td width='25%'><input type='checkbox' disabled='disabled' name='AUTOCONNECT' value='on' $checked{'AUTOCONNECT'}{'on'}></td>\n"; | |
ac1cfefa | 558 | } else { |
330345c2 MT |
559 | print "<tr><td colspan='3' width='75%'>$Lang::tr{'connect on ipfire restart'}</td>\n"; |
560 | print "<td width='25%'><input type='checkbox' name='AUTOCONNECT' value='on' $checked{'AUTOCONNECT'}{'on'}></td>\n"; | |
ac1cfefa MT |
561 | } |
562 | print <<END | |
330345c2 MT |
563 | </tr> |
564 | <tr> | |
565 | <td colspan='3' width='75%'>$Lang::tr{'connection debugging'}:</td> | |
566 | <td width='25%'><input type='checkbox' name='DEBUG' $checked{'DEBUG'}{'on'} /></td> | |
567 | </tr> | |
568 | <tr> | |
569 | <td colspan='4' width='100%'><br></br></td></tr> | |
ac1cfefa | 570 | <tr> |
f2fdd0c1 | 571 | <td colspan='4' width='100%' bgcolor='$color{'color20'}'><b>$Lang::tr{'reconnection'}:</b></td> |
ac1cfefa MT |
572 | </tr> |
573 | <tr> | |
330345c2 | 574 | <td colspan='4' width='100%'><input type='radio' name='RECONNECTION' value='manual' $checked{'RECONNECTION'}{'manual'}>$Lang::tr{'manual'}</td> |
ac1cfefa | 575 | </tr> |
330345c2 MT |
576 | <tr> |
577 | <td colspan='4' width='100%'><input type='radio' name='RECONNECTION' value='dialondemand' $checked{'RECONNECTION'}{'dialondemand'}>$Lang::tr{'dod'}</td> | |
578 | </tr> | |
ac1cfefa MT |
579 | END |
580 | ; | |
581 | if ($pppsettings{'TYPE'} ne 'isdn') { | |
582 | print <<END | |
330345c2 MT |
583 | <tr> |
584 | <td colspan='4' width='100%'><input type='radio' name='RECONNECTION' value='persistent' $checked{'RECONNECTION'}{'persistent'}>$Lang::tr{'persistent'}</td> | |
585 | </tr> | |
586 | <tr> | |
587 | <td colspan='3' width='75%'>$Lang::tr{'backupprofile'}:</td> | |
588 | <td width='25%'><select name='BACKUPPROFILE' style="width: 165px"> | |
ac1cfefa MT |
589 | END |
590 | ; | |
591 | for ($c = 1; $c <= $maxprofiles; $c++) { | |
592 | print "\t<option value='$c' $selected{'BACKUPPROFILE'}{$c}>$c. $profilenames[$c]</option>\n"; | |
593 | } | |
594 | print <<END | |
595 | </select></td> | |
596 | </tr> | |
597 | END | |
598 | ; | |
599 | } | |
600 | print <<END | |
330345c2 MT |
601 | <tr> |
602 | <td colspan='3' width='75%'>$Lang::tr{'dod for dns'}</td> | |
603 | <td width='25%'><input type='checkbox' name='DIALONDEMANDDNS' $checked{'DIALONDEMANDDNS'}{'on'} /></td> | |
604 | </tr> | |
ac1cfefa | 605 | <tr> |
330345c2 MT |
606 | <td colspan='3' width='75%'>$Lang::tr{'holdoff'}:</td> |
607 | <td width='25%'><input type='text' name='HOLDOFF' value='$pppsettings{'HOLDOFF'}' /></td> | |
ac1cfefa MT |
608 | </tr> |
609 | <tr> | |
330345c2 MT |
610 | <td colspan='3' width='75%'>$Lang::tr{'maximum retries'}</td> |
611 | <td width='25%'><input type='text' name='MAXRETRIES' value='$pppsettings{'MAXRETRIES'}' /></td> | |
ac1cfefa MT |
612 | </tr> |
613 | END | |
614 | ; | |
615 | ||
ac1cfefa MT |
616 | if ($pppsettings{'TYPE'} eq 'pptp') |
617 | { | |
618 | print <<END | |
330345c2 | 619 | <tr><td colspan='4' width='100%'><br></br></td></tr> |
ac1cfefa | 620 | <tr> |
f2fdd0c1 | 621 | <td colspan='4' width='100%' bgcolor='$color{'color20'}'><b>$Lang::tr{'pptp settings'}</b></td> |
ac1cfefa MT |
622 | </tr> |
623 | <tr> | |
330345c2 MT |
624 | <td width='25%'>$Lang::tr{'phonebook entry'}</td> |
625 | <td colspan='2' width='50%'></td> | |
626 | <td width='25%'><input type='text' name='PHONEBOOK' value='$pppsettings{'PHONEBOOK'}' /></td> | |
ac1cfefa MT |
627 | </tr> |
628 | <tr> | |
330345c2 MT |
629 | <td width='25%'><input type='radio' name='METHOD' value='STATIC' $checked{'METHOD'}{'STATIC'} />$Lang::tr{'static ip'}</td> |
630 | <td colspan='2' width='50%'>$Lang::tr{'router ip'}</td> | |
631 | <td width='25%'><input type='text' name='ROUTERIP' value='$pppsettings{'ROUTERIP'}' /></td> | |
ac1cfefa MT |
632 | </tr> |
633 | <tr> | |
330345c2 MT |
634 | <td width='25%'><input type='radio' name='METHOD' value='DHCP' $checked{'METHOD'}{'DHCP'} />$Lang::tr{'dhcp mode'}</td> |
635 | <td colspan='2' width='50%'>$Lang::tr{'hostname'}: <img src='/blob.gif' alt='*' /></td> | |
636 | <td width='25%'><input type='text' name='DHCP_HOSTNAME' value='$pppsettings{'DHCP_HOSTNAME'}' /></td> | |
ac1cfefa MT |
637 | </tr> |
638 | END | |
639 | ; | |
640 | } | |
641 | if ($pppsettings{'TYPE'} eq 'pppoe') | |
642 | { | |
643 | print <<END | |
330345c2 | 644 | <tr><td colspan='4' width='100%'><br></br></td></tr> |
ac1cfefa | 645 | <tr> |
f2fdd0c1 | 646 | <td colspan='4' width='100%' bgcolor='$color{'color20'}'><b>$Lang::tr{'pppoe settings'}</b></td> |
ac1cfefa MT |
647 | </tr> |
648 | <tr> | |
330345c2 MT |
649 | <td width='25%'><input type='radio' name='METHOD' value='PPPOE_PLUGIN' $checked{'METHOD'}{'PPPOE_PLUGIN'} />PPPoE plugin</td> |
650 | <td colspan='2' width='50%'>$Lang::tr{'service name'} <img src='/blob.gif' alt='*' /></td> | |
651 | <td width='25%'><input type='text' name='SERVICENAME' value='$pppsettings{'SERVICENAME'}' /></td> | |
ac1cfefa MT |
652 | </tr> |
653 | <tr> | |
330345c2 MT |
654 | <td width='25%'><input type='radio' name='METHOD' value='PPPOE' $checked{'METHOD'}{'PPPOE'} />$Lang::tr{'pppoe'}</td> |
655 | <td colspan='2' width='50%'>$Lang::tr{'concentrator name'} <img src='/blob.gif' alt='*' /></td> | |
656 | <td width='25%'><input type='text' name='CONCENTRATORNAME' value='$pppsettings{'CONCENTRATORNAME'}' /></td> | |
ac1cfefa | 657 | </tr> |
2ed35f39 CS |
658 | <tr> |
659 | <td width='25%'>MTU</td> | |
660 | <td colspan='2' width='50%'></td> | |
661 | <td width='25%'><input type='text' name='MTU' value='$pppsettings{'MTU'}' /></td> | |
662 | </tr> | |
ac1cfefa MT |
663 | END |
664 | ; | |
665 | } | |
666 | ||
ac1cfefa | 667 | print <<END |
330345c2 | 668 | <tr><td colspan='4' width='100%'><br></br></td></tr> |
ac1cfefa | 669 | <tr> |
f2fdd0c1 | 670 | <td bgcolor='$color{'color20'}' colspan='4' width='100%'><b>$Lang::tr{'authentication'}</b></td> |
ac1cfefa MT |
671 | </tr> |
672 | <tr> | |
330345c2 MT |
673 | <td width='25%'>$Lang::tr{'username'}</td> |
674 | <td width='25%'><input type='text' name='USERNAME' value='$pppsettings{'USERNAME'}' /></td> | |
675 | <td width='25%'>$Lang::tr{'password'}</td> | |
676 | <td width='25%'><input type='password' name='PASSWORD' value='$pppsettings{'PASSWORD'}' /></td> | |
ac1cfefa MT |
677 | </tr> |
678 | <tr> | |
330345c2 MT |
679 | <td width='25%'>$Lang::tr{'method'}</td> |
680 | <td width='25%'><select name='AUTH' style="width: 165px"> | |
ac1cfefa MT |
681 | <option value='pap-or-chap' $selected{'AUTH'}{'pap-or-chap'}>$Lang::tr{'pap or chap'}</option> |
682 | <option value='pap' $selected{'AUTH'}{'pap'}>PAP</option> | |
683 | <option value='chap' $selected{'AUTH'}{'chap'}>CHAP</option> | |
684 | END | |
685 | ; | |
686 | if ($pppsettings{'TYPE'} eq 'modem') { | |
687 | print <<END | |
688 | <option value='standard-login-script' $selected{'AUTH'}{'standard-login-script'}>$Lang::tr{'standard login script'}</option> | |
689 | <option value='demon-login-script' $selected{'AUTH'}{'demon-login-script'}>$Lang::tr{'demon login script'}</option> | |
690 | <option value='other-login-script' $selected{'AUTH'}{'other-login-script'}>$Lang::tr{'other login script'}</option> | |
691 | END | |
692 | ; | |
693 | } | |
694 | print <<END | |
695 | </select></td> | |
330345c2 MT |
696 | <td width='25%'>$Lang::tr{'script name'} <img src='/blob.gif' alt='*' /></td> |
697 | <td width='25%'><input type='text' name='LOGINSCRIPT' value='$pppsettings{'LOGINSCRIPT'}' /></td> | |
ac1cfefa | 698 | </tr> |
330345c2 | 699 | <tr><td colspan='4' width='100%'><br></br></td></tr> |
ac1cfefa | 700 | <tr> |
f2fdd0c1 | 701 | <td bgcolor='$color{'color20'}' colspan='4' width='100%'><b>DNS:</b></td> |
ac1cfefa MT |
702 | </tr> |
703 | <tr> | |
330345c2 | 704 | <td colspan='4' width='100%'><input type='radio' name='DNS' value='Automatic' $checked{'DNS'}{'Automatic'} />$Lang::tr{'automatic'}</td> |
ac1cfefa MT |
705 | </tr> |
706 | <tr> | |
330345c2 | 707 | <td colspan='4' width='100%'><input type='radio' name='DNS' value='Manual' $checked{'DNS'}{'Manual'} />$Lang::tr{'manual'}</td> |
ac1cfefa MT |
708 | </tr> |
709 | <tr> | |
330345c2 MT |
710 | <td width='25%'>$Lang::tr{'primary dns'}</td> |
711 | <td width='25%'><input type='text' name='DNS1' value='$pppsettings{'DNS1'}'></td> | |
712 | <td width='25%'>$Lang::tr{'secondary dns'}</td> | |
713 | <td width='25%'><input type='text' name='DNS2' value='$pppsettings{'DNS2'}'></td> | |
ac1cfefa | 714 | </tr> |
330345c2 | 715 | <tr><td colspan='4' width='100%'><br></br><hr></hr><br></br></td></tr> |
ac1cfefa | 716 | <tr> |
330345c2 MT |
717 | <td width='25%'>$Lang::tr{'profile name'}</td> |
718 | <td width='25%'><input type='text' name='PROFILENAME' value='$pppsettings{'PROFILENAME'}'> | |
719 | <td colspan='2' width='50%'></td> | |
ac1cfefa MT |
720 | </tr> |
721 | <tr> | |
330345c2 | 722 | <td align='center' colspan='4' width='100%'><input type='submit' name='ACTION' value='$Lang::tr{'save'}'></td> |
ac1cfefa MT |
723 | </tr> |
724 | <tr> | |
330345c2 MT |
725 | <td colspan='2' width='50%'>$Lang::tr{'legend'}:</td> |
726 | <td colspan='2' width='50%'><img src='/blob.gif' alt='*' /> $Lang::tr{'this field may be blank'}</td> | |
ac1cfefa MT |
727 | </tr> |
728 | </table> | |
729 | END | |
730 | ; | |
731 | &Header::closebox(); | |
732 | } | |
733 | ||
734 | print "</form>\n"; | |
735 | ||
736 | &Header::closebigbox(); | |
737 | ||
738 | &Header::closepage(); | |
739 | ||
740 | sub updatesettings | |
741 | { | |
742 | # make a link from the selected profile to the "default" one. | |
743 | unlink("${General::swroot}/ppp/settings"); | |
744 | link("${General::swroot}/ppp/settings-$pppsettings{'PROFILE'}", | |
745 | "${General::swroot}/ppp/settings"); | |
9833e7d8 | 746 | system ("/usr/bin/touch", "${General::swroot}/ppp/updatesettings"); |
ac1cfefa MT |
747 | } |
748 | ||
749 | sub writesecrets | |
750 | { | |
751 | # write secrets file. | |
752 | open(FILE, ">/${General::swroot}/ppp/secrets") or die "Unable to write secrets file."; | |
753 | flock(FILE, 2); | |
754 | my $username = $pppsettings{'USERNAME'}; | |
755 | my $password = $pppsettings{'PASSWORD'}; | |
756 | print FILE "'$username' * '$password'\n"; | |
757 | chmod 0600, "${General::swroot}/ppp/secrets"; | |
758 | close FILE; | |
759 | } | |
760 | ||
761 | sub initprofile | |
762 | { | |
763 | $pppsettings{'PROFILENAME'} = $Lang::tr{'unnamed'}; | |
764 | $pppsettings{'COMPORT'} = 'ttyS0'; | |
765 | $pppsettings{'DTERATE'} = 115200; | |
766 | $pppsettings{'SPEAKER'} = 'off'; | |
767 | $pppsettings{'RECONNECTION'} = 'manual'; | |
768 | $pppsettings{'DIALONDEMANDDNS'} = 'off'; | |
769 | $pppsettings{'AUTOCONNECT'} = 'off'; | |
770 | $pppsettings{'SENDCR'} = 'off'; | |
771 | $pppsettings{'USEIBOD'} = 'off'; | |
772 | $pppsettings{'USEDOV'} = 'off'; | |
773 | $pppsettings{'MODEM'} = 'PCIST'; | |
774 | $pppsettings{'LINE'} = 'WO'; | |
775 | $pppsettings{'ENCAP'} = '0'; | |
776 | $pppsettings{'PHONEBOOK'} = 'RELAY_PPP1'; | |
777 | $pppsettings{'PROTOCOL'} = 'RFC2364'; | |
778 | $pppsettings{'METHOD'} = 'PPPOE_PLUGIN'; | |
285c5bbd MT |
779 | if ( $pppsettings{'METHOD'} eq 'PPPOE_PLUGIN' ) { |
780 | $pppsettings{'MTU'} = '1492'; | |
781 | $pppsettings{'MRU'} = '1492'; | |
782 | } else { | |
783 | $pppsettings{'MTU'} = '1452'; | |
784 | $pppsettings{'MRU'} = '1452'; | |
f515baeb | 785 | } |
ac1cfefa MT |
786 | $pppsettings{'DIALMODE'} = 'T'; |
787 | $pppsettings{'MAXRETRIES'} = 5; | |
788 | $pppsettings{'HOLDOFF'} = 30; | |
789 | $pppsettings{'TIMEOUT'} = 15; | |
790 | $pppsettings{'MODULATION'} = 'AUTO'; | |
791 | $pppsettings{'AUTH'} = 'pap-or-chap'; | |
792 | $pppsettings{'DNS'} = 'Automatic'; | |
793 | $pppsettings{'DEBUG'} = 'off'; | |
794 | $pppsettings{'BACKUPPROFILE'} = $pppsettings{'PROFILE'}; | |
ac1cfefa MT |
795 | |
796 | # Get PPPoE settings so we can see if PPPoE is enabled or not. | |
797 | &General::readhash("${General::swroot}/ethernet/settings", \%netsettings); | |
798 | ||
799 | # empty profile partial pre-initialization | |
cb5e9c6c | 800 | if ($netsettings{'CONFIG_TYPE'} =~ /^(1|2|3|4)$/) { |
ac1cfefa | 801 | $pppsettings{'TYPE'}=lc($netsettings{'RED_TYPE'}); |
ac1cfefa MT |
802 | } else { |
803 | $pppsettings{'TYPE'}='modem'; | |
804 | } | |
805 | } | |
806 |