Project

General

Profile

Download (43 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
if (!is_array($config['gateways']['gateway_item']))
72
	$config['gateways']['gateway_item'] = array();
73
$a_gateways = &$config['gateways']['gateway_item'];
74

    
75
$wancfg = &$config['interfaces']['wan'];
76
$optcfg = &$config['interfaces']['wan'];
77

    
78
$pconfig['username'] = $config['pppoe']['username'];
79
$pconfig['password'] = $config['pppoe']['password'];
80
$pconfig['provider'] = $config['pppoe']['provider'];
81
$pconfig['pppoe_dialondemand'] = isset($config['pppoe']['ondemand']);
82
$pconfig['pppoe_idletimeout'] = $config['pppoe']['timeout'];
83

    
84
/* ================================================ */
85
/* = force a connection reset at a specific time? = */
86
/* ================================================ */
87

    
88
if (isset($wancfg['pppoe']['pppoe-reset-type'])) {
89
  $resetTime = getMPDResetTimeFromConfig();  
90
  $pconfig['pppoe_preset'] = true;
91
  
92
  if ($wancfg['pppoe']['pppoe-reset-type'] == "custom") {
93
    $resetTime_a = split(" ", $resetTime);
94
    $pconfig['pppoe_pr_custom'] = true;
95
    $pconfig['pppoe_resetminute'] = $resetTime_a[0];
96
    $pconfig['pppoe_resethour'] = $resetTime_a[1];
97

    
98
    /* just initialize $pconfig['pppoe_resetdate'] if the
99
     * coresponding item contains appropriate numeric values.
100
     */
101
    if ($resetTime_a[2] <> "*" && $resetTime_a[3] <> "*") {
102
      $pconfig['pppoe_resetdate'] = "{$resetTime_a[3]}/{$resetTime_a[2]}/" . date("Y");
103
    }
104
  } else if ($wancfg['pppoe']['pppoe-reset-type'] == "preset") {
105
    $pconfig['pppoe_pr_preset'] = true;
106
    
107
    switch ($resetTime) {
108
      case CRON_MONTHLY_PATTERN:
109
        $pconfig['pppoe_monthly'] = true;
110
        break;
111
      case CRON_WEEKLY_PATTERN:
112
        $pconfig['pppoe_weekly'] = true;
113
        break;
114
      case CRON_DAILY_PATTERN:
115
        $pconfig['pppoe_daily'] = true;
116
        break;
117
      case CRON_HOURLY_PATTERN:
118
        $pconfig['pppoe_hourly'] = true;
119
        break;
120
    }
121
  }
122
}
123

    
124
$pconfig['pptp_username'] = $config['pptp']['username'];
125
$pconfig['pptp_password'] = $config['pptp']['password'];
126
$pconfig['pptp_local'] = $config['pptp']['local'];
127
$pconfig['pptp_subnet'] = $config['pptp']['subnet'];
128
$pconfig['pptp_remote'] = $config['pptp']['remote'];
129
$pconfig['pptp_dialondemand'] = isset($config['pptp']['ondemand']);
130
$pconfig['pptp_idletimeout'] = $config['pptp']['timeout'];
131

    
132
$pconfig['disableftpproxy'] = isset($wancfg['disableftpproxy']);
133

    
134
$pconfig['dhcphostname'] = $wancfg['dhcphostname'];
135
$pconfig['alias-address'] = $wancfg['alias-address'];
136
$pconfig['alias-subnet'] = $wancfg['alias-subnet'];
137

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

    
152
$pconfig['blockpriv'] = isset($wancfg['blockpriv']);
153
$pconfig['blockbogons'] = isset($wancfg['blockbogons']);
154
$pconfig['spoofmac'] = $wancfg['spoofmac'];
155
$pconfig['mtu'] = $wancfg['mtu'];
156

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

    
163
if ($_POST) {
164

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

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

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

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

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

    
295
	/* Wireless interface? */
296
	if (isset($wancfg['wireless'])) {
297
		$wi_input_errors = wireless_config_post();
298
		if ($wi_input_errors) {
299
			$input_errors = array_merge($input_errors, $wi_input_errors);
300
		}
301
	}
302

    
303
	if (!$input_errors) {
304

    
305
		$bridge = discover_bridge($wancfg['if'], filter_translate_type_to_real_interface($wancfg['bridge']));
306
		if($bridge <> "-1") {
307
			destroy_bridge($bridge);
308
		}
309

    
310
		unset($wancfg['ipaddr']);
311
		unset($wancfg['subnet']);
312
		unset($config['interfaces']['wan']['gateway']);
313
		unset($wancfg['pointtopoint']);
314
		unset($wancfg['dhcphostname']);
315
		if (is_array($wancfg['pppoe'])) {
316
			unset($config['pppoe']['username']);
317
			unset($config['pppoe']['password']);
318
			unset($config['pppoe']['provider']);
319
			unset($config['pppoe']['ondemand']);
320
			unset($config['pppoe']['timeout']);
321
			unset($wancfg['pppoe']['pppoe-reset-type']);
322
		}
323
		if (is_array($wancfg['pptp'])) {
324
			unset($config['pptp']['username']);
325
			unset($config['pptp']['password']);
326
			unset($config['pptp']['local']);
327
			unset($config['pptp']['subnet']);
328
			unset($config['pptp']['remote']);
329
			unset($config['pptp']['ondemand']);
330
			unset($config['pptp']['timeout']);
331
		}
332
		unset($wancfg['disableftpproxy']);
333

    
334
		/* per interface pftpx helper */
335
		if($_POST['disableftpproxy'] == "yes") {
336
			$wancfg['disableftpproxy'] = true;
337
			system_start_ftp_helpers();
338
		} else {
339
			system_start_ftp_helpers();
340
		}
341

    
342
		if ($_POST['type'] == "Static") {
343
			$wancfg['ipaddr'] = $_POST['ipaddr'];
344
			$wancfg['subnet'] = $_POST['subnet'];
345
			$config['interfaces']['wan']['gateway'] = $_POST['gateway'];
346
			if (isset($wancfg['ispointtopoint']))
347
				$wancfg['pointtopoint'] = $_POST['pointtopoint'];
348
		} else if ($_POST['type'] == "DHCP") {
349
			$wancfg['ipaddr'] = "dhcp";
350
			$wancfg['dhcphostname'] = $_POST['dhcphostname'];
351
			$wancfg['alias-address'] = $_POST['alias-address'];
352
			$wancfg['alias-subnet'] = $_POST['alias-subnet'];
353
		} else if ($_POST['type'] == "PPPoE") {
354
			$wancfg['ipaddr'] = "pppoe";
355
			$config['pppoe']['username'] = $_POST['username'];
356
			$config['pppoe']['password'] = $_POST['password'];
357
			$config['pppoe']['provider'] = $_POST['provider'];
358
			$config['pppoe']['ondemand'] = $_POST['pppoe_dialondemand'] ? true : false;
359
			$config['pppoe']['timeout'] = $_POST['pppoe_idletimeout'];
360
      
361
			/* perform a periodic reset? */
362
			if (isset($_POST['pppoe_preset'])) {
363
				if (! is_array($config['cron']['item'])) { $config['cron']['item'] = array(); }
364

    
365
					$itemhash = getMPDCRONSettings();
366
					$item = $itemhash['ITEM'];
367

    
368
					if (empty($item)) {
369
						$item = array();
370
					}
371

    
372
					if (isset($_POST['pppoe_pr_type']) && $_POST['pppoe_pr_type'] == "custom") {
373
						$wancfg['pppoe']['pppoe-reset-type'] = "custom";
374
						$pconfig['pppoe_pr_custom'] = true;
375

    
376
						$item['minute'] = $_POST['pppoe_resetminute'];
377
						$item['hour'] = $_POST['pppoe_resethour'];
378

    
379
						if (isset($_POST['pppoe_resetdate']) && 
380
							$_POST['pppoe_resetdate'] <> "" && 
381
							strlen($_POST['pppoe_resetdate']) == 10) {
382
							$date = explode("/", $_POST['pppoe_resetdate']);
383
							$item['mday'] = $date[1];
384
							$item['month'] = $date[0];
385
						} else {
386
							$item['mday'] = "*";
387
							$item['month'] = "*";
388
						}
389
						$item['wday'] = "*";
390
						$item['who'] = "root";
391
						$item['command'] = CRON_PPPOE_CMD_FILE;
392
					} else if (isset($_POST['pppoe_pr_type']) && $_POST['pppoe_pr_type'] = "preset") {
393
						$wancfg['pppoe']['pppoe-reset-type'] = "preset";
394
						$pconfig['pppoe_pr_preset'] = true;
395

    
396
						switch ($_POST['pppoe_pr_preset_val']) {
397
							case "monthly":
398
								$item['minute'] = "0";
399
								$item['hour'] = "0";
400
								$item['mday'] = "1";
401
								$item['month'] = "*";
402
								$item['wday'] = "*";
403
								$item['who'] = "root";
404
								$item['command'] = CRON_PPPOE_CMD_FILE;
405
								break;
406
					        	case "weekly":
407
								$item['minute'] = "0";
408
								$item['hour'] = "0";
409
								$item['mday'] = "*";
410
								$item['month'] = "*";
411
								$item['wday'] = "0";
412
								$item['who'] = "root";
413
								$item['command'] = CRON_PPPOE_CMD_FILE;
414
								break;
415
							case "daily":
416
								$item['minute'] = "0";
417
								$item['hour'] = "0";
418
								$item['mday'] = "*";
419
								$item['month'] = "*";
420
								$item['wday'] = "*";
421
								$item['who'] = "root";
422
								$item['command'] = CRON_PPPOE_CMD_FILE;
423
								break;
424
							case "hourly":
425
								$item['minute'] = "0";
426
								$item['hour'] = "*";
427
								$item['mday'] = "*";
428
								$item['month'] = "*";
429
								$item['wday'] = "*";
430
								$item['who'] = "root";
431
								$item['command'] = CRON_PPPOE_CMD_FILE;
432
								break;
433
						} // end switch
434
					} // end if
435
				if (isset($itemhash['ID'])) {
436
					$config['cron']['item'][$itemhash['ID']] = $item;
437
				} else {
438
					$config['cron']['item'][] = $item;
439
				}
440
			} // end if
441
		} else if ($_POST['type'] == "PPTP") {
442
			$wancfg['ipaddr'] = "pptp";
443
			$config['pptp']['username'] = $_POST['pptp_username'];
444
			$config['pptp']['password'] = $_POST['pptp_password'];
445
			$config['pptp']['local'] = $_POST['pptp_local'];
446
			$config['pptp']['subnet'] = $_POST['pptp_subnet'];
447
			$config['pptp']['remote'] = $_POST['pptp_remote'];
448
			$config['pptp']['ondemand'] = $_POST['pptp_dialondemand'] ? true : false;
449
			$config['pptp']['timeout'] = $_POST['pptp_idletimeout'];
450
		}
451
    
452
		/* reset cron items if necessary */
453
		if (empty($_POST['pppoe_preset'])) {
454
			/* test whether a cron item exists and unset() it if necessary */
455
			$itemhash = getMPDCRONSettings();
456
			$item = $itemhash['ITEM'];
457
			if (isset($item)) { unset($config['cron']['item'][$itemhash['ID']]); }
458
		}
459

    
460
		if($_POST['blockpriv'] == "yes")
461
			$wancfg['blockpriv'] = true;
462
		else
463
			unset($wancfg['blockpriv']);
464

    
465
		if($_POST['blockbogons'] == "yes")
466
			$wancfg['blockbogons'] = true;
467
		else
468
			unset($wancfg['blockbogons']);
469

    
470
		$wancfg['spoofmac'] = $_POST['spoofmac'];
471
		$wancfg['mtu'] = $_POST['mtu'];
472

    
473
		write_config();
474
    
475
		/* finally install the pppoerestart file */
476
		if (isset($_POST['pppoe_preset'])) {
477
		config_lock();
478
		conf_mount_rw();
479
      
480
		if (! file_exists(CRON_PPPOE_CMD_FILE)) {
481
			file_put_contents(CRON_PPPOE_CMD_FILE, CRON_PPPOE_CMD);
482
			chmod(CRON_PPPOE_CMD_FILE, 0700);
483
		}
484
      
485
		/* regenerate cron settings/crontab file */
486
		configure_cron();
487
		sigkillbypid("{$g['varrun_path']}/cron.pid", "HUP");
488
      
489
		conf_mount_ro();
490
		config_unlock();
491
		}
492

    
493
		$retval = 0;
494
		$savemsg = get_std_save_message($retval);
495
	}
496
}
497

    
498
$pgtitle = array("Interfaces","WAN");
499
$closehead = false;
500
include("head.inc");
501

    
502
?>
503

    
504
<script type="text/javascript" src="/javascript/numericupdown/js/numericupdown.js"></script>
505
<link href="/javascript/numericupdown/css/numericupdown.css" rel="stylesheet" type="text/css" />
506

    
507
<script type="text/javascript" src="/javascript/datepicker/js/datepicker.js"></script>
508
<link href="/javascript/datepicker/css/datepicker.css" rel="stylesheet" type="text/css" />
509

    
510
<script type="text/javascript" src="/javascript/scriptaculous/prototype.js"></script>
511
<script type="text/javascript" src="/javascript/scriptaculous/scriptaculous.js"></script>
512

    
513
<script type="text/javascript">
514
<!--
515
function enable_change(enable_change) {
516
	if (document.iform.pppoe_dialondemand.checked || enable_change) {
517
		document.iform.pppoe_idletimeout.disabled = 0;
518
	} else {
519
		document.iform.pppoe_idletimeout.disabled = 1;
520
	}
521
}
522

    
523
function enable_change_pptp(enable_change_pptp) {
524
	if (document.iform.pptp_dialondemand.checked || enable_change_pptp) {
525
		document.iform.pptp_idletimeout.disabled = 0;
526
		document.iform.pptp_local.disabled = 0;
527
		document.iform.pptp_remote.disabled = 0;
528
	} else {
529
		document.iform.pptp_idletimeout.disabled = 1;
530
	}
531
}
532

    
533
function type_change(enable_change,enable_change_pptp) {
534
	switch (document.iform.type.selectedIndex) {
535
		case 0:
536
			document.iform.username.disabled = 1;
537
			document.iform.password.disabled = 1;
538
			document.iform.provider.disabled = 1;
539
			document.iform.pppoe_dialondemand.disabled = 1;
540
			document.iform.pppoe_idletimeout.disabled = 1;
541
			document.iform.pppoe_preset.disabled = 1;
542
			document.iform.pppoe_preset.checked = 0;
543
			Effect.Fade('presetwrap', { duration: 1.0 });
544
			document.iform.ipaddr.disabled = 0;
545
			document.iform.subnet.disabled = 0;
546
			document.iform.gateway.disabled = 0;
547
			document.iform.pptp_username.disabled = 1;
548
			document.iform.pptp_password.disabled = 1;
549
			document.iform.pptp_local.disabled = 1;
550
			document.iform.pptp_subnet.disabled = 1;
551
			document.iform.pptp_remote.disabled = 1;
552
			document.iform.pptp_dialondemand.disabled = 1;
553
			document.iform.pptp_idletimeout.disabled = 1;
554
			document.iform.dhcphostname.disabled = 1;
555
			break;
556
		case 1:
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 = 1;
566
			document.iform.subnet.disabled = 1;
567
			document.iform.gateway.disabled = 1;
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.dhcphostname.disabled = 0;
576
			break;
577
		case 2:
578
			document.iform.username.disabled = 0;
579
			document.iform.password.disabled = 0;
580
			document.iform.provider.disabled = 0;
581
			document.iform.pppoe_dialondemand.disabled = 0;
582
			if (document.iform.pppoe_dialondemand.checked || enable_change) {
583
				document.iform.pppoe_idletimeout.disabled = 0;
584
			} else {
585
				document.iform.pppoe_idletimeout.disabled = 1;
586
			}
587
			document.iform.pppoe_preset.disabled = 0;
588
			document.iform.ipaddr.disabled = 1;
589
			document.iform.subnet.disabled = 1;
590
			document.iform.gateway.disabled = 1;
591
			document.iform.pptp_username.disabled = 1;
592
			document.iform.pptp_password.disabled = 1;
593
			document.iform.pptp_local.disabled = 1;
594
			document.iform.pptp_subnet.disabled = 1;
595
			document.iform.pptp_remote.disabled = 1;
596
			document.iform.pptp_dialondemand.disabled = 1;
597
			document.iform.pptp_idletimeout.disabled = 1;
598
			document.iform.dhcphostname.disabled = 1;
599
			break;
600
		case 3:
601
			document.iform.username.disabled = 1;
602
			document.iform.password.disabled = 1;
603
			document.iform.provider.disabled = 1;
604
			document.iform.pppoe_dialondemand.disabled = 1;
605
			document.iform.pppoe_idletimeout.disabled = 1;
606
			document.iform.pppoe_preset.disabled = 1;
607
			document.iform.pppoe_preset.checked = 0;
608
			Effect.Fade('presetwrap', { duration: 1.0 });			
609
			document.iform.ipaddr.disabled = 1;
610
			document.iform.subnet.disabled = 1;
611
			document.iform.gateway.disabled = 1;
612
			document.iform.pptp_username.disabled = 0;
613
			document.iform.pptp_password.disabled = 0;
614
			document.iform.pptp_local.disabled = 0;
615
			document.iform.pptp_subnet.disabled = 0;
616
			document.iform.pptp_remote.disabled = 0;
617
			document.iform.pptp_dialondemand.disabled = 0;
618
			if (document.iform.pptp_dialondemand.checked || enable_change_pptp) {
619
				document.iform.pptp_idletimeout.disabled = 0;
620
			} else {
621
				document.iform.pptp_idletimeout.disabled = 1;
622
			}
623
			document.iform.dhcphostname.disabled = 1;
624
			break;
625
		case 4:
626
			document.iform.username.disabled = 1;
627
			document.iform.password.disabled = 1;
628
			document.iform.provider.disabled = 1;
629
			document.iform.pppoe_dialondemand.disabled = 1;
630
			document.iform.pppoe_idletimeout.disabled = 1;
631
			document.iform.pppoe_preset.disabled = 1;
632
			document.iform.pppoe_preset.checked = 0;
633
			Effect.Fade('presetwrap', { duration: 1.0 });
634
			document.iform.ipaddr.disabled = 1;
635
			document.iform.subnet.disabled = 1;
636
			document.iform.gateway.disabled = 1;
637
			document.iform.pptp_username.disabled = 1;
638
			document.iform.pptp_password.disabled = 1;
639
			document.iform.pptp_local.disabled = 1;
640
			document.iform.pptp_subnet.disabled = 1;
641
			document.iform.pptp_remote.disabled = 1;
642
			document.iform.pptp_dialondemand.disabled = 1;
643
			document.iform.pptp_idletimeout.disabled = 1;
644
			document.iform.dhcphostname.disabled = 1;
645
			break;
646
	}
647
}
648

    
649
function show_mon_config() {
650
	document.getElementById("showmonbox").innerHTML='';
651
	aodiv = document.getElementById('showmon');
652
	aodiv.style.display = "block";
653
}
654

    
655
//-->
656
</script>
657
</head>
658
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
659
<?php include("fbegin.inc"); ?>
660
<?php if ($input_errors) print_input_errors($input_errors); ?>
661
<?php if ($savemsg) print_info_box($savemsg); ?>
662
            <form action="interfaces_wan.php" method="post" name="iform" id="iform">
663
              <table width="100%" border="0" cellpadding="6" cellspacing="0">
664
                <tr>
665
                  <td colspan="2" valign="top" class="listtopic">General configuration</td>
666
                </tr>
667
                <tr>
668
                  <td valign="middle" class="vncell"><strong>Type</strong></td>
669
                  <td class="vtable"> <select name="type" class="formselect" id="type" onchange="type_change()">
670
                      <?php $opts = split(" ", "Static DHCP PPPoE PPTP");
671
				foreach ($opts as $opt): ?>
672
                      <option <?php if ($opt == $pconfig['type']) echo "selected";?>>
673
                      <?=htmlspecialchars($opt);?>
674
                      </option>
675
                      <?php endforeach; ?>
676
                    </select></td>
677
                </tr>
678
                <tr>
679
                  <td valign="top" class="vncell">MAC address</td>
680
                  <td class="vtable"> <input name="spoofmac" type="text" class="formfld unknown" id="spoofmac" size="30" value="<?=htmlspecialchars($pconfig['spoofmac']);?>">
681
		    <?php
682
			$ip = getenv('REMOTE_ADDR');
683
			$mac = `/usr/sbin/arp -an | grep {$ip} | cut -d" " -f4`;
684
			$mac = str_replace("\n","",$mac);
685
		    ?>
686
		    <a OnClick="document.forms[0].spoofmac.value='<?=$mac?>';" href="#">Copy my MAC address</a>
687
		    <br>
688
                    This field can be used to modify (&quot;spoof&quot;) the MAC
689
                    address of the WAN interface<br>
690
                    (may be required with some cable connections)<br>
691
                    Enter a MAC address in the following format: xx:xx:xx:xx:xx:xx
692
                    or leave blank</td>
693
                </tr>
694
                <tr>
695
                  <td valign="top" class="vncell">MTU</td>
696
                  <td class="vtable"> <input name="mtu" type="text" class="formfld unknown" id="mtu" size="8" value="<?=htmlspecialchars($pconfig['mtu']);?>">
697
                    <br>
698
                    If you enter a value in this field, then MSS clamping for
699
                    TCP connections to the value entered above minus 40 (TCP/IP
700
                    header size) will be in effect. If you leave this field blank,
701
                    an MTU of 1492 bytes for PPPoE and 1500 bytes for all other
702
                    connection types will be assumed.</td>
703
                </tr>
704
                <tr>
705
                  <td colspan="2" valign="top" height="16"></td>
706
                </tr>
707
                <tr>
708
                  <td colspan="2" valign="top" class="listtopic">Static IP configuration</td>
709
                </tr>
710
                <tr>
711
                  <td width="100" valign="top" class="vncellreq">IP address</td>
712
                  <td class="vtable"> <input name="ipaddr" type="text" class="formfld unknown" id="ipaddr" size="20" value="<?=htmlspecialchars($pconfig['ipaddr']);?>">
713
                    /
714
                    <select name="subnet" class="formselect" id="subnet">
715
			<?php
716
			for ($i = 32; $i > 0; $i--) {
717
				if($i <> 31) {
718
					echo "<option value=\"{$i}\" ";
719
					if ($i == $pconfig['subnet']) echo "selected";
720
					echo ">" . $i . "</option>";
721
				}
722
			}
723
			?>
724
                    </select></td>
725
                </tr><?php if (isset($wancfg['ispointtopoint'])): ?>
726
                <tr>
727
                  <td valign="top" class="vncellreq">Point-to-point IP address </td>
728
                  <td class="vtable">
729
                    <input name="pointtopoint" type="text" class="formfld unknown" id="pointtopoint" size="20" value="<?=htmlspecialchars($pconfig['pointtopoint']);?>">
730
                  </td>
731
                </tr><?php endif; ?>
732
                <tr>
733
                  <td valign="top" class="vncellreq">Gateway</td>
734
                  <td class="vtable"><select name="gateway" class="formselect" id="gateway">
735
			<?php
736
			if(count($a_gateways) > 0) {
737
				foreach ($a_gateways as $gateway) {
738
					if($gateway['interface'] == "wan") {
739
			?>
740
					<option value="<?=$gateway['name'];?>" <?php if ($gateway['name'] == $pconfig['gateway']) echo "selected"; ?>>
741
					<?=htmlspecialchars($gateway['name']);?>
742
					</option>
743
			<?php
744
					}
745
				}
746
			}
747
			?>
748
			</select>Select a existing Gateway from the list or add one on the <a href="/system_gateways.php">Gateways</a> page<br>
749
                  </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">DHCP client configuration</td>
756
                </tr>
757
                <tr>
758
                  <td valign="top" class="vncell">Hostname</td>
759
                  <td class="vtable"> <input name="dhcphostname" type="text" class="formfld unknown" id="dhcphostname" size="40" value="<?=htmlspecialchars($pconfig['dhcphostname']);?>">
760
                    <br>
761
                    The value in this field is sent as the DHCP client identifier
762
                    and hostname when requesting a DHCP lease. Some ISPs may require
763
                    this (for client identification).</td>
764
                </tr>
765
                <tr>
766
                  <td width="100" valign="top" class="vncellreq">Alias IP address</td>
767
                  <td class="vtable"> <input name="alias-address" type="text" class="formfld unknown" id="alias-address" size="20" value="<?=htmlspecialchars($pconfig['alias-address']);?>">
768
                    <select name="alias-subnet" class="formselect" id="alias-subnet">
769
			<?php
770
			for ($i = 32; $i > 0; $i--) {
771
				if($i <> 31) {
772
					echo "<option value=\"{$i}\" ";
773
					if ($i == $pconfig['alias-subnet']) echo "selected";
774
					echo ">" . $i . "</option>";
775
				}
776
			}
777
			?>
778
                    </select>
779
                    The value in this field is used as a fixed alias IP address by the
780
		    DHCP client.</td>
781
                </tr>
782
                <tr>
783
                  <td colspan="2" valign="top" height="16"></td>
784
                </tr>
785
                <tr>
786
                  <td colspan="2" valign="top" class="listtopic">PPPoE configuration</td>
787
                </tr>
788
                <tr>
789
                  <td valign="top" class="vncellreq">Username</td>
790
                  <td class="vtable"><input name="username" type="text" class="formfld user" id="username" size="20" value="<?=htmlspecialchars($pconfig['username']);?>">
791
                  </td>
792
                </tr>
793
                <tr>
794
                  <td valign="top" class="vncellreq">Password</td>
795
                  <td class="vtable"><input name="password" type="password" class="formfld pwd" id="password" size="20" value="<?=htmlspecialchars($pconfig['password']);?>">
796
                  </td>
797
                </tr>
798
                <tr>
799
                  <td valign="top" class="vncell">Service name</td>
800
                  <td class="vtable"><input name="provider" type="text" class="formfld unknown" id="provider" size="20" value="<?=htmlspecialchars($pconfig['provider']);?>">
801
                    <br> <span class="vexpl">Hint: this field can usually be left
802
                    empty</span></td>
803
                </tr>
804
                <tr>
805
                  <td valign="top" class="vncell">Dial on demand</td>
806
                  <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)" >
