Project

General

Profile

Download (47.6 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/* $Id$ */
3
/*
4
	interfaces_wan.php
5
        Copyright (C) 2007 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['bigpond_username'] = $config['bigpond']['username'];
131
$pconfig['bigpond_password'] = $config['bigpond']['password'];
132
$pconfig['bigpond_authserver'] = $config['bigpond']['authserver'];
133
$pconfig['bigpond_authdomain'] = $config['bigpond']['authdomain'];
134
$pconfig['bigpond_minheartbeatinterval'] = $config['bigpond']['minheartbeatinterval'];
135

    
136
$pconfig['dhcphostname'] = $wancfg['dhcphostname'];
137
$pconfig['use_rrd_gateway'] = $wancfg['use_rrd_gateway'];
138

    
139
if ($wancfg['ipaddr'] == "dhcp") {
140
	$pconfig['type'] = "DHCP";
141
} else if ($wancfg['ipaddr'] == "pppoe") {
142
	$pconfig['type'] = "PPPoE";
143
} else if ($wancfg['ipaddr'] == "pptp") {
144
	$pconfig['type'] = "PPTP";
145
} else if ($wancfg['ipaddr'] == "bigpond") {
146
	$pconfig['type'] = "BigPond";
147
} else {
148
	$pconfig['type'] = "Static";
149
	$pconfig['ipaddr'] = $wancfg['ipaddr'];
150
	$pconfig['subnet'] = $wancfg['subnet'];
151
	$pconfig['gateway'] = $config['interfaces']['wan']['gateway'];
152
	$pconfig['pointtopoint'] = $wancfg['pointtopoint'];
153
}
154

    
155
$pconfig['blockpriv'] = isset($wancfg['blockpriv']);
156
$pconfig['blockbogons'] = isset($wancfg['blockbogons']);
157
$pconfig['spoofmac'] = $wancfg['spoofmac'];
158
$pconfig['mtu'] = $wancfg['mtu'];
159

    
160
/* Wireless interface? */
161
if (isset($wancfg['wireless'])) {
162
	require("interfaces_wlan.inc");
163
	wireless_config_init();
164
}
165

    
166
if ($_POST) {
167

    
168
	unset($input_errors);
169
	$pconfig = $_POST;
170
  
171
	/* okay first of all, cause we are just hidding the PPPoE HTML
172
	 * fields releated to PPPoE resets, we are going to unset $_POST
173
	 * vars, if the reset feature should not be used. Otherwise the
174
	 * data validation procedure below, may trigger a false error
175
	 * message.
176
	 */
177
	if (empty($_POST['pppoe_preset'])) {
178
		unset($_POST['pppoe_pr_type']);
179
		unset($_POST['pppoe_resethour']);
180
		unset($_POST['pppoe_resetminute']);
181
		unset($_POST['pppoe_resetdate']);
182
		unset($_POST['pppoe_pr_preset_val']);
183
		unlink_if_exists(CRON_PPPOE_CMD_FILE);
184
	}
185

    
186
	if($_POST['gateway'] and $pconfig['gateway'] <> $_POST['gateway']) {
187
		/* enumerate slbd gateways and make sure we are not creating a route loop */
188
		if(is_array($config['load_balancer']['lbpool'])) {
189
			foreach($config['load_balancer']['lbpool'] as $lbpool) {
190
				if($lbpool['type'] == "gateway") {
191
				    foreach ((array) $lbpool['servers'] as $server) {
192
			            $svr = split("\|", $server);
193
			            if($svr[1] == $pconfig['gateway'])  {
194
			            		$_POST['gateway']  = $pconfig['gateway'];
195
			            		$input_errors[] = "Cannot change {$svr[1]} gateway.  It is currently referenced by the load balancer pools.";
196
			            }
197
					}
198
				}
199
			}
200
			foreach($config['filter']['rule'] as $rule) {
201
				if($rule['gateway'] == $pconfig['gateway']) {
202
	            		$_POST['gateway']  = $pconfig['gateway'];
203
	            		$input_errors[] = "Cannot change {$svr[1]} gateway.  It is currently referenced by the filter rules via policy based routing.";
204
				}
205
			}
206
		}
207
	}
208

    
209
	/* input validation */
210
	if ($_POST['type'] == "Static") {
211
		$reqdfields = explode(" ", "ipaddr subnet gateway");
212
		$reqdfieldsn = explode(",", "IP address,Subnet bit count,Gateway");
213
		do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
214
	} else if ($_POST['type'] == "PPPoE") {
215
		if ($_POST['pppoe_dialondemand']) {
216
			$reqdfields = explode(" ", "username password pppoe_dialondemand pppoe_idletimeout");
217
			$reqdfieldsn = explode(",", "PPPoE username,PPPoE password,Dial on demand,Idle timeout value");
218
		} else {
219
			$reqdfields = explode(" ", "username password");
220
			$reqdfieldsn = explode(",", "PPPoE username,PPPoE password");
221
		}
222
		do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
223
	} else if ($_POST['type'] == "PPTP") {
224
		if ($_POST['pptp_dialondemand']) {
225
			$reqdfields = explode(" ", "pptp_username pptp_password pptp_local pptp_subnet pptp_remote pptp_dialondemand pptp_idletimeout");
226
			$reqdfieldsn = explode(",", "PPTP username,PPTP password,PPTP local IP address,PPTP subnet,PPTP remote IP address,Dial on demand,Idle timeout value");
227
		} else {
228
			$reqdfields = explode(" ", "pptp_username pptp_password pptp_local pptp_subnet pptp_remote");
229
			$reqdfieldsn = explode(",", "PPTP username,PPTP password,PPTP local IP address,PPTP subnet,PPTP remote IP address");
230
		}
231
		do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
232
	} else if ($_POST['type'] == "BigPond") {
233
		$reqdfields = explode(" ", "bigpond_username bigpond_password");
234
		$reqdfieldsn = explode(",", "BigPond username,BigPond password");
235
		do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
236
	}
237

    
238
        /* normalize MAC addresses - lowercase and convert Windows-ized hyphenated MACs to colon delimited */
239
        $_POST['spoofmac'] = strtolower(str_replace("-", ":", $_POST['spoofmac']));
240

    
241
	if (($_POST['ipaddr'] && !is_ipaddr($_POST['ipaddr']))) {
242
		$input_errors[] = "A valid IP address must be specified.";
243
	}
244
	if (($_POST['subnet'] && !is_numeric($_POST['subnet']))) {
245
		$input_errors[] = "A valid subnet bit count must be specified.";
246
	}
247
	if (($_POST['gateway'] && !is_ipaddr($_POST['gateway']))) {
248
		$input_errors[] = "A valid gateway must be specified.";
249
	}
250
	if (($_POST['pointtopoint'] && !is_ipaddr($_POST['pointtopoint']))) {
251
		$input_errors[] = "A valid point-to-point IP address must be specified.";
252
	}
253
	if (($_POST['provider'] && !is_domain($_POST['provider']))) {
254
		$input_errors[] = "The service name contains invalid characters.";
255
	}
256
	if (($_POST['pppoe_idletimeout'] != "") && !is_numericint($_POST['pppoe_idletimeout'])) {
257
		$input_errors[] = "The idle timeout value must be an integer.";
258
	}
259
	if (($_POST['use_rrd_gateway'] && !is_ipaddr($_POST['use_rrd_gateway']))) {
260
		$input_errors[] = "A valid monitor IP address must be specified.";
261
	}
262
	if ($_POST['pppoe_resethour'] <> "" && !is_numericint($_POST['pppoe_resethour']) && 
263
		$_POST['pppoe_resethour'] >= 0 && $_POST['pppoe_resethour'] <=23) {
264
		$input_errors[] = gettext("A valid PPPoE reset hour must be specified (0-23).");
265
	}
266
	if ($_POST['pppoe_resetminute'] <> "" && !is_numericint($_POST['pppoe_resetminute']) && 
267
		$_POST['pppoe_resetminute'] >= 0 && $_POST['pppoe_resetminute'] <=59) {
268
		$input_errors[] = gettext("A valid PPPoE reset minute must be specified (0-59).");
269
	}
270
	if ($_POST['pppoe_resetdate'] <> "" && !is_numeric(str_replace("/", "", $_POST['pppoe_resetdate']))) {
271
		$input_errors[] = gettext("A valid PPPoE reset date must be specified (mm/dd/yyyy).");
272
	}
273
	if (($_POST['pptp_local'] && !is_ipaddr($_POST['pptp_local']))) {
274
		$input_errors[] = "A valid PPTP local IP address must be specified.";
275
	}
276
	if (($_POST['pptp_subnet'] && !is_numeric($_POST['pptp_subnet']))) {
277
		$input_errors[] = "A valid PPTP subnet bit count must be specified.";
278
	}
279
	if (($_POST['pptp_remote'] && !is_ipaddr($_POST['pptp_remote']))) {
280
		$input_errors[] = "A valid PPTP remote IP address must be specified.";
281
	}
282
	if (($_POST['pptp_idletimeout'] != "") && !is_numericint($_POST['pptp_idletimeout'])) {
283
		$input_errors[] = "The idle timeout value must be an integer.";
284
	}
285
	if (($_POST['bigpond_authserver'] && !is_domain($_POST['bigpond_authserver']))) {
286
		$input_errors[] = "The authentication server name contains invalid characters.";
287
	}
288
	if (($_POST['bigpond_authdomain'] && !is_domain($_POST['bigpond_authdomain']))) {
289
		$input_errors[] = "The authentication domain name contains invalid characters.";
290
	}
291
	if ($_POST['bigpond_minheartbeatinterval'] && !is_numericint($_POST['bigpond_minheartbeatinterval'])) {
292
		$input_errors[] = "The minimum heartbeat interval must be an integer.";
293
	}
294
	if (($_POST['spoofmac'] && !is_macaddr($_POST['spoofmac']))) {
295
		$input_errors[] = "A valid MAC address must be specified.";
296
	}
297
	if ($_POST['mtu'] && (($_POST['mtu'] < 576) || ($_POST['mtu'] > 1500))) {
298
		$input_errors[] = "The MTU must be between 576 and 1500 bytes.";
299
	}
300

    
301
	/* Wireless interface? */
302
	if (isset($wancfg['wireless'])) {
303
		$wi_input_errors = wireless_config_post();
304
		if ($wi_input_errors) {
305
			$input_errors = array_merge($input_errors, $wi_input_errors);
306
		}
307
	}
308

    
309
	if (!$input_errors) {
310

    
311
		$bridge = discover_bridge($wancfg['if'], filter_translate_type_to_real_interface($wancfg['bridge']));
312
		if($bridge <> "-1") {
313
			destroy_bridge($bridge);
314
		}
315

    
316
		unset($wancfg['ipaddr']);
317
		unset($wancfg['subnet']);
318
		unset($config['interfaces']['wan']['gateway']);
319
		unset($wancfg['pointtopoint']);
320
		unset($wancfg['dhcphostname']);
321
		if (is_array($wancfg['pppoe'])) {
322
			unset($config['pppoe']['username']);
323
			unset($config['pppoe']['password']);
324
			unset($config['pppoe']['provider']);
325
			unset($config['pppoe']['ondemand']);
326
			unset($config['pppoe']['timeout']);
327
			unset($wancfg['pppoe']['pppoe-reset-type']);
328
		}
329
		if (is_array($wancfg['pptp'])) {
330
			unset($config['pptp']['username']);
331
			unset($config['pptp']['password']);
332
			unset($config['pptp']['local']);
333
			unset($config['pptp']['subnet']);
334
			unset($config['pptp']['remote']);
335
			unset($config['pptp']['ondemand']);
336
			unset($config['pptp']['timeout']);
337
		}
338
		unset($config['bigpond']['username']);
339
		unset($config['bigpond']['password']);
340
		unset($config['bigpond']['authserver']);
341
		unset($config['bigpond']['authdomain']);
342
		unset($config['bigpond']['minheartbeatinterval']);
343
		unset($wancfg['disableftpproxy']);
344

    
345
		/* per interface pftpx helper */
346
		if($_POST['disableftpproxy'] == "yes") {
347
			$wancfg['disableftpproxy'] = true;
348
			system_start_ftp_helpers();
349
		} else {
350
			system_start_ftp_helpers();
351
		}
352

    
353
		/* per interface rrd gateway monitor helper */
354
		if($_POST['use_rrd_gateway'] <> "") {
355
			$wancfg['use_rrd_gateway'] = $_POST['use_rrd_gateway'];
356
		}
357

    
358
		if ($_POST['type'] == "Static") {
359
			$wancfg['ipaddr'] = $_POST['ipaddr'];
360
			$wancfg['subnet'] = $_POST['subnet'];
361
			$config['interfaces']['wan']['gateway'] = $_POST['gateway'];
362
			if (isset($wancfg['ispointtopoint']))
363
				$wancfg['pointtopoint'] = $_POST['pointtopoint'];
364
		} else if ($_POST['type'] == "DHCP") {
365
			$wancfg['ipaddr'] = "dhcp";
366
			$wancfg['dhcphostname'] = $_POST['dhcphostname'];
367
		} else if ($_POST['type'] == "PPPoE") {
368
			$wancfg['ipaddr'] = "pppoe";
369
			$config['pppoe']['username'] = $_POST['username'];
370
			$config['pppoe']['password'] = $_POST['password'];
371
			$config['pppoe']['provider'] = $_POST['provider'];
372
			$config['pppoe']['ondemand'] = $_POST['pppoe_dialondemand'] ? true : false;
373
			$config['pppoe']['timeout'] = $_POST['pppoe_idletimeout'];
374
      
375
			/* perform a periodic reset? */
376
			if (isset($_POST['pppoe_preset'])) {
377
				if (! is_array($config['cron']['item'])) { $config['cron']['item'] = array(); }
378

    
379
					$itemhash = getMPDCRONSettings();
380
					$item = $itemhash['ITEM'];
381

    
382
					if (empty($item)) {
383
						$item = array();
384
					}
385

    
386
					if (isset($_POST['pppoe_pr_type']) && $_POST['pppoe_pr_type'] == "custom") {
387
						$wancfg['pppoe']['pppoe-reset-type'] = "custom";
388
						$pconfig['pppoe_pr_custom'] = true;
389

    
390
						$item['minute'] = $_POST['pppoe_resetminute'];
391
						$item['hour'] = $_POST['pppoe_resethour'];
392

    
393
						if (isset($_POST['pppoe_resetdate']) && 
394
							$_POST['pppoe_resetdate'] <> "" && 
395
							strlen($_POST['pppoe_resetdate']) == 10) {
396
							$date = explode("/", $_POST['pppoe_resetdate']);
397
							$item['mday'] = $date[1];
398
							$item['month'] = $date[0];
399
						} else {
400
							$item['mday'] = "*";
401
							$item['month'] = "*";
402
						}
403
						$item['wday'] = "*";
404
						$item['who'] = "root";
405
						$item['command'] = CRON_PPPOE_CMD_FILE;
406
					} else if (isset($_POST['pppoe_pr_type']) && $_POST['pppoe_pr_type'] = "preset") {
407
						$wancfg['pppoe']['pppoe-reset-type'] = "preset";
408
						$pconfig['pppoe_pr_preset'] = true;
409

    
410
						switch ($_POST['pppoe_pr_preset_val']) {
411
							case "monthly":
412
								$item['minute'] = "0";
413
								$item['hour'] = "0";
414
								$item['mday'] = "1";
415
								$item['month'] = "*";
416
								$item['wday'] = "*";
417
								$item['who'] = "root";
418
								$item['command'] = CRON_PPPOE_CMD_FILE;
419
								break;
420
					        	case "weekly":
421
								$item['minute'] = "0";
422
								$item['hour'] = "0";
423
								$item['mday'] = "*";
424
								$item['month'] = "*";
425
								$item['wday'] = "0";
426
								$item['who'] = "root";
427
								$item['command'] = CRON_PPPOE_CMD_FILE;
428
								break;
429
							case "daily":
430
								$item['minute'] = "0";
431
								$item['hour'] = "0";
432
								$item['mday'] = "*";
433
								$item['month'] = "*";
434
								$item['wday'] = "*";
435
								$item['who'] = "root";
436
								$item['command'] = CRON_PPPOE_CMD_FILE;
437
								break;
438
							case "hourly":
439
								$item['minute'] = "0";
440
								$item['hour'] = "*";
441
								$item['mday'] = "*";
442
								$item['month'] = "*";
443
								$item['wday'] = "*";
444
								$item['who'] = "root";
445
								$item['command'] = CRON_PPPOE_CMD_FILE;
446
								break;
447
						} // end switch
448
					} // end if
449
				if (isset($itemhash['ID'])) {
450
					$config['cron']['item'][$itemhash['ID']] = $item;
451
				} else {
452
					$config['cron']['item'][] = $item;
453
				}
454
			} // end if
455
		} else if ($_POST['type'] == "PPTP") {
456
			$wancfg['ipaddr'] = "pptp";
457
			$config['pptp']['username'] = $_POST['pptp_username'];
458
			$config['pptp']['password'] = $_POST['pptp_password'];
459
			$config['pptp']['local'] = $_POST['pptp_local'];
460
			$config['pptp']['subnet'] = $_POST['pptp_subnet'];
461
			$config['pptp']['remote'] = $_POST['pptp_remote'];
462
			$config['pptp']['ondemand'] = $_POST['pptp_dialondemand'] ? true : false;
463
			$config['pptp']['timeout'] = $_POST['pptp_idletimeout'];
464
		} else if ($_POST['type'] == "BigPond") {
465
			$wancfg['ipaddr'] = "bigpond";
466
			$config['bigpond']['username'] = $_POST['bigpond_username'];
467
			$config['bigpond']['password'] = $_POST['bigpond_password'];
468
			$config['bigpond']['authserver'] = $_POST['bigpond_authserver'];
469
			$config['bigpond']['authdomain'] = $_POST['bigpond_authdomain'];
470
			$config['bigpond']['minheartbeatinterval'] = $_POST['bigpond_minheartbeatinterval'];
471
		}
472
    
473
		/* reset cron items if necessary */
474
		if (empty($_POST['pppoe_preset'])) {
475
			/* test whether a cron item exists and unset() it if necessary */
476
			$itemhash = getMPDCRONSettings();
477
			$item = $itemhash['ITEM'];
478
			if (isset($item)) { unset($config['cron']['item'][$itemhash['ID']]); }
479
		}
480

    
481
		if($_POST['blockpriv'] == "yes")
482
			$wancfg['blockpriv'] = true;
483
		else
484
			unset($wancfg['blockpriv']);
485

    
486
		if($_POST['blockbogons'] == "yes")
487
			$wancfg['blockbogons'] = true;
488
		else
489
			unset($wancfg['blockbogons']);
490

    
491
		$wancfg['spoofmac'] = $_POST['spoofmac'];
492
		$wancfg['mtu'] = $_POST['mtu'];
493

    
494
		write_config();
495
    
496
		/* finally install the pppoerestart file */
497
		if (isset($_POST['pppoe_preset'])) {
498
		config_lock();
499
		conf_mount_rw();
500
      
501
		if (! file_exists(CRON_PPPOE_CMD_FILE)) {
502
			file_put_contents(CRON_PPPOE_CMD_FILE, CRON_PPPOE_CMD);
503
			chmod(CRON_PPPOE_CMD_FILE, 0700);
504
		}
505
      
506
		/* regenerate cron settings/crontab file */
507
		configure_cron();
508
		sigkillbypid("{$g['varrun_path']}/cron.pid", "HUP");
509
      
510
		conf_mount_ro();
511
		config_unlock();
512
		}
513

    
514
		$retval = 0;
515
		$savemsg = get_std_save_message($retval);
516
	}
517
}
518

    
519
$pgtitle = "Interfaces: WAN";
520
$closehead = false;
521
include("head.inc");
522

    
523
?>
524

    
525
<script type="text/javascript" src="/javascript/numericupdown/js/numericupdown.js"></script>
526
<link href="/javascript/numericupdown/css/numericupdown.css" rel="stylesheet" type="text/css" />
527

    
528
<script type="text/javascript" src="/javascript/datepicker/js/datepicker.js"></script>
529
<link href="/javascript/datepicker/css/datepicker.css" rel="stylesheet" type="text/css" />
530

    
531
<script type="text/javascript" src="/javascript/scriptaculous/prototype.js"></script>
532
<script type="text/javascript" src="/javascript/scriptaculous/scriptaculous.js"></script>
533

    
534
<script type="text/javascript">
535
<!--
536
function enable_change(enable_change) {
537
	if (document.iform.pppoe_dialondemand.checked || enable_change) {
538
		document.iform.pppoe_idletimeout.disabled = 0;
539
	} else {
540
		document.iform.pppoe_idletimeout.disabled = 1;
541
	}
542
}
543

    
544
function enable_change_pptp(enable_change_pptp) {
545
	if (document.iform.pptp_dialondemand.checked || enable_change_pptp) {
546
		document.iform.pptp_idletimeout.disabled = 0;
547
		document.iform.pptp_local.disabled = 0;
548
		document.iform.pptp_remote.disabled = 0;
549
	} else {
550
		document.iform.pptp_idletimeout.disabled = 1;
551
	}
552
}
553

    
554
function type_change(enable_change,enable_change_pptp) {
555
	switch (document.iform.type.selectedIndex) {
556
		case 0:
557
			document.iform.username.disabled = 1;
558
			document.iform.password.disabled = 1;
559
			document.iform.provider.disabled = 1;
560
			document.iform.pppoe_dialondemand.disabled = 1;
561
			document.iform.pppoe_idletimeout.disabled = 1;
562
			document.iform.pppoe_preset.disabled = 1;
563
			document.iform.pppoe_preset.checked = 0;
564
			Effect.Fade('presetwrap', { duration: 1.0 });
565
			document.iform.ipaddr.disabled = 0;
566
			document.iform.subnet.disabled = 0;
567
			document.iform.gateway.disabled = 0;
568
			document.iform.pptp_username.disabled = 1;
569
			document.iform.pptp_password.disabled = 1;
570
			document.iform.pptp_local.disabled = 1;
571
			document.iform.pptp_subnet.disabled = 1;
572
			document.iform.pptp_remote.disabled = 1;
573
			document.iform.pptp_dialondemand.disabled = 1;
574
			document.iform.pptp_idletimeout.disabled = 1;
575
			document.iform.bigpond_username.disabled = 1;
576
			document.iform.bigpond_password.disabled = 1;
577
			document.iform.bigpond_authserver.disabled = 1;
578
			document.iform.bigpond_authdomain.disabled = 1;
579
			document.iform.bigpond_minheartbeatinterval.disabled = 1;
580
			document.iform.dhcphostname.disabled = 1;
581
			break;
582
		case 1:
583
			document.iform.username.disabled = 1;
584
			document.iform.password.disabled = 1;
585
			document.iform.provider.disabled = 1;
586
			document.iform.pppoe_dialondemand.disabled = 1;
587
			document.iform.pppoe_idletimeout.disabled = 1;
588
			document.iform.pppoe_preset.disabled = 1;
589
			document.iform.pppoe_preset.checked = 0;
590
			Effect.Fade('presetwrap', { duration: 1.0 });
591
			document.iform.ipaddr.disabled = 1;
592
			document.iform.subnet.disabled = 1;
593
			document.iform.gateway.disabled = 1;
594
			document.iform.pptp_username.disabled = 1;
595
			document.iform.pptp_password.disabled = 1;
596
			document.iform.pptp_local.disabled = 1;
597
			document.iform.pptp_subnet.disabled = 1;
598
			document.iform.pptp_remote.disabled = 1;
599
			document.iform.pptp_dialondemand.disabled = 1;
600
			document.iform.pptp_idletimeout.disabled = 1;
601
			document.iform.bigpond_username.disabled = 1;
602
			document.iform.bigpond_password.disabled = 1;
603
			document.iform.bigpond_authserver.disabled = 1;
604
			document.iform.bigpond_authdomain.disabled = 1;
605
			document.iform.bigpond_minheartbeatinterval.disabled = 1;
606
			document.iform.dhcphostname.disabled = 0;
607
			break;
608
		case 2:
609
			document.iform.username.disabled = 0;
610
			document.iform.password.disabled = 0;
611
			document.iform.provider.disabled = 0;
612
			document.iform.pppoe_dialondemand.disabled = 0;
613
			if (document.iform.pppoe_dialondemand.checked || enable_change) {
614
				document.iform.pppoe_idletimeout.disabled = 0;
615
			} else {
616
				document.iform.pppoe_idletimeout.disabled = 1;
617
			}
618
			document.iform.pppoe_preset.disabled = 0;
619
			document.iform.ipaddr.disabled = 1;
620
			document.iform.subnet.disabled = 1;
621
			document.iform.gateway.disabled = 1;
622
			document.iform.pptp_username.disabled = 1;
623
			document.iform.pptp_password.disabled = 1;
624
			document.iform.pptp_local.disabled = 1;
625
			document.iform.pptp_subnet.disabled = 1;
626
			document.iform.pptp_remote.disabled = 1;
627
			document.iform.pptp_dialondemand.disabled = 1;
628
			document.iform.pptp_idletimeout.disabled = 1;
629
			document.iform.bigpond_username.disabled = 1;
630
			document.iform.bigpond_password.disabled = 1;
631
			document.iform.bigpond_authserver.disabled = 1;
632
			document.iform.bigpond_authdomain.disabled = 1;
633
			document.iform.bigpond_minheartbeatinterval.disabled = 1;
634
			document.iform.dhcphostname.disabled = 1;
635
			break;
636
		case 3:
637
			document.iform.username.disabled = 1;
638
			document.iform.password.disabled = 1;
639
			document.iform.provider.disabled = 1;
640
			document.iform.pppoe_dialondemand.disabled = 1;
641
			document.iform.pppoe_idletimeout.disabled = 1;
642
			document.iform.pppoe_preset.disabled = 1;
643
			document.iform.pppoe_preset.checked = 0;
644
			Effect.Fade('presetwrap', { duration: 1.0 });			
645
			document.iform.ipaddr.disabled = 1;
646
			document.iform.subnet.disabled = 1;
647
			document.iform.gateway.disabled = 1;
648
			document.iform.pptp_username.disabled = 0;
649
			document.iform.pptp_password.disabled = 0;
650
			document.iform.pptp_local.disabled = 0;
651
			document.iform.pptp_subnet.disabled = 0;
652
			document.iform.pptp_remote.disabled = 0;
653
			document.iform.pptp_dialondemand.disabled = 0;
654
			if (document.iform.pptp_dialondemand.checked || enable_change_pptp) {
655
				document.iform.pptp_idletimeout.disabled = 0;
656
			} else {
657
				document.iform.pptp_idletimeout.disabled = 1;
658
			}
659
			document.iform.bigpond_username.disabled = 1;
660
			document.iform.bigpond_password.disabled = 1;
661
			document.iform.bigpond_authserver.disabled = 1;
662
			document.iform.bigpond_authdomain.disabled = 1;
663
			document.iform.bigpond_minheartbeatinterval.disabled = 1;
664
			document.iform.dhcphostname.disabled = 1;
665
			break;
666
		case 4:
667
			document.iform.username.disabled = 1;
668
			document.iform.password.disabled = 1;
669
			document.iform.provider.disabled = 1;
670
			document.iform.pppoe_dialondemand.disabled = 1;
671
			document.iform.pppoe_idletimeout.disabled = 1;
672
			document.iform.pppoe_preset.disabled = 1;
673
			document.iform.pppoe_preset.checked = 0;
674
			Effect.Fade('presetwrap', { duration: 1.0 });
675
			document.iform.ipaddr.disabled = 1;
676
			document.iform.subnet.disabled = 1;
677
			document.iform.gateway.disabled = 1;
678
			document.iform.pptp_username.disabled = 1;
679
			document.iform.pptp_password.disabled = 1;
680
			document.iform.pptp_local.disabled = 1;
681
			document.iform.pptp_subnet.disabled = 1;
682
			document.iform.pptp_remote.disabled = 1;
683
			document.iform.pptp_dialondemand.disabled = 1;
684
			document.iform.pptp_idletimeout.disabled = 1;
685
			document.iform.bigpond_username.disabled = 0;
686
			document.iform.bigpond_password.disabled = 0;
687
			document.iform.bigpond_authserver.disabled = 0;
688
			document.iform.bigpond_authdomain.disabled = 0;
689
			document.iform.bigpond_minheartbeatinterval.disabled = 0;
690
			document.iform.dhcphostname.disabled = 1;
691
			break;
692
	}
693
}
694

    
695
function show_mon_config() {
696
	document.getElementById("showmonbox").innerHTML='';
697
	aodiv = document.getElementById('showmon');
698
	aodiv.style.display = "block";
699
}
700

    
701
//-->
702
</script>
703
</head>
704
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
705
<?php include("fbegin.inc"); ?>
706
<p class="pgtitle"><?=$pgtitle?></p>
707
<?php if ($input_errors) print_input_errors($input_errors); ?>
708
<?php if ($savemsg) print_info_box($savemsg); ?>
709
            <form action="interfaces_wan.php" method="post" name="iform" id="iform">
710
              <table width="100%" border="0" cellpadding="6" cellspacing="0">
711
                <tr>
712
                  <td colspan="2" valign="top" class="listtopic">General configuration</td>
713
                </tr>
714
                <tr>
715
                  <td valign="middle" class="vncell"><strong>Type</strong></td>
716
                  <td class="vtable"> <select name="type" class="formfld" id="type" onchange="type_change()">
717
                      <?php $opts = split(" ", "Static DHCP PPPoE PPTP BigPond");
718
				foreach ($opts as $opt): ?>
719
                      <option <?php if ($opt == $pconfig['type']) echo "selected";?>>
720
                      <?=htmlspecialchars($opt);?>
721
                      </option>
722
                      <?php endforeach; ?>
723
                    </select></td>
724
                </tr>
725
                <tr>
726
                  <td valign="top" class="vncell">MAC address</td>
727
                  <td class="vtable"> <input name="spoofmac" type="text" class="formfld" id="spoofmac" size="30" value="<?=htmlspecialchars($pconfig['spoofmac']);?>">
728
		    <?php
729
			$ip = getenv('REMOTE_ADDR');
730
			$mac = `/usr/sbin/arp -an | grep {$ip} | cut -d" " -f4`;
731
			$mac = str_replace("\n","",$mac);
732
		    ?>
733
		    <a OnClick="document.forms[0].spoofmac.value='<?=$mac?>';" href="#">Copy my MAC address</a>
734
		    <br>
735
                    This field can be used to modify (&quot;spoof&quot;) the MAC
736
                    address of the WAN interface<br>
737
                    (may be required with some cable connections)<br>
738
                    Enter a MAC address in the following format: xx:xx:xx:xx:xx:xx
739
                    or leave blank</td>
740
                </tr>
741
                <tr>
742
                  <td valign="top" class="vncell">MTU</td>
743
                  <td class="vtable"> <input name="mtu" type="text" class="formfld" id="mtu" size="8" value="<?=htmlspecialchars($pconfig['mtu']);?>">
744
                    <br>
745
                    If you enter a value in this field, then MSS clamping for
746
                    TCP connections to the value entered above minus 40 (TCP/IP
747
                    header size) will be in effect. If you leave this field blank,
748
                    an MTU of 1492 bytes for PPPoE and 1500 bytes for all other
749
                    connection types will be assumed.</td>
750
                </tr>
751
                <tr>
752
                  <td colspan="2" valign="top" height="16"></td>
753
                </tr>
754
                <tr>
755
                  <td colspan="2" valign="top" class="listtopic">Static IP configuration</td>
756
                </tr>
757
                <tr>
758
                  <td width="100" valign="top" class="vncellreq">IP address</td>
759
                  <td class="vtable"> <input name="ipaddr" type="text" class="formfld" id="ipaddr" size="20" value="<?=htmlspecialchars($pconfig['ipaddr']);?>">
760
                    /
761
                    <select name="subnet" class="formfld" id="subnet">
762
			<?php
763
			for ($i = 32; $i > 0; $i--) {
764
				if($i <> 31) {
765
					echo "<option value=\"{$i}\" ";
766
					if ($i == $pconfig['subnet']) echo "selected";
767
					echo ">" . $i . "</option>";
768
				}
769
			}
770
			?>
771
                    </select></td>
772
                </tr><?php if (isset($wancfg['ispointtopoint'])): ?>
773
                <tr>
774
                  <td valign="top" class="vncellreq">Point-to-point IP address </td>
775
                  <td class="vtable">
776
                    <input name="pointtopoint" type="text" class="formfld" id="pointtopoint" size="20" value="<?=htmlspecialchars($pconfig['pointtopoint']);?>">
777
                  </td>
778
                </tr><?php endif; ?>
779
                <tr>
780
                  <td valign="top" class="vncellreq">Gateway</td>
781
                  <td class="vtable"> <input name="gateway" type="text" class="formfld" id="gateway" size="20" value="<?=htmlspecialchars($pconfig['gateway']);?>">
782
                  </td>
783
                </tr>
784
                <tr>
785
                  <td colspan="2" valign="top" height="16"></td>
786
                </tr>
787
                <tr>
788
                  <td colspan="2" valign="top" class="listtopic">DHCP client configuration</td>
789
                </tr>
790
                <tr>
791
                  <td valign="top" class="vncell">Hostname</td>
792
                  <td class="vtable"> <input name="dhcphostname" type="text" class="formfld" id="dhcphostname" size="40" value="<?=htmlspecialchars($pconfig['dhcphostname']);?>">
793
                    <br>
794
                    The value in this field is sent as the DHCP client identifier
795
                    and hostname when requesting a DHCP lease. Some ISPs may require
796
                    this (for client identification).</td>
797
                </tr>
798
                <tr>
799
                  <td colspan="2" valign="top" height="16"></td>
800
                </tr>
801
                <tr>
802
                  <td colspan="2" valign="top" class="listtopic">PPPoE configuration</td>
803
                </tr>
804
                <tr>
805
                  <td valign="top" class="vncellreq">Username</td>
806
                  <td class="vtable"><input name="username" type="text" class="formfld" id="username" size="20" value="<?=htmlspecialchars($pconfig['username']);?>">
807
                  </td>
808
                </tr>
809
                <tr>
810
                  <td valign="top" class="vncellreq">Password</td>
811
                  <td class="vtable"><input name="password" type="text" class="formfld" id="password" size="20" value="<?=htmlspecialchars($pconfig['password']);?>">
812
                  </td>
813
                </tr>
814
                <tr>
815
                  <td valign="top" class="vncell">Service name</td>
816
                  <td class="vtable"><input name="provider" type="text" class="formfld" id="provider" size="20" value="<?=htmlspecialchars($pconfig['provider']);?>">
817
                    <br> <span class="vexpl">Hint: this field can usually be left
818
                    empty</span></td>
819
                </tr>
820
                <tr>
821
                  <td valign="top" class="vncell">Dial on demand</td>
822
                  <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)" >
