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