807
                    <strong>Enable Dial-On-Demand mode</strong><br>
808
		    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>
809
                </tr>
810
                <tr>
811
                  <td valign="top" class="vncell">Idle timeout</td>
812
                  <td class="vtable">
813
                    <input name="pppoe_idletimeout" type="text" class="formfld unknown" id="pppoe_idletimeout" size="8" value="<?=htmlspecialchars($pconfig['pppoe_idletimeout']);?>"> 
814
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>
815
                </tr>
816
                <tr>
817
                  <td valign="top" class="vncell"><?=gettext("Periodic reset");?></td>
818
                  <td class="vtable">
819
                    <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 });" />
820
                    <?= gettext("enable periodic PPPoE resets"); ?>
821
                    <br />
822
                    <?php if ($pconfig['pppoe_preset']): ?>
823
                    <table id="presetwrap" cellspacing="0" cellpadding="0" width="100%">
824
                    <?php else: ?>
825
                    <table id="presetwrap" cellspacing="0" cellpadding="0" width="100%" style="display: none;">
826
                    <?php endif; ?>
827
                      <tr>
828
                        <td align="left" valign="top">
829
                          <p style="margin: 4px; padding: 4px 0 4px 0; width: 94%;">
830
                            <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 }); }" /> 
831
                            <?= gettext("provide a custom reset time"); ?>
