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