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