832
                            <br />
833
                            <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 }); }" /> 
834
                            <?= gettext("select reset time from a preset"); ?>
835
                          </p>
836
                          <?php if ($pconfig['pppoe_pr_custom']): ?>
837
                          <p style="margin: 2px; padding: 4px; width: 94%;" id="pppoecustomwrap">
838
                          <?php else: ?>
839
                          <p style="margin: 2px; padding: 4px; width: 94%; display: none;" id="pppoecustomwrap">
840
                          <?php endif; ?>
841
                            <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" /> 
842
                            <?= gettext("hour (0-23)"); ?><br />
843
                            <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" /> 
844
                            <?= gettext("minute (0-59)"); ?><br />
845
                            <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']);?>" /> 
846
                            <?= gettext("reset at a specific date (mm/dd/yyyy)"); ?>
847
                            <br />&nbsp;<br />
848
                            <span class="red"><strong>Note: </strong></span>
849
                            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.
850
                          </p>
851
                          <?php if ($pconfig['pppoe_pr_preset']): ?>
852
                          <p style="margin: 2px; padding: 4px; width: 94%;" id="pppoepresetwrap">
853
                          <?php else: ?>
854
                          <p style="margin: 2px; padding: 4px; width: 94%; display: none;" id="pppoepresetwrap">