823
                    <strong>Enable Dial-On-Demand mode</strong><br>
824
		    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>
825
                </tr>
826
                <tr>
827
                  <td valign="top" class="vncell">Idle timeout</td>
828
                  <td class="vtable">
829
                    <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>
830
                </tr>
831
                <tr>
832
                  <td valign="top" class="vncell"><?=gettext("Periodic reset");?></td>
833
                  <td class="vtable">
834
                    <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 });" />
835
                    <?= gettext("enable periodic PPPoE resets"); ?>
836
                    <br />
837
                    <?php if ($pconfig['pppoe_preset']): ?>
838
                    <table id="presetwrap" cellspacing="0" cellpadding="0" width="100%">
839
                    <?php else: ?>
840
                    <table id="presetwrap" cellspacing="0" cellpadding="0" width="100%" style="display: none;">
841
                    <?php endif; ?>
842
                      <tr>
843
                        <td align="left" valign="top">
844
                          <p style="margin: 4px; padding: 4px 0 4px 0; width: 94%;">
845
                            <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 }); }" /> 
846
                            <?= gettext("provide a custom reset time"); ?>
847
                            <br />
848
                            <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 }); }" /> 
849
                            <?= gettext("select reset time from a preset"); ?>
850
                          </p>
851
                          <?php if ($pconfig['pppoe_pr_custom']): ?>
