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