855
                          <?php endif; ?>
856
                            <input name="pppoe_pr_preset_val" type="radio" id="pppoe_monthly" value="monthly" <?php if ($pconfig['pppoe_monthly']) echo "checked=\"checked\""; ?> /> 
857
                            <?= gettext("reset at each month ('0 0 1 * *')"); ?>
858
                            <br />
859
                            <input name="pppoe_pr_preset_val" type="radio" id="pppoe_weekly" value="weekly" <?php if ($pconfig['pppoe_weekly']) echo "checked=\"checked\""; ?> /> 
860
                            <?= gettext("reset at each week ('0 0 * * 0')"); ?>
861
                            <br />
862
                            <input name="pppoe_pr_preset_val" type="radio" id="pppoe_daily" value="daily" <?php if ($pconfig['pppoe_daily']) echo "checked=\"checked\""; ?> /> 
863
                            <?= gettext("reset at each day ('0 0 * * *')"); ?>
864
                            <br />
865
                            <input name="pppoe_pr_preset_val" type="radio" id="pppoe_hourly" value="hourly" <?php if ($pconfig['pppoe_hourly']) echo "checked=\"checked\""; ?> /> 
866
                            <?= gettext("reset at each hour ('0 * * * *')"); ?>
867
                          </p>
868
                        </td>