852
                          <p style="margin: 2px; padding: 4px; width: 94%;" id="pppoecustomwrap">
853
                          <?php else: ?>
854
                          <p style="margin: 2px; padding: 4px; width: 94%; display: none;" id="pppoecustomwrap">
855
                          <?php endif; ?>
856
                            <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" /> 
857
                            <?= gettext("hour (0-23)"); ?><br />
858
                            <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" /> 
859
                            <?= gettext("minute (0-59)"); ?><br />
860
                            <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']);?>" /> 
861
                            <?= gettext("reset at a specific date (mm/dd/yyyy)"); ?>
862
                            <br />&nbsp;<br />
863
                            <span class="red"><strong>Note: </strong></span>
864
                            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.
865
                          </p>
866
                          <?php if ($pconfig['pppoe_pr_preset']): ?>
867
                          <p style="margin: 2px; padding: 4px; width: 94%;" id="pppoepresetwrap">
868
                          <?php else: ?>
869
                          <p style="margin: 2px; padding: 4px; width: 94%; display: none;" id="pppoepresetwrap">
870
                          <?php endif; ?>
871
                            <input name="pppoe_pr_preset_val" type="radio" id="pppoe_monthly" value="monthly" <?php if ($pconfig['pppoe_monthly']) echo "checked=\"checked\""; ?> /> 
