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