869
                      </tr>
870
                    </table>
871
                  </td>
872
                </tr>                
873
                <tr>
874
                  <td colspan="2" valign="top" height="16"></td>
875
                </tr>
876
                <tr>
877
                  <td colspan="2" valign="top" class="listtopic">PPTP configuration</td>
878
                </tr>
879
                <tr>
880
                  <td valign="top" class="vncellreq">Username</td>
881
                  <td class="vtable"><input name="pptp_username" type="text" class="formfld user" id="pptp_username" size="20" value="<?=htmlspecialchars($pconfig['pptp_username']);?>">
882
                  </td>
883
                </tr>
884
                <tr>
885
                  <td valign="top" class="vncellreq">Password</td>
886
                  <td class="vtable"><input name="pptp_password" type="text" class="formfld pwd" id="pptp_password" size="20" 
887
value="<?=htmlspecialchars($pconfig['pptp_password']);?>">
888
                  </td>
889
                </tr>
890
                <tr>
891
                  <td width="100" valign="top" class="vncellreq">Local IP address</td>
892
                  <td class="vtable"> <input name="pptp_local" type="text" class="formfld unknown" id="pptp_local" size="20" 
893
value="<?=htmlspecialchars($pconfig['pptp_local']);?>">
894
                    /
895
                    <select name="pptp_subnet" class="formselect" id="pptp_subnet">