872
                            <?= gettext("reset at each month ('0 0 1 * *')"); ?>
873
                            <br />
874
                            <input name="pppoe_pr_preset_val" type="radio" id="pppoe_weekly" value="weekly" <?php if ($pconfig['pppoe_weekly']) echo "checked=\"checked\""; ?> /> 
875
                            <?= gettext("reset at each week ('0 0 * * 0')"); ?>
876
                            <br />
877
                            <input name="pppoe_pr_preset_val" type="radio" id="pppoe_daily" value="daily" <?php if ($pconfig['pppoe_daily']) echo "checked=\"checked\""; ?> /> 
878
                            <?= gettext("reset at each day ('0 0 * * *')"); ?>
879
                            <br />
880
                            <input name="pppoe_pr_preset_val" type="radio" id="pppoe_hourly" value="hourly" <?php if ($pconfig['pppoe_hourly']) echo "checked=\"checked\""; ?> /> 
881
                            <?= gettext("reset at each hour ('0 * * * *')"); ?>
882
                          </p>
883
                        </td>
884
                      </tr>
885
                    </table>
886
                  </td>
887
                </tr>                
888
                <tr>
889
                  <td colspan="2" valign="top" height="16"></td>
890
                </tr>
891
                <tr>
892
                  <td colspan="2" valign="top" class="listtopic">PPTP configuration</td>
