1
|
<?php
|
2
|
/* $Id$ */
|
3
|
/*
|
4
|
interfaces_wan.php
|
5
|
Copyright (C) 2004 Scott Ullrich
|
6
|
All rights reserved.
|
7
|
|
8
|
originally part of m0n0wall (http://m0n0.ch/wall)
|
9
|
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
|
10
|
All rights reserved.
|
11
|
|
12
|
Redistribution and use in source and binary forms, with or without
|
13
|
modification, are permitted provided that the following conditions are met:
|
14
|
|
15
|
1. Redistributions of source code must retain the above copyright notice,
|
16
|
this list of conditions and the following disclaimer.
|
17
|
|
18
|
2. Redistributions in binary form must reproduce the above copyright
|
19
|
notice, this list of conditions and the following disclaimer in the
|
20
|
documentation and/or other materials provided with the distribution.
|
21
|
|
22
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
23
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
24
|
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
25
|
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
26
|
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
27
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
28
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
29
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
30
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
31
|
POSSIBILITY OF SUCH DAMAGE.
|
32
|
*/
|
33
|
|
34
|
define("CRON_MONTHLY_PATTERN", "0 0 1 * *");
|
35
|
define("CRON_WEEKLY_PATTERN", "0 0 * * 0");
|
36
|
define("CRON_DAILY_PATTERN", "0 0 * * *");
|
37
|
define("CRON_HOURLY_PATTERN", "0 * * * *");
|
38
|
define("CRON_PPPOE_CMD_FILE", "/etc/pppoerestart");
|
39
|
define("CRON_PPPOE_CMD", "#!/bin/sh\necho '<?php require(\"interfaces.inc\"); interfaces_wan_pppoe_restart(); services_dyndns_reset(); ?>' | /usr/local/bin/php -q");
|
40
|
|
41
|
function getMPDCRONSettings() {
|
42
|
global $config;
|
43
|
|
44
|
if (is_array($config['cron']['item'])) {
|
45
|
for ($i = 0; $i < count($config['cron']['item']); $i++) {
|
46
|
$item =& $config['cron']['item'][$i];
|
47
|
|
48
|
if (strpos($item['command'], CRON_PPPOE_CMD_FILE) !== false) {
|
49
|
return array("ID" => $i, "ITEM" => $item);
|
50
|
}
|
51
|
}
|
52
|
}
|
53
|
|
54
|
return NULL;
|
55
|
}
|
56
|
|
57
|
function getMPDResetTimeFromConfig() {
|
58
|
$itemhash = getMPDCRONSettings();
|
59
|
$cronitem = $itemhash['ITEM'];
|
60
|
|
61
|
if (isset($cronitem)) {
|
62
|
|
63
|
return "{$cronitem['minute']} {$cronitem['hour']} {$cronitem['mday']} {$cronitem['month']} {$cronitem['wday']}";
|
64
|
} else {
|
65
|
return NULL;
|
66
|
}
|
67
|
}
|
68
|
|
69
|
require("guiconfig.inc");
|
70
|
|
71
|
$wancfg = &$config['interfaces']['wan'];
|
72
|
$optcfg = &$config['interfaces']['wan'];
|
73
|
|
74
|
$pconfig['username'] = $config['pppoe']['username'];
|
75
|
$pconfig['password'] = $config['pppoe']['password'];
|
76
|
$pconfig['provider'] = $config['pppoe']['provider'];
|
77
|
$pconfig['pppoe_dialondemand'] = isset($config['pppoe']['ondemand']);
|
78
|
$pconfig['pppoe_idletimeout'] = $config['pppoe']['timeout'];
|
79
|
|
80
|
/* ================================================ */
|
81
|
/* = force a connection reset at a specific time? = */
|
82
|
/* ================================================ */
|
83
|
|
84
|
if (isset($wancfg['pppoe']['pppoe-reset-type'])) {
|
85
|
$resetTime = getMPDResetTimeFromConfig();
|
86
|
$pconfig['pppoe_preset'] = true;
|
87
|
|
88
|
if ($wancfg['pppoe']['pppoe-reset-type'] == "custom") {
|
89
|
$resetTime_a = split(" ", $resetTime);
|
90
|
$pconfig['pppoe_pr_custom'] = true;
|
91
|
$pconfig['pppoe_resetminute'] = $resetTime_a[0];
|
92
|
$pconfig['pppoe_resethour'] = $resetTime_a[1];
|
93
|
|
94
|
/* just initialize $pconfig['pppoe_resetdate'] if the
|
95
|
* coresponding item contains appropriate numeric values.
|
96
|
*/
|
97
|
if ($resetTime_a[2] <> "*" && $resetTime_a[3] <> "*") {
|
98
|
$pconfig['pppoe_resetdate'] = "{$resetTime_a[3]}/{$resetTime_a[2]}/" . date("Y");
|
99
|
}
|
100
|
} else if ($wancfg['pppoe']['pppoe-reset-type'] == "preset") {
|
101
|
$pconfig['pppoe_pr_preset'] = true;
|
102
|
|
103
|
switch ($resetTime) {
|
104
|
case CRON_MONTHLY_PATTERN:
|
105
|
$pconfig['pppoe_monthly'] = true;
|
106
|
break;
|
107
|
case CRON_WEEKLY_PATTERN:
|
108
|
$pconfig['pppoe_weekly'] = true;
|
109
|
break;
|
110
|
case CRON_DAILY_PATTERN:
|
111
|
$pconfig['pppoe_daily'] = true;
|
112
|
break;
|
113
|
case CRON_HOURLY_PATTERN:
|
114
|
$pconfig['pppoe_hourly'] = true;
|
115
|
break;
|
116
|
}
|
117
|
}
|
118
|
}
|
119
|
|
120
|
$pconfig['pptp_username'] = $config['pptp']['username'];
|
121
|
$pconfig['pptp_password'] = $config['pptp']['password'];
|
122
|
$pconfig['pptp_local'] = $config['pptp']['local'];
|
123
|
$pconfig['pptp_subnet'] = $config['pptp']['subnet'];
|
124
|
$pconfig['pptp_remote'] = $config['pptp']['remote'];
|
125
|
$pconfig['pptp_dialondemand'] = isset($config['pptp']['ondemand']);
|
126
|
$pconfig['pptp_idletimeout'] = $config['pptp']['timeout'];
|
127
|
|
128
|
$pconfig['disableftpproxy'] = isset($wancfg['disableftpproxy']);
|
129
|
|
130
|
$pconfig['dhcphostname'] = $wancfg['dhcphostname'];
|
131
|
|
132
|
if ($wancfg['ipaddr'] == "dhcp") {
|
133
|
$pconfig['type'] = "DHCP";
|
134
|
} else if ($wancfg['ipaddr'] == "pppoe") {
|
135
|
$pconfig['type'] = "PPPoE";
|
136
|
} else if ($wancfg['ipaddr'] == "pptp") {
|
137
|
$pconfig['type'] = "PPTP";
|
138
|
} else {
|
139
|
$pconfig['type'] = "Static";
|
140
|
$pconfig['ipaddr'] = $wancfg['ipaddr'];
|
141
|
$pconfig['subnet'] = $wancfg['subnet'];
|
142
|
$pconfig['gateway'] = $config['interfaces']['wan']['gateway'];
|
143
|
$pconfig['pointtopoint'] = $wancfg['pointtopoint'];
|
144
|
}
|
145
|
|
146
|
$pconfig['blockpriv'] = isset($wancfg['blockpriv']);
|
147
|
$pconfig['blockbogons'] = isset($wancfg['blockbogons']);
|
148
|
$pconfig['spoofmac'] = $wancfg['spoofmac'];
|
149
|
$pconfig['mtu'] = $wancfg['mtu'];
|
150
|
|
151
|
/* Wireless interface? */
|
152
|
if (isset($wancfg['wireless'])) {
|
153
|
require("interfaces_wlan.inc");
|
154
|
wireless_config_init();
|
155
|
}
|
156
|
|
157
|
if ($_POST) {
|
158
|
|
159
|
unset($input_errors);
|
160
|
$pconfig = $_POST;
|
161
|
|
162
|
/* okay first of all, cause we are just hidding the PPPoE HTML
|
163
|
* fields releated to PPPoE resets, we are going to unset $_POST
|
164
|
* vars, if the reset feature should not be used. Otherwise the
|
165
|
* data validation procedure below, may trigger a false error
|
166
|
* message.
|
167
|
*/
|
168
|
if (empty($_POST['pppoe_preset'])) {
|
169
|
unset($_POST['pppoe_pr_type']);
|
170
|
unset($_POST['pppoe_resethour']);
|
171
|
unset($_POST['pppoe_resetminute']);
|
172
|
unset($_POST['pppoe_resetdate']);
|
173
|
unset($_POST['pppoe_pr_preset_val']);
|
174
|
unlink_if_exists(CRON_PPPOE_CMD_FILE);
|
175
|
}
|
176
|
|
177
|
if($_POST['gateway'] and $pconfig['gateway'] <> $_POST['gateway']) {
|
178
|
/* enumerate slbd gateways and make sure we are not creating a route loop */
|
179
|
if(is_array($config['load_balancer']['lbpool'])) {
|
180
|
foreach($config['load_balancer']['lbpool'] as $lbpool) {
|
181
|
if($lbpool['type'] == "gateway") {
|
182
|
foreach ((array) $lbpool['servers'] as $server) {
|
183
|
$svr = split("\|", $server);
|
184
|
if($svr[1] == $pconfig['gateway']) {
|
185
|
$_POST['gateway'] = $pconfig['gateway'];
|
186
|
$input_errors[] = "Cannot change {$svr[1]} gateway. It is currently referenced by the load balancer pools.";
|
187
|
}
|
188
|
}
|
189
|
}
|
190
|
}
|
191
|
foreach($config['filter']['rule'] as $rule) {
|
192
|
if($rule['gateway'] == $pconfig['gateway']) {
|
193
|
$_POST['gateway'] = $pconfig['gateway'];
|
194
|
$input_errors[] = "Cannot change {$svr[1]} gateway. It is currently referenced by the filter rules via policy based routing.";
|
195
|
}
|
196
|
}
|
197
|
}
|
198
|
}
|
199
|
|
200
|
/* input validation */
|
201
|
if ($_POST['type'] == "Static") {
|
202
|
$reqdfields = explode(" ", "ipaddr subnet gateway");
|
203
|
$reqdfieldsn = explode(",", "IP address,Subnet bit count,Gateway");
|
204
|
do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
|
205
|
} else if ($_POST['type'] == "PPPoE") {
|
206
|
if ($_POST['pppoe_dialondemand']) {
|
207
|
$reqdfields = explode(" ", "username password pppoe_dialondemand pppoe_idletimeout");
|
208
|
$reqdfieldsn = explode(",", "PPPoE username,PPPoE password,Dial on demand,Idle timeout value");
|
209
|
} else {
|
210
|
$reqdfields = explode(" ", "username password");
|
211
|
$reqdfieldsn = explode(",", "PPPoE username,PPPoE password");
|
212
|
}
|
213
|
do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
|
214
|
} else if ($_POST['type'] == "PPTP") {
|
215
|
if ($_POST['pptp_dialondemand']) {
|
216
|
$reqdfields = explode(" ", "pptp_username pptp_password pptp_local pptp_subnet pptp_remote pptp_dialondemand pptp_idletimeout");
|
217
|
$reqdfieldsn = explode(",", "PPTP username,PPTP password,PPTP local IP address,PPTP subnet,PPTP remote IP address,Dial on demand,Idle timeout value");
|
218
|
} else {
|
219
|
$reqdfields = explode(" ", "pptp_username pptp_password pptp_local pptp_subnet pptp_remote");
|
220
|
$reqdfieldsn = explode(",", "PPTP username,PPTP password,PPTP local IP address,PPTP subnet,PPTP remote IP address");
|
221
|
}
|
222
|
do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
|
223
|
}
|
224
|
|
225
|
/* normalize MAC addresses - lowercase and convert Windows-ized hyphenated MACs to colon delimited */
|
226
|
$_POST['spoofmac'] = strtolower(str_replace("-", ":", $_POST['spoofmac']));
|
227
|
|
228
|
if (($_POST['ipaddr'] && !is_ipaddr($_POST['ipaddr']))) {
|
229
|
$input_errors[] = "A valid IP address must be specified.";
|
230
|
}
|
231
|
if (($_POST['subnet'] && !is_numeric($_POST['subnet']))) {
|
232
|
$input_errors[] = "A valid subnet bit count must be specified.";
|
233
|
}
|
234
|
if (($_POST['gateway'] && !is_ipaddr($_POST['gateway']))) {
|
235
|
$input_errors[] = "A valid gateway must be specified.";
|
236
|
}
|
237
|
if (($_POST['pointtopoint'] && !is_ipaddr($_POST['pointtopoint']))) {
|
238
|
$input_errors[] = "A valid point-to-point IP address must be specified.";
|
239
|
}
|
240
|
if (($_POST['provider'] && !is_domain($_POST['provider']))) {
|
241
|
$input_errors[] = "The service name contains invalid characters.";
|
242
|
}
|
243
|
if (($_POST['pppoe_idletimeout'] != "") && !is_numericint($_POST['pppoe_idletimeout'])) {
|
244
|
$input_errors[] = "The idle timeout value must be an integer.";
|
245
|
}
|
246
|
if ($_POST['pppoe_resethour'] <> "" &&
|
247
|
!is_numericint($_POST['pppoe_resethour']) &&
|
248
|
$_POST['pppoe_resethour'] >= 0 &&
|
249
|
$_POST['pppoe_resethour'] <=23) {
|
250
|
$input_errors[] = gettext("A valid PPPoE reset hour must be specified (0-23).");
|
251
|
}
|
252
|
if ($_POST['pppoe_resetminute'] <> "" &&
|
253
|
!is_numericint($_POST['pppoe_resetminute']) &&
|
254
|
$_POST['pppoe_resetminute'] >= 0 &&
|
255
|
$_POST['pppoe_resetminute'] <=59) {
|
256
|
$input_errors[] = gettext("A valid PPPoE reset minute must be specified (0-59).");
|
257
|
}
|
258
|
if ($_POST['pppoe_resetdate'] <> "" && !is_numeric(str_replace("/", "", $_POST['pppoe_resetdate']))) {
|
259
|
$input_errors[] = gettext("A valid PPPoE reset date must be specified (mm/dd/yyyy).");
|
260
|
}
|
261
|
if (($_POST['pptp_local'] && !is_ipaddr($_POST['pptp_local']))) {
|
262
|
$input_errors[] = "A valid PPTP local IP address must be specified.";
|
263
|
}
|
264
|
if (($_POST['pptp_subnet'] && !is_numeric($_POST['pptp_subnet']))) {
|
265
|
$input_errors[] = "A valid PPTP subnet bit count must be specified.";
|
266
|
}
|
267
|
if (($_POST['pptp_remote'] && !is_ipaddr($_POST['pptp_remote']))) {
|
268
|
$input_errors[] = "A valid PPTP remote IP address must be specified.";
|
269
|
}
|
270
|
if (($_POST['pptp_idletimeout'] != "") && !is_numericint($_POST['pptp_idletimeout'])) {
|
271
|
$input_errors[] = "The idle timeout value must be an integer.";
|
272
|
}
|
273
|
if (($_POST['spoofmac'] && !is_macaddr($_POST['spoofmac']))) {
|
274
|
$input_errors[] = "A valid MAC address must be specified.";
|
275
|
}
|
276
|
if ($_POST['mtu'] && (($_POST['mtu'] < 576) || ($_POST['mtu'] > 1500))) {
|
277
|
$input_errors[] = "The MTU must be between 576 and 1500 bytes.";
|
278
|
}
|
279
|
|
280
|
/* Wireless interface? */
|
281
|
if (isset($wancfg['wireless'])) {
|
282
|
$wi_input_errors = wireless_config_post();
|
283
|
if ($wi_input_errors) {
|
284
|
$input_errors = array_merge($input_errors, $wi_input_errors);
|
285
|
}
|
286
|
}
|
287
|
|
288
|
if (!$input_errors) {
|
289
|
|
290
|
$bridge = discover_bridge($wancfg['if'], filter_translate_type_to_real_interface($wancfg['bridge']));
|
291
|
if($bridge <> "-1") {
|
292
|
destroy_bridge($bridge);
|
293
|
setup_bridge();
|
294
|
}
|
295
|
|
296
|
unset($wancfg['ipaddr']);
|
297
|
unset($wancfg['subnet']);
|
298
|
unset($config['interfaces']['wan']['gateway']);
|
299
|
unset($wancfg['pointtopoint']);
|
300
|
unset($wancfg['dhcphostname']);
|
301
|
if (is_array($wancfg['pppoe'])) {
|
302
|
unset($config['pppoe']['username']);
|
303
|
unset($config['pppoe']['password']);
|
304
|
unset($config['pppoe']['provider']);
|
305
|
unset($config['pppoe']['ondemand']);
|
306
|
unset($config['pppoe']['timeout']);
|
307
|
unset($wancfg['pppoe']['pppoe-reset-type']);
|
308
|
}
|
309
|
if (is_array($wancfg['pptp'])) {
|
310
|
unset($config['pptp']['username']);
|
311
|
unset($config['pptp']['password']);
|
312
|
unset($config['pptp']['local']);
|
313
|
unset($config['pptp']['subnet']);
|
314
|
unset($config['pptp']['remote']);
|
315
|
unset($config['pptp']['ondemand']);
|
316
|
unset($config['pptp']['timeout']);
|
317
|
}
|
318
|
|
319
|
unset($wancfg['disableftpproxy']);
|
320
|
|
321
|
/* per interface pftpx helper */
|
322
|
if($_POST['disableftpproxy'] == "yes") {
|
323
|
$wancfg['disableftpproxy'] = true;
|
324
|
system_start_ftp_helpers();
|
325
|
} else {
|
326
|
system_start_ftp_helpers();
|
327
|
}
|
328
|
|
329
|
if ($_POST['type'] == "Static") {
|
330
|
$wancfg['ipaddr'] = $_POST['ipaddr'];
|
331
|
$wancfg['subnet'] = $_POST['subnet'];
|
332
|
$config['interfaces']['wan']['gateway'] = $_POST['gateway'];
|
333
|
if (isset($wancfg['ispointtopoint']))
|
334
|
$wancfg['pointtopoint'] = $_POST['pointtopoint'];
|
335
|
} else if ($_POST['type'] == "DHCP") {
|
336
|
$wancfg['ipaddr'] = "dhcp";
|
337
|
$wancfg['dhcphostname'] = $_POST['dhcphostname'];
|
338
|
} else if ($_POST['type'] == "PPPoE") {
|
339
|
$wancfg['ipaddr'] = "pppoe";
|
340
|
$config['pppoe']['username'] = $_POST['username'];
|
341
|
$config['pppoe']['password'] = $_POST['password'];
|
342
|
$config['pppoe']['provider'] = $_POST['provider'];
|
343
|
$config['pppoe']['ondemand'] = $_POST['pppoe_dialondemand'] ? true : false;
|
344
|
$config['pppoe']['timeout'] = $_POST['pppoe_idletimeout'];
|
345
|
|
346
|
/* perform a periodic reset? */
|
347
|
if (isset($_POST['pppoe_preset'])) {
|
348
|
if (! is_array($config['cron']['item'])) { $config['cron']['item'] = array(); }
|
349
|
|
350
|
$itemhash = getMPDCRONSettings();
|
351
|
$item = $itemhash['ITEM'];
|
352
|
|
353
|
if (empty($item)) {
|
354
|
$item = array();
|
355
|
}
|
356
|
|
357
|
if (isset($_POST['pppoe_pr_type']) && $_POST['pppoe_pr_type'] == "custom") {
|
358
|
$wancfg['pppoe']['pppoe-reset-type'] = "custom";
|
359
|
$pconfig['pppoe_pr_custom'] = true;
|
360
|
|
361
|
$item['minute'] = $_POST['pppoe_resetminute'];
|
362
|
$item['hour'] = $_POST['pppoe_resethour'];
|
363
|
|
364
|
if (isset($_POST['pppoe_resetdate']) &&
|
365
|
$_POST['pppoe_resetdate'] <> "" &&
|
366
|
strlen($_POST['pppoe_resetdate']) == 10) {
|
367
|
$date = explode("/", $_POST['pppoe_resetdate']);
|
368
|
|
369
|
$item['mday'] = $date[1];
|
370
|
$item['month'] = $date[0];
|
371
|
} else {
|
372
|
$item['mday'] = "*";
|
373
|
$item['month'] = "*";
|
374
|
}
|
375
|
|
376
|
$item['wday'] = "*";
|
377
|
$item['who'] = "root";
|
378
|
$item['command'] = CRON_PPPOE_CMD_FILE;
|
379
|
} else if (isset($_POST['pppoe_pr_type']) && $_POST['pppoe_pr_type'] = "preset") {
|
380
|
$wancfg['pppoe']['pppoe-reset-type'] = "preset";
|
381
|
$pconfig['pppoe_pr_preset'] = true;
|
382
|
|
383
|
switch ($_POST['pppoe_pr_preset_val']) {
|
384
|
case "monthly":
|
385
|
$item['minute'] = "0";
|
386
|
$item['hour'] = "0";
|
387
|
$item['mday'] = "1";
|
388
|
$item['month'] = "*";
|
389
|
$item['wday'] = "*";
|
390
|
$item['who'] = "root";
|
391
|
$item['command'] = CRON_PPPOE_CMD_FILE;
|
392
|
break;
|
393
|
case "weekly":
|
394
|
$item['minute'] = "0";
|
395
|
$item['hour'] = "0";
|
396
|
$item['mday'] = "*";
|
397
|
$item['month'] = "*";
|
398
|
$item['wday'] = "0";
|
399
|
$item['who'] = "root";
|
400
|
$item['command'] = CRON_PPPOE_CMD_FILE;
|
401
|
break;
|
402
|
case "daily":
|
403
|
$item['minute'] = "0";
|
404
|
$item['hour'] = "0";
|
405
|
$item['mday'] = "*";
|
406
|
$item['month'] = "*";
|
407
|
$item['wday'] = "*";
|
408
|
$item['who'] = "root";
|
409
|
$item['command'] = CRON_PPPOE_CMD_FILE;
|
410
|
break;
|
411
|
case "hourly":
|
412
|
$item['minute'] = "0";
|
413
|
$item['hour'] = "*";
|
414
|
$item['mday'] = "*";
|
415
|
$item['month'] = "*";
|
416
|
$item['wday'] = "*";
|
417
|
$item['who'] = "root";
|
418
|
$item['command'] = CRON_PPPOE_CMD_FILE;
|
419
|
break;
|
420
|
} // end switch
|
421
|
} // end if
|
422
|
|
423
|
if (isset($itemhash['ID'])) {
|
424
|
$config['cron']['item'][$itemhash['ID']] = $item;
|
425
|
} else {
|
426
|
$config['cron']['item'][] = $item;
|
427
|
}
|
428
|
} // end if
|
429
|
} else if ($_POST['type'] == "PPTP") {
|
430
|
$wancfg['ipaddr'] = "pptp";
|
431
|
$config['pptp']['username'] = $_POST['pptp_username'];
|
432
|
$config['pptp']['password'] = $_POST['pptp_password'];
|
433
|
$config['pptp']['local'] = $_POST['pptp_local'];
|
434
|
$config['pptp']['subnet'] = $_POST['pptp_subnet'];
|
435
|
$config['pptp']['remote'] = $_POST['pptp_remote'];
|
436
|
$config['pptp']['ondemand'] = $_POST['pptp_dialondemand'] ? true : false;
|
437
|
$config['pptp']['timeout'] = $_POST['pptp_idletimeout'];
|
438
|
}
|
439
|
|
440
|
/* reset cron items if necessary */
|
441
|
if (empty($_POST['pppoe_preset'])) {
|
442
|
/* test whether a cron item exists and unset() it if necessary */
|
443
|
$itemhash = getMPDCRONSettings();
|
444
|
$item = $itemhash['ITEM'];
|
445
|
|
446
|
if (isset($item)) { unset($config['cron']['item'][$itemhash['ID']]); }
|
447
|
}
|
448
|
|
449
|
if($_POST['blockpriv'] == "yes")
|
450
|
$wancfg['blockpriv'] = true;
|
451
|
else
|
452
|
unset($wancfg['blockpriv']);
|
453
|
|
454
|
if($_POST['blockbogons'] == "yes")
|
455
|
$wancfg['blockbogons'] = true;
|
456
|
else
|
457
|
unset($wancfg['blockbogons']);
|
458
|
|
459
|
$wancfg['spoofmac'] = $_POST['spoofmac'];
|
460
|
$wancfg['mtu'] = $_POST['mtu'];
|
461
|
|
462
|
write_config();
|
463
|
|
464
|
/* finally install the pppoerestart file */
|
465
|
if (isset($_POST['pppoe_preset'])) {
|
466
|
config_lock();
|
467
|
conf_mount_rw();
|
468
|
|
469
|
if (! file_exists(CRON_PPPOE_CMD_FILE)) {
|
470
|
file_put_contents(CRON_PPPOE_CMD_FILE, CRON_PPPOE_CMD);
|
471
|
chmod(CRON_PPPOE_CMD_FILE, 0700);
|
472
|
}
|
473
|
|
474
|
/* regenerate cron settings/crontab file */
|
475
|
configure_cron();
|
476
|
sigkillbypid("{$g['varrun_path']}/cron.pid", "HUP");
|
477
|
|
478
|
conf_mount_ro();
|
479
|
config_unlock();
|
480
|
}
|
481
|
|
482
|
|
483
|
$retval = 0;
|
484
|
|
485
|
$savemsg = get_std_save_message($retval);
|
486
|
}
|
487
|
}
|
488
|
|
489
|
$pgtitle = "Interfaces: WAN";
|
490
|
$closehead = false;
|
491
|
include("head.inc");
|
492
|
|
493
|
?>
|
494
|
|
495
|
<script type="text/javascript" src="/javascript/numericupdown/js/numericupdown.js"></script>
|
496
|
<link href="/javascript/numericupdown/css/numericupdown.css" rel="stylesheet" type="text/css" />
|
497
|
|
498
|
<script type="text/javascript" src="/javascript/datepicker/js/datepicker.js"></script>
|
499
|
<link href="/javascript/datepicker/css/datepicker.css" rel="stylesheet" type="text/css" />
|
500
|
|
501
|
<script type="text/javascript" src="/javascript/scriptaculous/prototype.js"></script>
|
502
|
<script type="text/javascript" src="/javascript/scriptaculous/scriptaculous.js"></script>
|
503
|
|
504
|
<script type="text/javascript">
|
505
|
<!--
|
506
|
function enable_change(enable_change) {
|
507
|
if (document.iform.pppoe_dialondemand.checked || enable_change) {
|
508
|
document.iform.pppoe_idletimeout.disabled = 0;
|
509
|
} else {
|
510
|
document.iform.pppoe_idletimeout.disabled = 1;
|
511
|
}
|
512
|
}
|
513
|
|
514
|
function enable_change_pptp(enable_change_pptp) {
|
515
|
if (document.iform.pptp_dialondemand.checked || enable_change_pptp) {
|
516
|
document.iform.pptp_idletimeout.disabled = 0;
|
517
|
document.iform.pptp_local.disabled = 0;
|
518
|
document.iform.pptp_remote.disabled = 0;
|
519
|
} else {
|
520
|
document.iform.pptp_idletimeout.disabled = 1;
|
521
|
}
|
522
|
}
|
523
|
|
524
|
function type_change(enable_change,enable_change_pptp) {
|
525
|
switch (document.iform.type.selectedIndex) {
|
526
|
case 0:
|
527
|
document.iform.username.disabled = 1;
|
528
|
document.iform.password.disabled = 1;
|
529
|
document.iform.provider.disabled = 1;
|
530
|
document.iform.pppoe_dialondemand.disabled = 1;
|
531
|
document.iform.pppoe_idletimeout.disabled = 1;
|
532
|
document.iform.pppoe_preset.disabled = 1;
|
533
|
document.iform.pppoe_preset.checked = 0;
|
534
|
Effect.Fade('presetwrap', { duration: 1.0 });
|
535
|
document.iform.ipaddr.disabled = 0;
|
536
|
document.iform.subnet.disabled = 0;
|
537
|
document.iform.gateway.disabled = 0;
|
538
|
document.iform.pptp_username.disabled = 1;
|
539
|
document.iform.pptp_password.disabled = 1;
|
540
|
document.iform.pptp_local.disabled = 1;
|
541
|
document.iform.pptp_subnet.disabled = 1;
|
542
|
document.iform.pptp_remote.disabled = 1;
|
543
|
document.iform.pptp_dialondemand.disabled = 1;
|
544
|
document.iform.pptp_idletimeout.disabled = 1;
|
545
|
document.iform.dhcphostname.disabled = 1;
|
546
|
break;
|
547
|
case 1:
|
548
|
document.iform.username.disabled = 1;
|
549
|
document.iform.password.disabled = 1;
|
550
|
document.iform.provider.disabled = 1;
|
551
|
document.iform.pppoe_dialondemand.disabled = 1;
|
552
|
document.iform.pppoe_idletimeout.disabled = 1;
|
553
|
document.iform.pppoe_preset.disabled = 1;
|
554
|
document.iform.pppoe_preset.checked = 0;
|
555
|
Effect.Fade('presetwrap', { duration: 1.0 });
|
556
|
document.iform.ipaddr.disabled = 1;
|
557
|
document.iform.subnet.disabled = 1;
|
558
|
document.iform.gateway.disabled = 1;
|
559
|
document.iform.pptp_username.disabled = 1;
|
560
|
document.iform.pptp_password.disabled = 1;
|
561
|
document.iform.pptp_local.disabled = 1;
|
562
|
document.iform.pptp_subnet.disabled = 1;
|
563
|
document.iform.pptp_remote.disabled = 1;
|
564
|
document.iform.pptp_dialondemand.disabled = 1;
|
565
|
document.iform.pptp_idletimeout.disabled = 1;
|
566
|
document.iform.dhcphostname.disabled = 0;
|
567
|
break;
|
568
|
case 2:
|
569
|
document.iform.username.disabled = 0;
|
570
|
document.iform.password.disabled = 0;
|
571
|
document.iform.provider.disabled = 0;
|
572
|
document.iform.pppoe_dialondemand.disabled = 0;
|
573
|
if (document.iform.pppoe_dialondemand.checked || enable_change) {
|
574
|
document.iform.pppoe_idletimeout.disabled = 0;
|
575
|
} else {
|
576
|
document.iform.pppoe_idletimeout.disabled = 1;
|
577
|
}
|
578
|
document.iform.pppoe_preset.disabled = 0;
|
579
|
document.iform.ipaddr.disabled = 1;
|
580
|
document.iform.subnet.disabled = 1;
|
581
|
document.iform.gateway.disabled = 1;
|
582
|
document.iform.pptp_username.disabled = 1;
|
583
|
document.iform.pptp_password.disabled = 1;
|
584
|
document.iform.pptp_local.disabled = 1;
|
585
|
document.iform.pptp_subnet.disabled = 1;
|
586
|
document.iform.pptp_remote.disabled = 1;
|
587
|
document.iform.pptp_dialondemand.disabled = 1;
|
588
|
document.iform.pptp_idletimeout.disabled = 1;
|
589
|
document.iform.dhcphostname.disabled = 1;
|
590
|
break;
|
591
|
case 3:
|
592
|
document.iform.username.disabled = 1;
|
593
|
document.iform.password.disabled = 1;
|
594
|
document.iform.provider.disabled = 1;
|
595
|
document.iform.pppoe_dialondemand.disabled = 1;
|
596
|
document.iform.pppoe_idletimeout.disabled = 1;
|
597
|
document.iform.pppoe_preset.disabled = 1;
|
598
|
document.iform.pppoe_preset.checked = 0;
|
599
|
Effect.Fade('presetwrap', { duration: 1.0 });
|
600
|
document.iform.ipaddr.disabled = 1;
|
601
|
document.iform.subnet.disabled = 1;
|
602
|
document.iform.gateway.disabled = 1;
|
603
|
document.iform.pptp_username.disabled = 0;
|
604
|
document.iform.pptp_password.disabled = 0;
|
605
|
document.iform.pptp_local.disabled = 0;
|
606
|
document.iform.pptp_subnet.disabled = 0;
|
607
|
document.iform.pptp_remote.disabled = 0;
|
608
|
document.iform.pptp_dialondemand.disabled = 0;
|
609
|
if (document.iform.pptp_dialondemand.checked || enable_change_pptp) {
|
610
|
document.iform.pptp_idletimeout.disabled = 0;
|
611
|
} else {
|
612
|
document.iform.pptp_idletimeout.disabled = 1;
|
613
|
}
|
614
|
document.iform.dhcphostname.disabled = 1;
|
615
|
break;
|
616
|
}
|
617
|
}
|
618
|
//-->
|
619
|
</script>
|
620
|
</head>
|
621
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
|
622
|
<?php include("fbegin.inc"); ?>
|
623
|
<p class="pgtitle"><?=$pgtitle?></p>
|
624
|
<?php if ($input_errors) print_input_errors($input_errors); ?>
|
625
|
<?php if ($savemsg) print_info_box($savemsg); ?>
|
626
|
<form action="interfaces_wan.php" method="post" name="iform" id="iform">
|
627
|
<table width="100%" border="0" cellpadding="6" cellspacing="0">
|
628
|
<tr>
|
629
|
<td colspan="2" valign="top" class="listtopic">General configuration</td>
|
630
|
</tr>
|
631
|
<tr>
|
632
|
<td valign="middle" class="vncell"><strong>Type</strong></td>
|
633
|
<td class="vtable"> <select name="type" class="formfld" id="type" onchange="type_change()">
|
634
|
<?php $opts = split(" ", "Static DHCP PPPoE PPTP");
|
635
|
foreach ($opts as $opt): ?>
|
636
|
<option <?php if ($opt == $pconfig['type']) echo "selected";?>>
|
637
|
<?=htmlspecialchars($opt);?>
|
638
|
</option>
|
639
|
<?php endforeach; ?>
|
640
|
</select></td>
|
641
|
</tr>
|
642
|
<tr>
|
643
|
<td valign="top" class="vncell">MAC address</td>
|
644
|
<td class="vtable"> <input name="spoofmac" type="text" class="formfld" id="spoofmac" size="30" value="<?=htmlspecialchars($pconfig['spoofmac']);?>">
|
645
|
<?php
|
646
|
$ip = getenv('REMOTE_ADDR');
|
647
|
$mac = `/usr/sbin/arp -an | grep {$ip} | cut -d" " -f4`;
|
648
|
$mac = str_replace("\n","",$mac);
|
649
|
?>
|
650
|
<a OnClick="document.forms[0].spoofmac.value='<?=$mac?>';" href="#">Copy my MAC address</a>
|
651
|
<br>
|
652
|
This field can be used to modify ("spoof") the MAC
|
653
|
address of the WAN interface<br>
|
654
|
(may be required with some cable connections)<br>
|
655
|
Enter a MAC address in the following format: xx:xx:xx:xx:xx:xx
|
656
|
or leave blank</td>
|
657
|
</tr>
|
658
|
<tr>
|
659
|
<td valign="top" class="vncell">MTU</td>
|
660
|
<td class="vtable"> <input name="mtu" type="text" class="formfld" id="mtu" size="8" value="<?=htmlspecialchars($pconfig['mtu']);?>">
|
661
|
<br>
|
662
|
If you enter a value in this field, then MSS clamping for
|
663
|
TCP connections to the value entered above minus 40 (TCP/IP
|
664
|
header size) will be in effect. If you leave this field blank,
|
665
|
an MTU of 1492 bytes for PPPoE and 1500 bytes for all other
|
666
|
connection types will be assumed.</td>
|
667
|
</tr>
|
668
|
<tr>
|
669
|
<td colspan="2" valign="top" height="16"></td>
|
670
|
</tr>
|
671
|
<tr>
|
672
|
<td colspan="2" valign="top" class="listtopic">Static IP configuration</td>
|
673
|
</tr>
|
674
|
<tr>
|
675
|
<td width="100" valign="top" class="vncellreq">IP address</td>
|
676
|
<td class="vtable"> <input name="ipaddr" type="text" class="formfld" id="ipaddr" size="20" value="<?=htmlspecialchars($pconfig['ipaddr']);?>">
|
677
|
/
|
678
|
<select name="subnet" class="formfld" id="subnet">
|
679
|
<?php
|
680
|
for ($i = 32; $i > 0; $i--) {
|
681
|
if($i <> 31) {
|
682
|
echo "<option value=\"{$i}\" ";
|
683
|
if ($i == $pconfig['subnet']) echo "selected";
|
684
|
echo ">" . $i . "</option>";
|
685
|
}
|
686
|
}
|
687
|
?>
|
688
|
</select></td>
|
689
|
</tr><?php if (isset($wancfg['ispointtopoint'])): ?>
|
690
|
<tr>
|
691
|
<td valign="top" class="vncellreq">Point-to-point IP address </td>
|
692
|
<td class="vtable">
|
693
|
<input name="pointtopoint" type="text" class="formfld" id="pointtopoint" size="20" value="<?=htmlspecialchars($pconfig['pointtopoint']);?>">
|
694
|
</td>
|
695
|
</tr><?php endif; ?>
|
696
|
<tr>
|
697
|
<td valign="top" class="vncellreq">Gateway</td>
|
698
|
<td class="vtable"> <input name="gateway" type="text" class="formfld" id="gateway" size="20" value="<?=htmlspecialchars($pconfig['gateway']);?>">
|
699
|
</td>
|
700
|
</tr>
|
701
|
<tr>
|
702
|
<td colspan="2" valign="top" height="16"></td>
|
703
|
</tr>
|
704
|
<tr>
|
705
|
<td colspan="2" valign="top" class="listtopic">DHCP client configuration</td>
|
706
|
</tr>
|
707
|
<tr>
|
708
|
<td valign="top" class="vncell">Hostname</td>
|
709
|
<td class="vtable"> <input name="dhcphostname" type="text" class="formfld" id="dhcphostname" size="40" value="<?=htmlspecialchars($pconfig['dhcphostname']);?>">
|
710
|
<br>
|
711
|
The value in this field is sent as the DHCP client identifier
|
712
|
and hostname when requesting a DHCP lease. Some ISPs may require
|
713
|
this (for client identification).</td>
|
714
|
</tr>
|
715
|
<tr>
|
716
|
<td colspan="2" valign="top" height="16"></td>
|
717
|
</tr>
|
718
|
<tr>
|
719
|
<td colspan="2" valign="top" class="listtopic">PPPoE configuration</td>
|
720
|
</tr>
|
721
|
<tr>
|
722
|
<td valign="top" class="vncellreq">Username</td>
|
723
|
<td class="vtable"><input name="username" type="text" class="formfld" id="username" size="20" value="<?=htmlspecialchars($pconfig['username']);?>">
|
724
|
</td>
|
725
|
</tr>
|
726
|
<tr>
|
727
|
<td valign="top" class="vncellreq">Password</td>
|
728
|
<td class="vtable"><input name="password" type="password" class="formfld" id="password" size="20" value="<?=htmlspecialchars($pconfig['password']);?>">
|
729
|
</td>
|
730
|
</tr>
|
731
|
<tr>
|
732
|
<td valign="top" class="vncell">Service name</td>
|
733
|
<td class="vtable"><input name="provider" type="text" class="formfld" id="provider" size="20" value="<?=htmlspecialchars($pconfig['provider']);?>">
|
734
|
<br> <span class="vexpl">Hint: this field can usually be left
|
735
|
empty</span></td>
|
736
|
</tr>
|
737
|
<tr>
|
738
|
<td valign="top" class="vncell">Dial on demand</td>
|
739
|
<td class="vtable"><input name="pppoe_dialondemand" type="checkbox" id="pppoe_dialondemand" value="enable" <?php if ($pconfig['pppoe_dialondemand']) echo "checked"; ?> onClick="enable_change(false)" >
|
740
|
<strong>Enable Dial-On-Demand mode</strong><br>
|
741
|
This option causes the interface to operate in dial-on-demand mode, allowing you to have a <i>virtual full time</i> connection. The interface is configured, but the actual connection of the link is delayed until qualifying outgoing traffic is detected.</td>
|
742
|
</tr>
|
743
|
<tr>
|
744
|
<td valign="top" class="vncell">Idle timeout</td>
|
745
|
<td class="vtable">
|
746
|
<input name="pppoe_idletimeout" type="text" class="formfld" id="pppoe_idletimeout" size="8" value="<?=htmlspecialchars($pconfig['pppoe_idletimeout']);?>"> seconds<br>If no qualifying outgoing packets are transmitted for the specified number of seconds, the connection is brought down. An idle timeout of zero disables this feature.</td>
|
747
|
</tr>
|
748
|
<tr>
|
749
|
<td valign="top" class="vncell"><?=gettext("Periodic reset");?></td>
|
750
|
<td class="vtable">
|
751
|
<input name="pppoe_preset" type="checkbox" id="pppoe_preset" value="yes" <?php if ($pconfig['pppoe_preset']) echo "checked=\"checked\""; ?> onclick="Effect.toggle('presetwrap', 'appear', { duration: 1.0 });" />
|
752
|
<?= gettext("enable periodic PPPoE resets"); ?>
|
753
|
<br />
|
754
|
<?php if ($pconfig['pppoe_preset']): ?>
|
755
|
<table id="presetwrap" cellspacing="0" cellpadding="0" width="100%">
|
756
|
<?php else: ?>
|
757
|
<table id="presetwrap" cellspacing="0" cellpadding="0" width="100%" style="display: none;">
|
758
|
<?php endif; ?>
|
759
|
<tr>
|
760
|
<td align="left" valign="top">
|
761
|
<p style="margin: 4px; padding: 4px 0 4px 0; width: 94%;">
|
762
|
<input name="pppoe_pr_type" type="radio" id="pppoe_pr_custom" value="custom" <?php if ($pconfig['pppoe_pr_custom']) echo "checked=\"checked\""; ?> onclick="if (this.checked) { Effect.Appear('pppoecustomwrap', { duration: 1.0 }); Effect.Fade('pppoepresetwrap', { duration: 1.0 }); }" />
|
763
|
<?= gettext("provide a custom reset time"); ?>
|
764
|
<br />
|
765
|
<input name="pppoe_pr_type" type="radio" id="pppoe_pr_preset" value="preset" <?php if ($pconfig['pppoe_pr_preset']) echo "checked=\"checked\""; ?> onclick="if (this.checked) { Effect.Appear('pppoepresetwrap', { duration: 1.0 }); Effect.Fade('pppoecustomwrap', { duration: 1.0 }); }" />
|
766
|
<?= gettext("select reset time from a preset"); ?>
|
767
|
</p>
|
768
|
<?php if ($pconfig['pppoe_pr_custom']): ?>
|
769
|
<p style="margin: 2px; padding: 4px; width: 94%;" id="pppoecustomwrap">
|
770
|
<?php else: ?>
|
771
|
<p style="margin: 2px; padding: 4px; width: 94%; display: none;" id="pppoecustomwrap">
|
772
|
<?php endif; ?>
|
773
|
<input type="text" name="pppoe_resethour" class="fd_incremental_inp_range_0_23 fd_increment_1 fd_classname_dec_buttonDec fd_classname_inc_buttonInc" maxlength="2" id="pppoe_resethour" value="<?= $pconfig['pppoe_resethour']; ?>" size="3" />
|
774
|
<?= gettext("hour (0-23)"); ?><br />
|
775
|
<input type="text" name="pppoe_resetminute" class="fd_incremental_inp_range_0_59 fd_increment_1 fd_classname_dec_buttonDec fd_classname_inc_buttonInc" maxlength="2" id="pppoe_resetminute" value="<?= $pconfig['pppoe_resetminute']; ?>" size="3" />
|
776
|
<?= gettext("minute (0-59)"); ?><br />
|
777
|
<input name="pppoe_resetdate" type="text" class="w8em format-m-d-y highlight-days-67" id="pppoe_resetdate" maxlength="10" size="10" value="<?=htmlspecialchars($pconfig['pppoe_resetdate']);?>" />
|
778
|
<?= gettext("reset at a specific date (mm/dd/yyyy)"); ?>
|
779
|
<br /> <br />
|
780
|
<span class="red"><strong>Note: </strong></span>
|
781
|
If you leave the date field empty, the reset will be executed each day at the time you did specify using the minutes and hour field.
|
782
|
</p>
|
783
|
<?php if ($pconfig['pppoe_pr_preset']): ?>
|
784
|
<p style="margin: 2px; padding: 4px; width: 94%;" id="pppoepresetwrap">
|
785
|
<?php else: ?>
|
786
|
<p style="margin: 2px; padding: 4px; width: 94%; display: none;" id="pppoepresetwrap">
|
787
|
<?php endif; ?>
|
788
|
<input name="pppoe_pr_preset_val" type="radio" id="pppoe_monthly" value="monthly" <?php if ($pconfig['pppoe_monthly']) echo "checked=\"checked\""; ?> />
|
789
|
<?= gettext("reset at each month ('0 0 1 * *')"); ?>
|
790
|
<br />
|
791
|
<input name="pppoe_pr_preset_val" type="radio" id="pppoe_weekly" value="weekly" <?php if ($pconfig['pppoe_weekly']) echo "checked=\"checked\""; ?> />
|
792
|
<?= gettext("reset at each week ('0 0 * * 0')"); ?>
|
793
|
<br />
|
794
|
<input name="pppoe_pr_preset_val" type="radio" id="pppoe_daily" value="daily" <?php if ($pconfig['pppoe_daily']) echo "checked=\"checked\""; ?> />
|
795
|
<?= gettext("reset at each day ('0 0 * * *')"); ?>
|
796
|
<br />
|
797
|
<input name="pppoe_pr_preset_val" type="radio" id="pppoe_hourly" value="hourly" <?php if ($pconfig['pppoe_hourly']) echo "checked=\"checked\""; ?> />
|
798
|
<?= gettext("reset at each hour ('0 * * * *')"); ?>
|
799
|
</p>
|
800
|
</td>
|
801
|
</tr>
|
802
|
</table>
|
803
|
</td>
|
804
|
</tr>
|
805
|
<tr>
|
806
|
<td colspan="2" valign="top" height="16"></td>
|
807
|
</tr>
|
808
|
<tr>
|
809
|
<td colspan="2" valign="top" class="listtopic">PPTP configuration</td>
|
810
|
</tr>
|
811
|
<tr>
|
812
|
<td valign="top" class="vncellreq">Username</td>
|
813
|
<td class="vtable"><input name="pptp_username" type="text" class="formfld" id="pptp_username" size="20" value="<?=htmlspecialchars($pconfig['pptp_username']);?>">
|
814
|
</td>
|
815
|
</tr>
|
816
|
<tr>
|
817
|
<td valign="top" class="vncellreq">Password</td>
|
818
|
<td class="vtable"><input name="pptp_password" type="text" class="formfld" id="pptp_password" size="20" value="<?=htmlspecialchars($pconfig['pptp_password']);?>">
|
819
|
</td>
|
820
|
</tr>
|
821
|
<tr>
|
822
|
<td width="100" valign="top" class="vncellreq">Local IP address</td>
|
823
|
<td class="vtable"> <input name="pptp_local" type="text" class="formfld" id="pptp_local" size="20" value="<?=htmlspecialchars($pconfig['pptp_local']);?>">
|
824
|
/
|
825
|
<select name="pptp_subnet" class="formfld" id="pptp_subnet">
|
826
|
<?php for ($i = 31; $i > 0; $i--): ?>
|
827
|
<option value="<?=$i;?>" <?php if ($i == $pconfig['pptp_subnet']) echo "selected"; ?>>
|
828
|
<?=$i;?>
|
829
|
</option>
|
830
|
<?php endfor; ?>
|
831
|
</select></td>
|
832
|
</tr>
|
833
|
<tr>
|
834
|
<td width="100" valign="top" class="vncellreq">Remote IP address</td>
|
835
|
<td class="vtable"> <input name="pptp_remote" type="text" class="formfld" id="pptp_remote" size="20" value="<?=htmlspecialchars($pconfig['pptp_remote']);?>">
|
836
|
</td>
|
837
|
</tr>
|
838
|
<tr>
|
839
|
<td valign="top" class="vncell">Dial on demand</td>
|
840
|
<td class="vtable"><input name="pptp_dialondemand" type="checkbox" id="pptp_dialondemand" value="enable" <?php if ($pconfig['pptp_dialondemand']) echo "checked"; ?> onClick="enable_change_pptp(false)" >
|
841
|
<strong>Enable Dial-On-Demand mode</strong><br>
|
842
|
This option causes the interface to operate in dial-on-demand mode, allowing you to have a <i>virtual full time</i> connection. The interface is configured, but the actual connection of the link is delayed until qualifying outgoing traffic is detected.</td>
|
843
|
</tr>
|
844
|
<tr>
|
845
|
<td valign="top" class="vncell">Idle timeout</td>
|
846
|
<td class="vtable">
|
847
|
<input name="pptp_idletimeout" type="text" class="formfld" id="pptp_idletimeout" size="8" value="<?=htmlspecialchars($pconfig['pptp_idletimeout']);?>"> seconds<br>If no qualifying outgoing packets are transmitted for the specified number of seconds, the connection is brought down. An idle timeout of zero disables this feature.</td>
|
848
|
</tr>
|
849
|
<tr>
|
850
|
<td colspan="2" valign="top" height="16"></td>
|
851
|
</tr>
|
852
|
<tr>
|
853
|
<td colspan="2" valign="top" class="listtopic">FTP Helper</td>
|
854
|
</tr>
|
855
|
<tr>
|
856
|
<td width="22%" valign="top" class="vncell">FTP Helper</td>
|
857
|
<td width="78%" class="vtable">
|
858
|
<input name="disableftpproxy" type="checkbox" id="disableftpproxy" value="yes" <?php if ($pconfig['disableftpproxy']) echo "checked"; ?> onclick="enable_change(false)" />
|
859
|
<strong>Disable the userland FTP-Proxy application</strong>
|
860
|
<br />
|
861
|
</td>
|
862
|
</tr>
|
863
|
<?php
|
864
|
/* Wireless interface? */
|
865
|
if (isset($wancfg['wireless']))
|
866
|
wireless_config_print();
|
867
|
?>
|
868
|
<tr>
|
869
|
<td height="16" colspan="2" valign="top"></td>
|
870
|
</tr>
|
871
|
<tr>
|
872
|
<td valign="middle"> </td>
|
873
|
<td class="vtable"><a name="rfc1918"></a> <input name="blockpriv" type="checkbox" id="blockpriv" value="yes" <?php if ($pconfig['blockpriv']) echo "checked"; ?>>
|
874
|
<strong>Block private networks</strong><br>
|
875
|
When set, this option blocks traffic from IP addresses that
|
876
|
are reserved for private<br>
|
877
|
networks as per RFC 1918 (10/8, 172.16/12, 192.168/16) as
|
878
|
well as loopback addresses<br>
|
879
|
(127/8). You should generally leave this option turned on,
|
880
|
unless your WAN network<br>
|
881
|
lies in such a private address space, too.</td>
|
882
|
</tr>
|
883
|
<tr>
|
884
|
<td valign="middle"> </td>
|
885
|
<td class="vtable"> <input name="blockbogons" type="checkbox" id="blockbogons" value="yes" <?php if ($pconfig['blockbogons']) echo "checked"; ?>>
|
886
|
<strong>Block bogon networks</strong><br>
|
887
|
When set, this option blocks traffic from IP addresses that
|
888
|
are reserved (but not RFC 1918) or not yet assigned by IANA.<br>
|
889
|
Bogons are prefixes that should never appear in the Internet routing table, and obviously should not appear as the source address in any packets you receive.</td>
|
890
|
</tr>
|
891
|
<tr>
|
892
|
<td width="100" valign="top"> </td>
|
893
|
<td> <br> <input name="Submit" type="submit" class="formbtn" value="Save" onClick="enable_change_pptp(true)&&enable_change(true)">
|
894
|
</td>
|
895
|
</tr>
|
896
|
</table>
|
897
|
</form>
|
898
|
<script language="JavaScript">
|
899
|
<!--
|
900
|
type_change();
|
901
|
//-->
|
902
|
</script>
|
903
|
<?php include("fend.inc"); ?>
|
904
|
</body>
|
905
|
</html>
|
906
|
|
907
|
|
908
|
<?php
|
909
|
|
910
|
if ($_POST) {
|
911
|
|
912
|
if (!$input_errors) {
|
913
|
|
914
|
unlink_if_exists("{$g['tmp_path']}/config.cache");
|
915
|
|
916
|
ob_flush();
|
917
|
flush();
|
918
|
sleep(1);
|
919
|
|
920
|
interfaces_wan_configure();
|
921
|
|
922
|
reset_carp();
|
923
|
|
924
|
/* sync filter configuration */
|
925
|
filter_configure();
|
926
|
|
927
|
/* set up static routes */
|
928
|
system_routing_configure();
|
929
|
|
930
|
}
|
931
|
}
|
932
|
|
933
|
?>
|