896
                      <?php for ($i = 31; $i > 0; $i--): ?>
897
                      <option value="<?=$i;?>" <?php if ($i == $pconfig['pptp_subnet']) echo "selected"; ?>>
898
                      <?=$i;?>
899
                      </option>
900
                      <?php endfor; ?>
901
                    </select></td>
902
                </tr>
903
                <tr>
904
                  <td width="100" valign="top" class="vncellreq">Remote IP address</td>
905
                  <td class="vtable"> <input name="pptp_remote" type="text" class="formfld unknown" id="pptp_remote" size="20" value="<?=htmlspecialchars($pconfig['pptp_remote']);?>">
906
                  </td>
907
                </tr>
908
                <tr>
909
                  <td valign="top" class="vncell">Dial on demand</td>
910
                  <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)" >
911
                    <strong>Enable Dial-On-Demand mode</strong><br>
912
		    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>
913
                </tr>
914
                <tr>
915
                  <td valign="top" class="vncell">Idle timeout</td>
916
                  <td class="vtable">
917
                    <input name="pptp_idletimeout" type="text" class="formfld unknown" id="pptp_idletimeout" size="8" value="<?=htmlspecialchars($pconfig['pptp_idletimeout']);?>"> 
918
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>
919
                </tr>
920
                <tr>