893
                </tr>
894
                <tr>
895
                  <td valign="top" class="vncellreq">Username</td>
896
                  <td class="vtable"><input name="pptp_username" type="text" class="formfld" id="pptp_username" size="20" value="<?=htmlspecialchars($pconfig['pptp_username']);?>">
897
                  </td>
898
                </tr>
899
                <tr>
900
                  <td valign="top" class="vncellreq">Password</td>
901
                  <td class="vtable"><input name="pptp_password" type="text" class="formfld" id="pptp_password" size="20" value="<?=htmlspecialchars($pconfig['pptp_password']);?>">
902
                  </td>
903
                </tr>
904
                <tr>
905
                  <td width="100" valign="top" class="vncellreq">Local IP address</td>
906
                  <td class="vtable"> <input name="pptp_local" type="text" class="formfld" id="pptp_local" size="20" value="<?=htmlspecialchars($pconfig['pptp_local']);?>">
907
                    /
908
                    <select name="pptp_subnet" class="formfld" id="pptp_subnet">
909
                      <?php for ($i = 31; $i > 0; $i--): ?>
910
                      <option value="<?=$i;?>" <?php if ($i == $pconfig['pptp_subnet']) echo "selected"; ?>>
911
                      <?=$i;?>
912
                      </option>
913
                      <?php endfor; ?>