921
                  <td colspan="2" valign="top" height="16"></td>
922
                </tr>
923
                <tr>
924
                  <td colspan="2" valign="top" class="listtopic">Other</td>
925
                </tr>
926
		<tr>
927
			<td width="22%" valign="top" class="vncell">FTP Helper</td>
928
			<td width="78%" class="vtable">
929
				<input name="disableftpproxy" type="checkbox" id="disableftpproxy" value="yes" <?php if ($pconfig['disableftpproxy']) echo "checked"; ?> onclick="enable_change(false)" />
930
				<strong>Disable the userland FTP-Proxy application</strong>
931
				<br />
932
			</td>
933
		</tr>
934
		        <?php
935
				/* Wireless interface? */
936
				if (isset($wancfg['wireless']))
937
					wireless_config_print();
938
			?>
939
                <tr>
940
                  <td height="16" colspan="2" valign="top"></td>
941
                </tr>
942
                <tr>
943
                  <td valign="middle">&nbsp;</td>
944
                  <td class="vtable"><a name="rfc1918"></a> <input name="blockpriv" type="checkbox" id="blockpriv" value="yes" <?php if ($pconfig['blockpriv']) echo "checked"; ?>>
945
                    <strong>Block private networks</strong><br>
946
                    When set, this option blocks traffic from IP addresses that
947
                    are reserved for private<br>
948
                    networks as per RFC 1918 (10/8, 172.16/12, 192.168/16) as
949
                    well as loopback addresses<br>
950
                    (127/8). You should generally leave this option turned on,
951
                    unless your WAN network<br>
952
                    lies in such a private address space, too.</td>
953
                </tr>
954
                <tr>
955
                  <td valign="middle">&nbsp;</td>
956
                  <td class="vtable"> <input name="blockbogons" type="checkbox" id="blockbogons" value="yes" <?php if ($pconfig['blockbogons']) echo "checked"; ?>>
957
                    <strong>Block bogon networks</strong><br>
958
                    When set, this option blocks traffic from IP addresses that
959
                    are reserved (but not RFC 1918) or not yet assigned by IANA.<br>
960
                    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>
961
		</tr>
962

    
963
                <tr>
964
                  <td width="100" valign="top">&nbsp;</td>
965
                  <td> &nbsp;<br> <input name="Submit" type="submit" class="formbtn" value="Save" onClick="enable_change_pptp(true)&&enable_change(true)">
966
                  </td>
967
                </tr>
968
              </table>
969
</form>
970
<script language="JavaScript">
971
<!--
972
type_change();
973
//-->
974
</script>
975
<?php include("fend.inc"); ?>
976
</body>
977
</html>
978

    
979

    
980
<?php
981

    
982
if ($_POST) {
983

    
984
	if (!$input_errors) {
985

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

    
988
		ob_flush();
989
		flush();
990
		sleep(1);
991

    
992
		interfaces_wan_configure();
993

    
994
		reset_carp();
995

    
996
		/* sync filter configuration */
997
		filter_configure();
998

    
999
 		/* set up static routes */
1000
		system_routing_configure();
1001

    
1002
	}
1003
}
1004

    
1005
?>
(81-81/192)