914
                    </select></td>
915
                </tr>
916
                <tr>
917
                  <td width="100" valign="top" class="vncellreq">Remote IP address</td>
918
                  <td class="vtable"> <input name="pptp_remote" type="text" class="formfld" id="pptp_remote" size="20" value="<?=htmlspecialchars($pconfig['pptp_remote']);?>">
919
                  </td>
920
                </tr>
921
                <tr>
922
                  <td valign="top" class="vncell">Dial on demand</td>
923
                  <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)" >
924
                    <strong>Enable Dial-On-Demand mode</strong><br>
925
		    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>
926
                </tr>
927
                <tr>
928
                  <td valign="top" class="vncell">Idle timeout</td>
929
                  <td class="vtable">
930
                    <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>
931
                </tr>
932
                <tr>
933
                  <td colspan="2" valign="top" height="16"></td>
934
                </tr>
935
                <tr>
936
                  <td colspan="2" valign="top" class="listtopic">BigPond Cable configuration</td>
937
                </tr>
938
                <tr>
939
                  <td valign="top" class="vncellreq">Username</td>
940
                  <td class="vtable"><input name="bigpond_username" type="text" class="formfld" id="bigpond_username" size="20" value="<?=htmlspecialchars($pconfig['bigpond_username']);?>">
941
                  </td>
942
                </tr>
943
                <tr>
944
                  <td valign="top" class="vncellreq">Password</td>
945
                  <td class="vtable"><input name="bigpond_password" type="text" class="formfld" id="bigpond_password" size="20" value="<?=htmlspecialchars($pconfig['bigpond_password']);?>">
946
                  </td>
947
                </tr>
948
                <tr>
949
                  <td valign="top" class="vncell">Authentication server</td>
950
                  <td class="vtable"><input name="bigpond_authserver" type="text" class="formfld" id="bigpond_authserver" size="20" value="<?=htmlspecialchars($pconfig['bigpond_authserver']);?>">
951
                    <br>
952
                  <span class="vexpl">If this field is left empty, the default (&quot;dce-server&quot;) is used. </span></td>
953
                </tr>
954
                <tr>
955
                  <td valign="top" class="vncell">Authentication domain</td>
956
                  <td class="vtable"><input name="bigpond_authdomain" type="text" class="formfld" id="bigpond_authdomain" size="20" value="<?=htmlspecialchars($pconfig['bigpond_authdomain']);?>">
957
                    <br>
958
                  <span class="vexpl">If this field is left empty, the domain name assigned via DHCP will be used.<br>
959
                  <br>
960
                  Note: the BigPond client implicitly sets the &quot;Allow DNS server list to be overridden by DHCP/PPP on WAN&quot; on the System: General setup page.            </span></td>
961
                </tr>
962
                <tr>
963
                  <td valign="top" class="vncell">Min. heartbeat interval</td>
964
                  <td class="vtable">
965
                    <input name="bigpond_minheartbeatinterval" type="text" class="formfld" id="bigpond_minheartbeatinterval" size="8" value="<?=htmlspecialchars($pconfig['bigpond_minheartbeatinterval']);?>">seconds<br>Setting this to a sensible value (e.g. 60 seconds) can protect against DoS attacks. </td>
966
                </tr>
967
                <tr>
968
                  <td colspan="2" valign="top" height="16"></td>
969
                </tr>
970
                <tr>
971
                  <td colspan="2" valign="top" class="listtopic">Other</td>
972
                </tr>
973
		<tr>
974
			<td width="22%" valign="top" class="vncell">FTP Helper</td>
975
			<td width="78%" class="vtable">
976
				<input name="disableftpproxy" type="checkbox" id="disableftpproxy" value="yes" <?php if ($pconfig['disableftpproxy']) echo "checked"; ?> onclick="enable_change(false)" />
977
				<strong>Disable the userland FTP-Proxy application</strong>
978
				<br />
979
			</td>
980
		</tr>
981
		<tr>
982
			<td width="22%" valign="top" class="vncell">Monitor IP</td>
983
			<td width="78%" class="vtable">
984
				<div id="showmonbox">
985
					<input type="button" onClick="show_mon_config()" value="Advanced"></input> - Show Monitor IP configuration</a>
986
				</div>
987
				<div id="showmon" style="display:none">
988
					<input name="use_rrd_gateway" type="text" id="use_rrd_gateway" value="<?php echo ($wancfg['use_rrd_gateway']) ; ?>" />
989
					<strong>Alternative monitor IP</strong> <br />
990
					Enter a alternative address here to be used to monitor the link. This is used for the 
991
					quality RRD graphs as well as the load balancer entries. Use this if the gateway does not respond 
992
					to icmp requests.</strong>
993
					<br />
994
				</div>
995
			</td>
996
		</tr>
997
		        <?php
998
				/* Wireless interface? */
999
				if (isset($wancfg['wireless']))
1000
					wireless_config_print();
1001
			?>
1002
                <tr>
1003
                  <td height="16" colspan="2" valign="top"></td>
1004
                </tr>
1005
                <tr>
1006
                  <td valign="middle">&nbsp;</td>
1007
                  <td class="vtable"><a name="rfc1918"></a> <input name="blockpriv" type="checkbox" id="blockpriv" value="yes" <?php if ($pconfig['blockpriv']) echo "checked"; ?>>
1008
                    <strong>Block private networks</strong><br>
1009
                    When set, this option blocks traffic from IP addresses that
1010
                    are reserved for private<br>
1011
                    networks as per RFC 1918 (10/8, 172.16/12, 192.168/16) as
1012
                    well as loopback addresses<br>
1013
                    (127/8). You should generally leave this option turned on,
1014
                    unless your WAN network<br>
1015
                    lies in such a private address space, too.</td>
1016
                </tr>
1017
                <tr>
1018
                  <td valign="middle">&nbsp;</td>
1019
                  <td class="vtable"> <input name="blockbogons" type="checkbox" id="blockbogons" value="yes" <?php if ($pconfig['blockbogons']) echo "checked"; ?>>
1020
                    <strong>Block bogon networks</strong><br>
1021
                    When set, this option blocks traffic from IP addresses that
1022
                    are reserved (but not RFC 1918) or not yet assigned by IANA.<br>
1023
                    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>
1024
		</tr>
1025

    
1026
                <tr>
1027
                  <td width="100" valign="top">&nbsp;</td>
1028
                  <td> &nbsp;<br> <input name="Submit" type="submit" class="formbtn" value="Save" onClick="enable_change_pptp(true)&&enable_change(true)">
1029
                  </td>
1030
                </tr>
1031
              </table>
1032
</form>
1033
<script language="JavaScript">
1034
<!--
1035
type_change();
1036
//-->
1037
</script>
1038
<?php include("fend.inc"); ?>
1039
</body>
1040
</html>
1041

    
1042

    
1043
<?php
1044

    
1045
if ($_POST) {
1046

    
1047
	if (!$input_errors) {
1048

    
1049
		unlink_if_exists("{$g['tmp_path']}/config.cache");
1050

    
1051
		ob_flush();
1052
		flush();
1053
		sleep(1);
1054

    
1055
		interfaces_wan_configure();
1056

    
1057
		reset_carp();
1058

    
1059
		/* sync filter configuration */
1060
		filter_configure();
1061
	}
1062
}
1063

    
1064
?>
(79-79/183)