Project

General

Profile

Download (61.7 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/* $Id$ */
3
/*
4
	interfaces.php
5
	Copyright (C) 2004-2008 Scott Ullrich
6
	Copyright (C) 2008 Ermal Lu?i
7
	All rights reserved.
8

    
9
	originally part of m0n0wall (http://m0n0.ch/wall)
10
	Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
11
	All rights reserved.
12

    
13
	Redistribution and use in source and binary forms, with or without
14
	modification, are permitted provided that the following conditions are met:
15

    
16
	1. Redistributions of source code must retain the above copyright notice,
17
	   this list of conditions and the following disclaimer.
18

    
19
	2. Redistributions in binary form must reproduce the above copyright
20
	   notice, this list of conditions and the following disclaimer in the
21
	   documentation and/or other materials provided with the distribution.
22

    
23
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
24
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
25
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
27
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32
	POSSIBILITY OF SUCH DAMAGE.
33
*/
34

    
35
##|+PRIV
36
##|*IDENT=page-interfaces
37
##|*NAME=Interfaces: WAN page
38
##|*DESCR=Allow access to the 'Interfaces' page.
39
##|*MATCH=interfaces.php*
40
##|-PRIV
41

    
42
require("guiconfig.inc");
43

    
44
if ($_REQUEST['if'])
45
	$if = $_REQUEST['if'];
46
else
47
	$if = "wan";
48

    
49
define("CRON_PPPOE_CMD_FILE", "/conf/pppoe{$if}restart");
50
define("CRON_MONTHLY_PATTERN", "0 0 1 * *");
51
define("CRON_WEEKLY_PATTERN", "0 0 * * 0");
52
define("CRON_DAILY_PATTERN", "0 0 * * *");
53
define("CRON_HOURLY_PATTERN", "0 * * * *");
54

    
55
function getMPDCRONSettings() {
56
  global $config;
57
  if (is_array($config['cron']['item'])) {
58
    for ($i = 0; $i < count($config['cron']['item']); $i++) {
59
      $item = $config['cron']['item'][$i];
60
      if (strpos($item['command'], CRON_PPPOE_CMD_FILE) !== false) {
61
        return array("ID" => $i, "ITEM" => $item);
62
      }
63
    }
64
  }
65
  return NULL;
66
}
67

    
68
function getMPDResetTimeFromConfig() {
69
	$itemhash = getMPDCRONSettings();
70
	$cronitem = $itemhash['ITEM'];
71
	if (isset($cronitem)) 
72
		return "{$cronitem['minute']} {$cronitem['hour']} {$cronitem['mday']} {$cronitem['month']} {$cronitem['wday']}";
73
	else 
74
		return NULL;
75
}
76

    
77
function remove_bad_chars($string) {
78
	return preg_replace('/[^a-z|_|0-9]/i','',$string);
79
}
80

    
81
if (!is_array($config['gateways']['gateway_item']))
82
	$config['gateways']['gateway_item'] = array();
83

    
84
$a_gateways = &$config['gateways']['gateway_item'];
85

    
86
$wancfg = &$config['interfaces'][$if];
87

    
88
$pconfig['pppoe_username'] = $wancfg['pppoe_username'];
89
$pconfig['pppoe_password'] = $wancfg['pppoe_password'];
90
$pconfig['provider'] = $wancfg['provider'];
91
$pconfig['pppoe_dialondemand'] = isset($wancfg['ondemand']);
92
$pconfig['pppoe_idletimeout'] = $wancfg['timeout'];
93

    
94
/* ================================================ */
95
/* = force a connection reset at a specific time? = */
96
/* ================================================ */
97

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

    
130
$pconfig['pptp_username'] = $wancfg['pptp_username'];
131
$pconfig['pptp_password'] = $wancfg['pptp_password'];
132
$pconfig['pptp_local'] = $wancfg['local'];
133
$pconfig['pptp_subnet'] = $wancfg['subnet'];
134
$pconfig['pptp_remote'] = $wancfg['remote'];
135
$pconfig['pptp_dialondemand'] = isset($wancfg['ondemand']);
136
$pconfig['pptp_idletimeout'] = $wancfg['timeout'];
137

    
138
$pconfig['disableftpproxy'] = isset($wancfg['disableftpproxy']);
139

    
140
$pconfig['dhcphostname'] = $wancfg['dhcphostname'];
141
$pconfig['alias-address'] = $wancfg['alias-address'];
142
$pconfig['alias-subnet'] = $wancfg['alias-subnet'];
143

    
144
// Populate page descr if it does not exist.
145
if($if == "wan" && !$wancfg['descr'])
146
	$wancfg['descr'] = "WAN";
147
else if ($if == "lan" && !$wancfg['descr'])
148
	$wancfg['descr'] = "LAN";
149
$pconfig['descr'] = remove_bad_chars($wancfg['descr']);
150

    
151
if ($if == "wan" || $if == "lan")
152
	$pconfig['enable'] = true;
153
else
154
	$pconfig['enable'] = isset($wancfg['enable']);
155

    
156
if (is_array($config['aliases']['alias']))
157
foreach($config['aliases']['alias'] as $alias)
158
	if($alias['name'] == $wancfg['descr'])
159
		$input_errors[] = gettext("Sorry, an alias with the name {$wancfg['descr']} already exists.");
160
if ($wancfg['ipaddr'] == "dhcp") {
161
	$pconfig['type'] = "dhcp";
162
} else if ($wancfg['ipaddr'] == "carpdev-dhcp") {
163
	$pconfig['type'] = "carpdev-dhcp";
164
	$pconfig['ipaddr'] = "";	    
165
} else if ($wancfg['ipaddr'] == "pppoe") {
166
	$pconfig['type'] = "pppoe";
167
} else if ($wancfg['ipaddr'] == "pptp") {
168
	$pconfig['type'] = "pptp";
169
} else if ($wancfg['ipaddr'] != "") {
170
	$pconfig['type'] = "static";
171
	$pconfig['ipaddr'] = $wancfg['ipaddr'];
172
	$pconfig['subnet'] = $wancfg['subnet'];
173
	$pconfig['gateway'] = $wancfg['gateway'];
174
	$pconfig['pointtopoint'] = $wancfg['pointtopoint'];
175
} else
176
	$pconfig['type'] = "none";
177

    
178
$pconfig['blockpriv'] = isset($wancfg['blockpriv']);
179
$pconfig['blockbogons'] = isset($wancfg['blockbogons']);
180
$pconfig['spoofmac'] = $wancfg['spoofmac'];
181
$pconfig['mtu'] = $wancfg['mtu'];
182

    
183
/* Wireless interface? */
184
if (isset($wancfg['wireless'])) {
185
	/* Get wireless modes */
186
	$curif = convert_friendly_interface_to_real_interface_name($if);
187
	$wl_modes = get_wireless_modes($curif);
188
	$pconfig['standard'] = $wancfg['wireless']['standard'];
189
	$pconfig['mode'] = $wancfg['wireless']['mode'];
190
	$pconfig['protmode'] = $wancfg['wireless']['protmode'];
191
	$pconfig['ssid'] = $wancfg['wireless']['ssid'];
192
	$pconfig['channel'] = $wancfg['wireless']['channel'];
193
	$pconfig['txpower'] = $wancfg['wireless']['txpower'];
194
	$pconfig['distance'] = $wancfg['wireless']['distance'];
195
	$pconfig['wme_enable'] = isset($wancfg['wireless']['wme']['enable']);
196
	$pconfig['pureg_enable'] = isset($wancfg['wireless']['pureg']['enable']);
197
	$pconfig['apbridge_enable'] = isset($wancfg['wireless']['apbridge']['enable']);
198
	$pconfig['authmode'] = $wancfg['wireless']['authmode'];
199
	$pconfig['hidessid_enable'] = isset($wancfg['wireless']['hidessid']['enable']);
200
	if (is_array($wancfg['wireless']['wpa'])) {
201
		$pconfig['debug_mode'] = $wancfg['wireless']['wpa']['debug_mode'];
202
		$pconfig['macaddr_acl'] = $wancfg['wireless']['wpa']['macaddr_acl'];
203
		$pconfig['mac_acl_enable'] = isset($wancfg['wireless']['wpa']['mac_acl_enable']);
204
		$pconfig['auth_algs'] = $wancfg['wireless']['wpa']['auth_algs'];
205
		$pconfig['wpa_mode'] = $wancfg['wireless']['wpa']['wpa_mode'];
206
		$pconfig['wpa_key_mgmt'] = $wancfg['wireless']['wpa']['wpa_key_mgmt'];
207
		$pconfig['wpa_pairwise'] = $wancfg['wireless']['wpa']['wpa_pairwise'];
208
		$pconfig['wpa_group_rekey'] = $wancfg['wireless']['wpa']['wpa_group_rekey'];
209
		$pconfig['wpa_gmk_rekey'] = $wancfg['wireless']['wpa']['wpa_gmk_rekey'];
210
		$pconfig['wpa_strict_rekey'] = isset($wancfg['wireless']['wpa']['wpa_strict_rekey']);
211
		$pconfig['passphrase'] = $wancfg['wireless']['wpa']['passphrase'];
212
		$pconfig['ieee8021x'] = isset($wancfg['wireless']['wpa']['ieee8021x']['enable']);
213
		$pconfig['ext_wpa_sw'] = $wancfg['wireless']['wpa']['ext_wpa_sw'];
214
		$pconfig['wpa_enable'] = isset($wancfg['wireless']['wpa']['enable']);
215
	}
216
	$pconfig['wep_enable'] = isset($wancfg['wireless']['wep']['enable']);
217
	$pconfig['mac_acl'] = $wancfg['wireless']['mac_acl'];
218
	if (is_array($wancfg['wireless']['wep']) && is_array($wancfg['wireless']['wep']['key'])) {
219
		$i = 1;
220
		foreach ($wancfg['wireless']['wep']['key'] as $wepkey) {
221
			$pconfig['key' . $i] = $wepkey['value'];
222
			if (isset($wepkey['txkey']))
223
				$pconfig['txkey'] = $i;
224
			$i++;
225
		}
226
		if (!isset($wepkey['txkey']))
227
			$pconfig['txkey'] = 1;
228
	}
229
}
230

    
231
if ($_POST['apply']) {
232
	unset($input_errors);
233
	if (!file_exists($d_landirty_path))
234
		$intput_errors[] = "You have already applied your settings!";
235
	else {	
236
		unlink_if_exists("{$g['tmp_path']}/config.cache");
237
		unlink_if_exists("{$d_landirty_path}");
238
		interface_configure($if);
239
		system_start_ftp_helpers();
240
		reset_carp();
241
		if ($if == "lan") {
242
			/* restart snmp so that it binds to correct address */
243
			services_snmpd_configure();
244
			$savemsg = "The changes have been applied.  You may need to correct your web browser's IP address.";
245
		} 
246
		/* sync filter configuration */
247
		config_lock();
248
		filter_configure();
249
		config_unlock();
250
		/* set up static routes */
251
		system_routing_configure();
252
	}
253
	header("Location: interfaces.php?if={$if}");
254
	exit;
255
}
256

    
257
if ($_POST && $_POST['enable'] == "no") {
258
	unset($wancfg['enable']);
259
	interface_bring_down($if);
260
	write_config("Interface {$_POST['descr']}({$if}) is now disabled.");
261
	touch($d_landirty_path);
262
	header("Location: interfaces.php?if={$if}");
263
	exit;
264
}
265

    
266
if ($_POST) {
267
	unset($input_errors);
268
	$pconfig = $_POST;
269
	conf_mount_rw();
270
	/* filter out spaces from descriptions  */
271
	$_POST['descr'] = remove_bad_chars($_POST['descr']);
272
	/* okay first of all, cause we are just hidding the PPPoE HTML
273
	 * fields releated to PPPoE resets, we are going to unset $_POST
274
	 * vars, if the reset feature should not be used. Otherwise the
275
	 * data validation procedure below, may trigger a false error
276
	 * message.
277
	 */
278
	if (empty($_POST['pppoe_preset'])) {
279
		unset($_POST['pppoe_pr_type']);                
280
		unset($_POST['pppoe_resethour']);
281
		unset($_POST['pppoe_resetminute']);
282
		unset($_POST['pppoe_resetdate']);
283
		unset($_POST['pppoe_pr_preset_val']);
284
	}
285
	/* optional interface if list */
286
	$iflist = get_configured_interface_with_descr();
287
	/* description unique? */
288
	foreach ($iflist as $ifent => $ifdescr) {
289
		if ($if != $ifent && $ifdescr == $_POST['descr'])
290
			$input_errors[] = "An interface with the specified description already exists.";
291
	}
292
	/* input validation */
293
	if ($_POST['type'] == "static") {
294
		$reqdfields = explode(" ", "ipaddr subnet gateway");
295
		$reqdfieldsn = explode(",", "IP address,Subnet bit count,Gateway");
296
		do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
297
	} else if ($_POST['type'] == "PPPoE") {
298
		if ($_POST['pppoe_dialondemand']) {
299
			$reqdfields = explode(" ", "pppoe_username pppoe_password pppoe_dialondemand pppoe_idletimeout");
300
			$reqdfieldsn = explode(",", "PPPoE username,PPPoE password,Dial on demand,Idle timeout value");
301
		} else {
302
			$reqdfields = explode(" ", "pppoe_username pppoe_password");
303
			$reqdfieldsn = explode(",", "PPPoE username,PPPoE password");
304
		}
305
		do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
306
	} else if ($_POST['type'] == "PPTP") {
307
		if ($_POST['pptp_dialondemand']) {
308
			$reqdfields = explode(" ", "pptp_username pptp_password pptp_local pptp_subnet pptp_remote pptp_dialondemand pptp_idletimeout");
309
			$reqdfieldsn = explode(",", "PPTP username,PPTP password,PPTP local IP address,PPTP subnet,PPTP remote IP address,Dial on demand,Idle timeout value");
310
		} else {
311
			$reqdfields = explode(" ", "pptp_username pptp_password pptp_local pptp_subnet pptp_remote");
312
			$reqdfieldsn = explode(",", "PPTP username,PPTP password,PPTP local IP address,PPTP subnet,PPTP remote IP address");
313
		}
314
		do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
315
	}
316
	/* normalize MAC addresses - lowercase and convert Windows-ized hyphenated MACs to colon delimited */
317
	$_POST['spoofmac'] = strtolower(str_replace("-", ":", $_POST['spoofmac']));
318

    
319
	if (($_POST['ipaddr'] && !is_ipaddr($_POST['ipaddr']))) 
320
		$input_errors[] = "A valid IP address must be specified.";
321
	
322
	if (($_POST['subnet'] && !is_numeric($_POST['subnet']))) 
323
		$input_errors[] = "A valid subnet bit count must be specified.";
324
	
325
	if (($_POST['alias-address'] && !is_ipaddr($_POST['alias-address']))) 
326
		$input_errors[] = "A valid alias IP address must be specified.";
327
	
328
	if (($_POST['alias-subnet'] && !is_numeric($_POST['alias-subnet']))) 
329
		$input_errors[] = "A valid alias subnet bit count must be specified.";
330
	
331
	if ($_POST['gateway'] != "none") {
332
		$match = false;
333
		foreach($a_gateways as $gateway) {
334
			if(in_array($_POST['gateway'], $gateway)) {
335
				$match = true;
336
			}
337
		}
338
		if(!$match)
339
			$input_errors[] = "A valid gateway must be specified.";
340
	}
341
	if (($_POST['pointtopoint'] && !is_ipaddr($_POST['pointtopoint']))) 
342
		$input_errors[] = "A valid point-to-point IP address must be specified.";
343
	if (($_POST['provider'] && !is_domain($_POST['provider']))) 
344
		$input_errors[] = "The service name contains invalid characters.";
345
	if (($_POST['pppoe_idletimeout'] != "") && !is_numericint($_POST['pppoe_idletimeout'])) 
346
		$input_errors[] = "The idle timeout value must be an integer.";
347
	if ($_POST['pppoe_resethour'] <> "" && !is_numericint($_POST['pppoe_resethour']) && 
348
		$_POST['pppoe_resethour'] >= 0 && $_POST['pppoe_resethour'] <=23) 
349
			$input_errors[] = gettext("A valid PPPoE reset hour must be specified (0-23).");
350
	if ($_POST['pppoe_resetminute'] <> "" && !is_numericint($_POST['pppoe_resetminute']) && 
351
		$_POST['pppoe_resetminute'] >= 0 && $_POST['pppoe_resetminute'] <=59) 
352
			$input_errors[] = gettext("A valid PPPoE reset minute must be specified (0-59).");
353
	if ($_POST['pppoe_resetdate'] <> "" && !is_numeric(str_replace("/", "", $_POST['pppoe_resetdate']))) 
354
		$input_errors[] = gettext("A valid PPPoE reset date must be specified (mm/dd/yyyy).");
355
	if (($_POST['pptp_local'] && !is_ipaddr($_POST['pptp_local']))) 
356
		$input_errors[] = "A valid PPTP local IP address must be specified.";
357
	if (($_POST['pptp_subnet'] && !is_numeric($_POST['pptp_subnet']))) 
358
		$input_errors[] = "A valid PPTP subnet bit count must be specified.";
359
	if (($_POST['pptp_remote'] && !is_ipaddr($_POST['pptp_remote']))) 
360
		$input_errors[] = "A valid PPTP remote IP address must be specified.";
361
	if (($_POST['pptp_idletimeout'] != "") && !is_numericint($_POST['pptp_idletimeout'])) 
362
		$input_errors[] = "The idle timeout value must be an integer.";
363
	if (($_POST['spoofmac'] && !is_macaddr($_POST['spoofmac']))) 
364
		$input_errors[] = "A valid MAC address must be specified.";
365
	if ($_POST['mtu'] && ($_POST['mtu'] < 576)) 
366
		$input_errors[] = "The MTU must be greater than 576 bytes.";
367
	/* Wireless interface? */
368
	if (isset($wancfg['wireless'])) {
369
		$reqdfields = explode(" ", "mode ssid");
370
		$reqdfieldsn = explode(",", "Mode,SSID");
371
		do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
372
		/* loop through keys and enforce size */
373
		for ($i = 1; $i <= 4; $i++) {
374
			if ($_POST['key' . $i]) {
375
				/* 64 bit */
376
				if (strlen($_POST['key' . $i]) == 5)
377
					continue;
378
				if (strlen($_POST['key' . $i]) == 10) {
379
					/* hex key */
380
					if (stristr($_POST['key' . $i], "0x") == false) {
381
						$_POST['key' . $i] = "0x" . $_POST['key' . $i];
382
					}
383
					continue;
384
				}
385
				if (strlen($_POST['key' . $i]) == 12) {
386
					/* hex key */
387
					if(stristr($_POST['key' . $i], "0x") == false) {
388
					$_POST['key' . $i] = "0x" . $_POST['key' . $i];
389
					}
390
					continue;
391
				}
392
				/* 128 bit */
393
				if (strlen($_POST['key' . $i]) == 13)
394
					continue;
395
				if (strlen($_POST['key' . $i]) == 26) {
396
					/* hex key */
397
					if (stristr($_POST['key' . $i], "0x") == false)
398
						$_POST['key' . $i] = "0x" . $_POST['key' . $i];
399
					continue;
400
				}
401
				if(strlen($_POST['key' . $i]) == 28)
402
					continue;
403
				$input_errors[] =  "Invalid wep key size.   Sizes should be 40 (64) bit keys or 104 (128) bit.";
404
				break;
405
			}
406
		}
407
	}
408
	if (!$input_errors) {
409
		unset($wancfg['ipaddr']);
410
		unset($wancfg['subnet']);
411
		unset($wancfg['gateway']);
412
		unset($wancfg['pointtopoint']);
413
		unset($wancfg['dhcphostname']);
414
		unset($wancfg['pppoe_username']);
415
		unset($wancfg['pppoe_password']);
416
		unset($wancfg['pptp_username']);
417
		unset($wancfg['pptp_password']);
418
		unset($wancfg['provider']);
419
		unset($wancfg['ondemand']);
420
		unset($wancfg['timeout']);
421
		if ($wancfg['pppoe']['pppoe-reset-type'])
422
			unset($wancfg['pppoe']['pppoe-reset-type']);
423
		unset($wancfg['local']);
424
		unset($wancfg['subnet']);
425
		unset($wancfg['remote']);
426
		unset($wancfg['disableftpproxy']);
427
		/* per interface pftpx helper */
428
		if ($_POST['disableftpproxy'] == "yes")
429
			$wancfg['disableftpproxy'] = true;
430
		$wancfg['descr'] = remove_bad_chars($_POST['descr']);
431
		if ($if == "wan" || $if == "lan")
432
			$wancfg['enable'] = true;
433
		else
434
			$wancfg['enable'] =  $_POST['enable']  == "yes" ? true : false;
435
		if ($_POST['type'] == "static") {
436
			$wancfg['ipaddr'] = $_POST['ipaddr'];
437
			$wancfg['subnet'] = $_POST['subnet'];
438
			if ($_POST['gateway'] != "none")
439
				$wancfg['gateway'] = $_POST['gateway'];
440
			if (isset($wancfg['ispointtopoint']))
441
				$wancfg['pointtopoint'] = $_POST['pointtopoint'];
442
		} else if ($_POST['type'] == "dhcp") {
443
			$wancfg['ipaddr'] = "dhcp";
444
			$wancfg['dhcphostname'] = $_POST['dhcphostname'];
445
			$wancfg['alias-address'] = $_POST['alias-address'];
446
			$wancfg['alias-subnet'] = $_POST['alias-subnet'];
447
		} else if ($_POST['type'] == "carpdev-dhcp") {
448
			$wancfg['ipaddr'] = "carpdev-dhcp";
449
			$wancfg['dhcphostname'] = $_POST['dhcphostname'];
450
			$wancfg['alias-address'] = $_POST['alias-address'];
451
			$wancfg['alias-subnet'] = $_POST['alias-subnet'];			
452
		} else if ($_POST['type'] == "pppoe") {
453
			$wancfg['ipaddr'] = "pppoe";
454
			$wancfg['pppoe_username'] = $_POST['pppoe_username'];
455
			$wancfg['pppoe_password'] = $_POST['pppoe_password'];
456
			$wancfg['provider'] = $_POST['provider'];
457
			$wancfg['ondemand'] = $_POST['pppoe_dialondemand'] ? true : false;
458
			$wancfg['timeout'] = $_POST['pppoe_idletimeout'];
459
		} else if ($_POST['type'] == "pptp") {
460
			$wancfg['ipaddr'] = "pptp";
461
			$wancfg['pptp_username'] = $_POST['pptp_username'];
462
			$wancfg['pptp_password'] = $_POST['pptp_password'];
463
			$wancfg['local'] = $_POST['pptp_local'];
464
			$wancfg['subnet'] = $_POST['pptp_subnet'];
465
			$wancfg['remote'] = $_POST['pptp_remote'];
466
			$wancfg['ondemand'] = $_POST['pptp_dialondemand'] ? true : false;
467
			$wancfg['timeout'] = $_POST['pptp_idletimeout'];
468
		}
469
		handle_pppoe_reset();		
470
		/* reset cron items if necessary */
471
		if (empty($_POST['pppoe_preset'])) {
472
			/* test whether a cron item exists and unset() it if necessary */
473
			$itemhash = getMPDCRONSettings();
474
			$item = $itemhash['ITEM'];
475
			if (isset($item))
476
				unset($config['cron']['item'][$itemhash['ID']]); 
477
		}
478
		if($_POST['blockpriv'] == "yes")
479
			$wancfg['blockpriv'] = true;
480
		else
481
			unset($wancfg['blockpriv']);
482
		if($_POST['blockbogons'] == "yes")
483
			$wancfg['blockbogons'] = true;
484
		else
485
			unset($wancfg['blockbogons']);
486
		$wancfg['spoofmac'] = $_POST['spoofmac'];
487
		$wancfg['mtu'] = $_POST['mtu'];
488
		if (isset($wancfg['wireless'])) 
489
			handle_wireless_post();
490
		write_config();
491
		touch($d_landirty_path);
492
		conf_mount_ro();
493
		/* regenerate cron settings/crontab file */
494
		configure_cron();
495
		header("Location: interfaces.php?if={$if}");
496
		exit;
497
	}
498
} // end if($_POST) 
499

    
500
function handle_pppoe_reset($wancfg) {
501
	global $_POST, $config, $g, $wancfg;
502
	/* perform a periodic reset? */
503
	if(!isset($_POST['pppoe_preset'])) {
504
		setup_pppoe_reset_file($if, false);		
505
		return;
506
	}
507
	if (!is_array($config['cron']['item'])) 
508
		$config['cron']['item'] = array(); 
509
	$itemhash = getMPDCRONSettings();
510
	$item = $itemhash['ITEM'];
511
	if (empty($item)) 
512
		$item = array();
513
	if (isset($_POST['pppoe_pr_type']) && $_POST['pppoe_pr_type'] == "custom") {
514
		$wancfg['pppoe']['pppoe-reset-type'] = "custom";
515
		$pconfig['pppoe_pr_custom'] = true;
516
		$item['minute'] = $_POST['pppoe_resetminute'];
517
		$item['hour'] = $_POST['pppoe_resethour'];
518
		if (isset($_POST['pppoe_resetdate']) && $_POST['pppoe_resetdate'] <> "" && strlen($_POST['pppoe_resetdate']) == 10) {
519
			$date = explode("/", $_POST['pppoe_resetdate']);
520
			$item['mday'] = $date[1];
521
			$item['month'] = $date[0];
522
		} else {
523
			$item['mday'] = "*";
524
			$item['month'] = "*";
525
		}
526
		$item['wday'] = "*";
527
		$item['who'] = "root";
528
		$item['command'] = CRON_PPPOE_CMD_FILE;
529
	} else if (isset($_POST['pppoe_pr_type']) && $_POST['pppoe_pr_type'] = "preset") {
530
		$wancfg['pppoe']['pppoe-reset-type'] = "preset";
531
		$pconfig['pppoe_pr_preset'] = true;
532
		switch ($_POST['pppoe_pr_preset_val']) {
533
			case "monthly":
534
				$item['minute'] = "0";
535
				$item['hour'] = "0";
536
				$item['mday'] = "1";
537
				$item['month'] = "*";
538
				$item['wday'] = "*";
539
				$item['who'] = "root";
540
				$item['command'] = CRON_PPPOE_CMD_FILE;
541
				break;
542
	        	case "weekly":
543
				$item['minute'] = "0";
544
				$item['hour'] = "0";
545
				$item['mday'] = "*";
546
				$item['month'] = "*";
547
				$item['wday'] = "0";
548
				$item['who'] = "root";
549
				$item['command'] = CRON_PPPOE_CMD_FILE;
550
				break;
551
			case "daily":
552
				$item['minute'] = "0";
553
				$item['hour'] = "0";
554
				$item['mday'] = "*";
555
				$item['month'] = "*";
556
				$item['wday'] = "*";
557
				$item['who'] = "root";
558
				$item['command'] = CRON_PPPOE_CMD_FILE;
559
				break;
560
			case "hourly":
561
				$item['minute'] = "0";
562
				$item['hour'] = "*";
563
				$item['mday'] = "*";
564
				$item['month'] = "*";
565
				$item['wday'] = "*";
566
				$item['who'] = "root";
567
				$item['command'] = CRON_PPPOE_CMD_FILE;
568
				break;
569
		} // end switch
570
	} // end if
571
	if (isset($itemhash['ID'])) 
572
		$config['cron']['item'][$itemhash['ID']] = $item;
573
	else 
574
		$config['cron']['item'][] = $item;
575
	/* finally install the pppoerestart file */
576
	if (isset($_POST['pppoe_preset'])) {
577
		setup_pppoe_reset_file($if, true);
578
		$wancfg['pppoe_reset'] = true;
579
		$wancfg['pppoe_preset'] = true;
580
		sigkillbypid("{$g['varrun_path']}/cron.pid", "HUP");
581
	} else {
582
		unset($wancfg['pppoe_reset']);
583
		unset($wancfg['pppoe_preset']);		
584
		setup_pppoe_reset_file($if, false);	
585
	}
586
}
587

    
588
function handle_wireless_post() {
589
	global $_POST, $config, $g, $wancfg;
590
	if (!is_array($wancfg['wireless']))
591
		$wancfg['wireless'] = array();
592
	$wancfg['wireless']['standard'] = $_POST['standard'];
593
	$wancfg['wireless']['mode'] = $_POST['mode'];
594
	$wancfg['wireless']['protmode'] = $_POST['protmode'];
595
	$wancfg['wireless']['ssid'] = $_POST['ssid'];
596
	$wancfg['wireless']['channel'] = $_POST['channel'];
597
	$wancfg['wireless']['authmode'] = $_POST['authmode'];
598
	$wancfg['wireless']['txpower'] = $_POST['txpower'];
599
	$wancfg['wireless']['distance'] = $_POST['distance'];
600
	if (!is_array($wancfg['wireless']['wpa']))
601
		$wancfg['wireless']['wpa'] = array();
602
	$wancfg['wireless']['wpa']['macaddr_acl'] = $_POST['macaddr_acl'];
603
	$wancfg['wireless']['wpa']['auth_algs'] = $_POST['auth_algs'];
604
	$wancfg['wireless']['wpa']['wpa_mode'] = $_POST['wpa_mode'];
605
	$wancfg['wireless']['wpa']['wpa_key_mgmt'] = $_POST['wpa_key_mgmt'];
606
	$wancfg['wireless']['wpa']['wpa_pairwise'] = $_POST['wpa_pairwise'];
607
	$wancfg['wireless']['wpa']['wpa_group_rekey'] = $_POST['wpa_group_rekey'];
608
	$wancfg['wireless']['wpa']['wpa_gmk_rekey'] = $_POST['wpa_gmk_rekey'];
609
	$wancfg['wireless']['wpa']['passphrase'] = $_POST['passphrase'];
610
	$wancfg['wireless']['wpa']['ext_wpa_sw'] = $_POST['ext_wpa_sw'];
611
	if ($_POST['hidessid_enable'] == "yes")
612
		$wancfg['wireless']['hidessid']['enable'] = true;
613
	else if (isset($wancfg['wireless']['hidessid']['enable']))
614
		unset($wancfg['wireless']['hidessid']['enable']);
615
	if ($_POST['mac_acl_enable'] == "yes")
616
		$wancfg['wireless']['wpa']['mac_acl_enable'] = true;
617
	else if (isset($wancfg['wireless']['wpa']['mac_acl_enable']))
618
		unset($wancfg['wireless']['wpa']['mac_acl_enable']);
619
	if ($_POST['ieee8021x'] == "yes")
620
		$wancfg['wireless']['wpa']['ieee8021x']['enable'] = true;
621
	else if (isset($wancfg['wireless']['wpa']['ieee8021x']['enable']))
622
		unset($wancfg['wireless']['wpa']['ieee8021x']['enable']);
623
	if ($_POST['wpa_strict_rekey'] == "yes")
624
		$wancfg['wireless']['wpa']['wpa_strict_rekey'] = true;
625
	else if (isset($wancfg['wireless']['wpa']['wpa_strict_rekey']))
626
		unset($wancfg['wireless']['wpa']['wpa_strict_rekey']);
627
	if ($_POST['debug_mode'] == "yes")
628
		$wancfg['wireless']['wpa']['debug_mode'] = true;
629
	else if (isset($wancfg['wireless']['wpa']['debug_mode']))
630
		sunset($wancfg['wireless']['wpa']['debug_mode']);
631
	if ($_POST['wpa_enable'] == "yes")
632
		$wancfg['wireless']['wpa']['enable'] = $_POST['wpa_enable'] = true;
633
	else if (isset($wancfg['wireless']['wpa']['enable']))
634
		unset($wancfg['wireless']['wpa']['enable']);
635
	if ($_POST['wep_enable'] == "yes") {
636
		if (!is_array($wancfg['wireless']['wep']))
637
			$wancfg['wireless']['wep'] = array();
638
		$wancfg['wireless']['wep']['enable'] = $_POST['wep_enable'] = true;
639
	} else if (isset($wancfg['wireless']['wep']))
640
		unset($wancfg['wireless']['wep']);
641
	if ($_POST['wme_enable'] == "yes") {
642
		if (!is_array($wancfg['wireless']['wme']))
643
			$wancfg['wireless']['wme'] = array();
644
		$wancfg['wireless']['wme']['enable'] = $_POST['wme_enable'] = true;
645
	} else if (isset($wancfg['wireless']['wme']['enable']))
646
		unset($wancfg['wireless']['wme']['enable']);
647
	if ($_POST['pureg_enable'] == "yes") {
648
		if (!is_array($wancfg['wireless']['pureg']))
649
			$wancfg['wireless']['pureg'] = array();
650
		$wancfg['wireless']['pureg']['enable'] = $_POST['pureg_enable'] = true;
651
	} else if (isset($wancfg['wireless']['pureg']['enable']))
652
		unset($wancfg['wireless']['pureg']['enable']);
653
	if ($_POST['apbridge_enable'] == "yes") {
654
		if (!is_array($wancfg['wireless']['apbridge']))
655
			$wancfg['wireless']['apbridge'] = array();
656
		$wancfg['wireless']['apbridge']['enable'] = $_POST['apbridge_enable'] = true;
657
	} else if (isset($wancfg['wireless']['apbridge']['enable']))
658
		unset($wancfg['wireless']['apbridge']['enable']);
659
	if ($_POST['standard'] == "11a Turbo") {
660
		if (!is_array($wancfg['wireless']['turbo']))
661
			$wancfg['wireless']['turbo'] = array();
662
		$wancfg['wireless']['turbo']['enable'] = true;
663
	} else if (isset($wancfg['wireless']['turbo']['enable']))
664
		unset($wancfg['wireless']['turbo']['enable']);
665
	$wancfg['wireless']['wep']['key'] = array();
666
	for ($i = 1; $i <= 4; $i++) {
667
		if ($_POST['key' . $i]) {
668
			$newkey = array();
669
			$newkey['value'] = $_POST['key' . $i];
670
			if ($_POST['txkey'] == $i)
671
				$newkey['txkey'] = true;
672
			$wancfg['wireless']['wep']['key'][] = $newkey;
673
		}
674
	}
675
}
676

    
677
$pgtitle = array("Interfaces", $pconfig['descr']);
678
$closehead = false;
679
include("head.inc");
680
$types = array("none" => "None", "static" => "Static", "dhcp" => "DHCP", "pppoe" => "PPPoE", "pptp" => "PPTP" /* , "carpdev-dhcp" => "CarpDev"*/); 
681

    
682
?>
683

    
684
<script type="text/javascript" src="/javascript/numericupdown/js/numericupdown.js"></script>
685
<link href="/javascript/numericupdown/css/numericupdown.css" rel="stylesheet" type="text/css" />
686

    
687
<script type="text/javascript" src="/javascript/datepicker/js/datepicker.js"></script>
688
<link href="/javascript/datepicker/css/datepicker.css" rel="stylesheet" type="text/css" />
689

    
690
<script type="text/javascript" src="/javascript/scriptaculous/prototype.js"></script>
691
<script type="text/javascript" src="/javascript/scriptaculous/scriptaculous.js"></script>
692

    
693
<script type="text/javascript">
694
<!--
695

    
696
function updateType(t){
697
        switch(t) {
698
<?php
699
        /* OK, so this is sick using php to generate javascript, but it needed to be done */
700
        foreach ($types as $key => $val) {
701
                echo "          case \"{$key}\": {\n";
702
                $t = $types;
703
                foreach ($t as $k => $v) {
704
                        if ($k != $key) {
705
                                echo "                  $('{$k}').hide();\n";
706
                        }
707
                }
708
                echo "          }\n";
709
        }
710
?>
711
        }
712
        $(t).appear();
713
}
714

    
715
function show_allcfg(obj) {
716
	if (obj.checked)
717
		$('allcfg').appear();
718
	else
719
		$('allcfg').hide();
720
}
721

    
722
function show_mon_config() {
723
	document.getElementById("showmonbox").innerHTML='';
724
	aodiv = document.getElementById('showmon');
725
	aodiv.style.display = "block";
726
}
727

    
728
function openwindow(url) {
729
	var oWin = window.open(url,"pfSensePop","width=620,height=400,top=150,left=150");
730
	if (oWin==null || typeof(oWin)=="undefined") 
731
		return false;
732
	else 
733
		return true;
734
}
735

    
736
//-->
737
</script>
738
</head>
739
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
740
<?php include("fbegin.inc"); ?>
741
            <form action="interfaces.php" method="post" name="iform" id="iform">
742
<?php if ($input_errors) print_input_errors($input_errors); ?>
743
<?php if (file_exists($d_landirty_path)): ?><p>
744
<?php print_info_box_np(gettext("The {$wancfg['descr']} configuration has been changed.<p>You must apply the changes in order for them to take effect.<p>Don't forget to adjust the DHCP Server range if needed before applying."));?><br />
745
<?php endif; ?>
746
<?php if ($savemsg) print_info_box($savemsg); ?>
747
              <table width="100%" border="0" cellpadding="6" cellspacing="0">
748
                <tr>
749
                  <td colspan="2" valign="top" class="listtopic">General configuration</td>
750
                </tr>
751
<?php if ($if != "wan" && $if != "lan"): ?>
752
                <tr>
753
                  <td width="22%" valign="top" class="vtable">&nbsp;</td>
754
                  <td width="78%" class="vtable">
755
                        <input name="enable" type="checkbox" value="yes" <?php if ($pconfig['enable'] == true) echo "checked"; ?> onClick="show_allcfg(this);">
756
                    <strong>Enable Interface</strong></td>
757
                </tr>
758
<?php endif; ?>
759
		<tr style="display:none;" name="allcfg" id="allcfg">
760
		<td colspan="2"> 
761
		<table width="100%" border="0" cellpadding="6" cellspacing="0">
762
                <tr>
763
                  <td width="22%" valign="top" class="vncell">Description</td>
764
                  <td width="78%" class="vtable">
765
                    <input name="descr" type="text" class="formfld unknown" id="descr" size="30" value="<?=htmlspecialchars($pconfig['descr']);?>">
766
                                        <br> <span class="vexpl">Enter a description (name) for the interface here.</span>
767
                  </td>
768
                </tr>
769
                <tr>
770
                  <td valign="middle" class="vncell"><strong>Type</strong></td>
771
                  <td class="vtable"> <select name="type" onChange="updateType(this.value);" class="formselect" id="type">
772
                      <?php 
773
			foreach ($types as $key => $opt) { 
774
	                      echo "<option onClick=\"updateType('{$key}');\"";
775
			      if ($key == $pconfig['type']) 
776
				echo " selected";
777
			      echo " value=\"{$key}\" >" . htmlspecialchars($opt);
778
	                      echo "</option>";
779
                      } ?>
780
                    </select></td>
781
                </tr>
782
                <tr>
783
                  <td valign="top" class="vncell">MAC address</td>
784
                  <td class="vtable"> <input name="spoofmac" type="text" class="formfld unknown" id="spoofmac" size="30" value="<?=htmlspecialchars($pconfig['spoofmac']);?>">
785
		    <?php
786
			$ip = getenv('REMOTE_ADDR');
787
			$mac = `/usr/sbin/arp -an | grep {$ip} | cut -d" " -f4`;
788
			$mac = str_replace("\n","",$mac);
789
		    ?>
790
		    <a OnClick="document.forms[0].spoofmac.value='<?=$mac?>';" href="#">Copy my MAC address</a>
791
		    <br>
792
                    This field can be used to modify (&quot;spoof&quot;) the MAC
793
                    address of the WAN interface<br>
794
                    (may be required with some cable connections)<br>
795
                    Enter a MAC address in the following format: xx:xx:xx:xx:xx:xx
796
                    or leave blank</td>
797
                </tr>
798
                <tr>
799
                  <td valign="top" class="vncell">MTU</td>
800
                  <td class="vtable"> <input name="mtu" type="text" class="formfld unknown" id="mtu" size="8" value="<?=htmlspecialchars($pconfig['mtu']);?>">
801
                    <br>
802
                    If you enter a value in this field, then MSS clamping for
803
                    TCP connections to the value entered above minus 40 (TCP/IP
804
                    header size) will be in effect. If you leave this field blank,
805
                    an MTU of 1500 bytes will be assumed.</td>
806
                </tr>
807
		<tr style="display:none;" name="none" id="none">
808
		</tr>
809
		<tr style="display:none;" name="static" id="static">
810
		<td colspan="2">
811
        <table width="100%" border="0" cellpadding="6" cellspacing="0">
812
		<tr>
813
                  <td colspan="2" valign="top" class="listtopic">Static IP configuration</td>
814
                </tr>
815
                <tr>
816
                  <td width="22%" valign="top" class="vncellreq">IP address</td>
817
                  <td width="78%" class="vtable"> <input name="ipaddr" type="text" class="formfld unknown" id="ipaddr" size="20" value="<?=htmlspecialchars($pconfig['ipaddr']);?>">
818
                    /
819
                    <select name="subnet" class="formselect" id="subnet">
820
			<?php
821
			for ($i = 32; $i > 0; $i--) {
822
				if($i <> 31) {
823
					echo "<option value=\"{$i}\" ";
824
					if ($i == $pconfig['subnet']) echo "selected";
825
					echo ">" . $i . "</option>";
826
				}
827
			}
828
			?>
829
                    </select></td>
830
                </tr><?php if (isset($wancfg['ispointtopoint'])): ?>
831
                <tr>
832
                  <td width="22%" valign="top" class="vncellreq">Point-to-point IP address </td>
833
                  <td width"78%" class="vtable">
834
                    <input name="pointtopoint" type="text" class="formfld unknown" id="pointtopoint" size="20" value="<?=htmlspecialchars($pconfig['pointtopoint']);?>">
835
                  </td>
836
                </tr><?php endif; ?>
837
                <tr>
838
                  <td width="22%" valign="top" class="vncellreq">Gateway</td>
839
                  <td width="78%" class="vtable"><select name="gateway" class="formselect" id="gateway">
840
					<option value="none" selected>None</option>
841
			<?php
842
			if(count($a_gateways) > 0) {
843
				foreach ($a_gateways as $gateway) {
844
					if($gateway['interface'] == $if) {
845
			?>
846
					<option value="<?=$gateway['name'];?>" <?php if ($gateway['name'] == $pconfig['gateway']) echo "selected"; ?>>
847
					<?=htmlspecialchars($gateway['name']);?>
848
					</option>
849
			<?php
850
					}
851
				}
852
			}
853
			?>
854
			</select>
855
			<br/>
856
			Select a existing Gateway from the list or add one on the <a href="/system_gateways.php">Gateways</a> page<br>
857
                  </td>
858
                </tr>
859
	</table>
860
	</td>
861
	</tr>
862
		<tr style="display:none;" name="dhcp" id="dhcp">
863
		<td colspan="2">
864
        <table width="100%" border="0" cellpadding="6" cellspacing="0">
865
                <tr>
866
                  <td colspan="2" valign="top" class="listtopic">DHCP client configuration</td>
867
                </tr>
868
                <tr>
869
                  <td width="22%" valign="top" class="vncell">Hostname</td>
870
                  <td width="78%" class="vtable"> <input name="dhcphostname" type="text" class="formfld unknown" id="dhcphostname" size="40" value="<?=htmlspecialchars($pconfig['dhcphostname']);?>">
871
                    <br>
872
                    The value in this field is sent as the DHCP client identifier
873
                    and hostname when requesting a DHCP lease. Some ISPs may require
874
                    this (for client identification).</td>
875
                </tr>
876
                <tr>
877
                  <td width="22%" valign="top" class="vncellreq">Alias IP address</td>
878
                  <td width="78%" class="vtable"> <input name="alias-address" type="text" class="formfld unknown" id="alias-address" size="20" value="<?=htmlspecialchars($pconfig['alias-address']);?>">
879
                    <select name="alias-subnet" class="formselect" id="alias-subnet">
880
			<?php
881
			for ($i = 32; $i > 0; $i--) {
882
				if($i <> 31) {
883
					echo "<option value=\"{$i}\" ";
884
					if ($i == $pconfig['alias-subnet']) echo "selected";
885
					echo ">" . $i . "</option>";
886
				}
887
			}
888
			?>
889
                    </select>
890
                    The value in this field is used as a fixed alias IP address by the
891
		    DHCP client.</td>
892
                </tr>
893
	</table>
894
	</td>
895
	</tr>
896
                <tr style="display:none;" name="pppoe" id="pppoe">
897
		<td colspan="2">
898
	<table width="100%" border="0" cellpadding="6" cellspacing="0">
899
                <tr>
900
                  <td colspan="2" valign="top" class="listtopic">PPPoE configuration</td>
901
                </tr>
902
		<tr>
903
                  <td width="22%" valign="top" class="vncellreq">Username</td>
904
                  <td width="78%" class="vtable"><input name="pppoe_username" type="text" class="formfld user" id="pppoe_username" size="20" value="<?=htmlspecialchars($pconfig['pppoe_username']);?>">
905
                  </td>
906
                </tr>
907
                <tr>
908
                  <td width="22%" valign="top" class="vncellreq">Password</td>
909
                  <td width="78%" class="vtable"><input name="pppoe_password" type="password" class="formfld pwd" id="pppoe_password" size="20" value="<?=htmlspecialchars($pconfig['pppoe_password']);?>">
910
                  </td>
911
                </tr>
912
                <tr>
913
                  <td width="22%" valign="top" class="vncell">Service name</td>
914
                  <td width="78%" class="vtable"><input name="provider" type="text" class="formfld unknown" id="provider" size="20" value="<?=htmlspecialchars($pconfig['provider']);?>">
915
                    <br> <span class="vexpl">Hint: this field can usually be left
916
                    empty</span></td>
917
                </tr>
918
                <tr>
919
                  <td width="22%" valign="top" class="vncell">Dial on demand</td>
920
                  <td width="78%" class="vtable"><input name="pppoe_dialondemand" type="checkbox" id="pppoe_dialondemand" value="enable" <?php if ($pconfig['pppoe_dialondemand']) echo "checked"; ?>" >
921
                    <strong>Enable Dial-On-Demand mode</strong><br>
922
		    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>
923
                </tr>
924
                <tr>
925
                  <td width="22%" valign="top" class="vncell">Idle timeout</td>
926
                  <td width="78%" class="vtable">
927
                    <input name="pppoe_idletimeout" type="text" class="formfld unknown" id="pppoe_idletimeout" size="8" value="<?=htmlspecialchars($pconfig['pppoe_idletimeout']);?>"> 
928
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>
929
                </tr>
930
                <tr>
931
                  <td width="22%" valign="top" class="vncell"><?=gettext("Periodic reset");?></td>
932
                  <td width="78%" class="vtable">
933
                    <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 });" />
934
                    <?= gettext("enable periodic PPPoE resets"); ?>
935
                    <br />
936
                    <?php if ($pconfig['pppoe_preset']): ?>
937
                    <table id="presetwrap" cellspacing="0" cellpadding="0" width="100%">
938
                    <?php else: ?>
939
                    <table id="presetwrap" cellspacing="0" cellpadding="0" width="100%" style="display: none;">
940
                    <?php endif; ?>
941
                      <tr>
942
                        <td align="left" valign="top">
943
                          <p style="margin: 4px; padding: 4px 0 4px 0; width: 94%;">
944
                            <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 }); }" /> 
945
                            <?= gettext("provide a custom reset time"); ?>
946
                            <br />
947
                            <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 }); }" /> 
948
                            <?= gettext("select reset time from a preset"); ?>
949
                          </p>
950
                          <?php if ($pconfig['pppoe_pr_custom']): ?>
951
                          <p style="margin: 2px; padding: 4px; width: 94%;" id="pppoecustomwrap">
952
                          <?php else: ?>
953
                          <p style="margin: 2px; padding: 4px; width: 94%; display: none;" id="pppoecustomwrap">
954
                          <?php endif; ?>
955
                            <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" /> 
956
                            <?= gettext("hour (0-23)"); ?><br />
957
                            <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" /> 
958
                            <?= gettext("minute (0-59)"); ?><br />
959
                            <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']);?>" /> 
960
                            <?= gettext("reset at a specific date (mm/dd/yyyy)"); ?>
961
                            <br />&nbsp;<br />
962
                            <span class="red"><strong>Note: </strong></span>
963
                            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.
964
                          </p>
965
                          <?php if ($pconfig['pppoe_pr_preset']): ?>
966
                          <p style="margin: 2px; padding: 4px; width: 94%;" id="pppoepresetwrap">
967
                          <?php else: ?>
968
                          <p style="margin: 2px; padding: 4px; width: 94%; display: none;" id="pppoepresetwrap">
969
                          <?php endif; ?>
970
                            <input name="pppoe_pr_preset_val" type="radio" id="pppoe_monthly" value="monthly" <?php if ($pconfig['pppoe_monthly']) echo "checked=\"checked\""; ?> /> 
971
                            <?= gettext("reset at each month ('0 0 1 * *')"); ?>
972
                            <br />
973
                            <input name="pppoe_pr_preset_val" type="radio" id="pppoe_weekly" value="weekly" <?php if ($pconfig['pppoe_weekly']) echo "checked=\"checked\""; ?> /> 
974
                            <?= gettext("reset at each week ('0 0 * * 0')"); ?>
975
                            <br />
976
                            <input name="pppoe_pr_preset_val" type="radio" id="pppoe_daily" value="daily" <?php if ($pconfig['pppoe_daily']) echo "checked=\"checked\""; ?> /> 
977
                            <?= gettext("reset at each day ('0 0 * * *')"); ?>
978
                            <br />
979
                            <input name="pppoe_pr_preset_val" type="radio" id="pppoe_hourly" value="hourly" <?php if ($pconfig['pppoe_hourly']) echo "checked=\"checked\""; ?> /> 
980
                            <?= gettext("reset at each hour ('0 * * * *')"); ?>
981
                          </p>
982
                        </td>
983
                      </tr>
984
                    </table>
985
                  </td>
986
                </tr>                
987
	</table>
988
		</td>
989
		</tr>
990
		<tr style="display:none;" name="pptp" id="pptp">
991
		<td colspan="2">
992
        <table width="100%" border="0" cellpadding="6" cellspacing="0">
993
                <tr>
994
                  <td colspan="2" valign="top" class="listtopic">PPTP configuration</td>
995
                </tr>
996
                <tr>
997
                  <td width="22%" valign="top" class="vncellreq">Username</td>
998
                  <td width="78%" class="vtable"><input name="pptp_username" type="text" class="formfld user" id="pptp_username" size="20" value="<?=htmlspecialchars($pconfig['pptp_username']);?>">
999
                  </td>
1000
                </tr>
1001
                <tr>
1002
                  <td width="22%" valign="top" class="vncellreq">Password</td>
1003
                  <td width="78%" class="vtable"><input name="pptp_password" type="text" class="formfld pwd" id="pptp_password" size="20" 
1004
value="<?=htmlspecialchars($pconfig['pptp_password']);?>">
1005
                  </td>
1006
                </tr>
1007
                <tr>
1008
                  <td width="22%" width="100" valign="top" class="vncellreq">Local IP address</td>
1009
                  <td width="78%" class="vtable"> <input name="pptp_local" type="text" class="formfld unknown" id="pptp_local" size="20" 
1010
value="<?=htmlspecialchars($pconfig['pptp_local']);?>">
1011
                    /
1012
                    <select name="pptp_subnet" class="formselect" id="pptp_subnet">
1013
                      <?php for ($i = 31; $i > 0; $i--): ?>
1014
                      <option value="<?=$i;?>" <?php if ($i == $pconfig['pptp_subnet']) echo "selected"; ?>>
1015
                      <?=$i;?>
1016
                      </option>
1017
                      <?php endfor; ?>
1018
                    </select></td>
1019
                </tr>
1020
                <tr>
1021
                  <td width="22%" width="100" valign="top" class="vncellreq">Remote IP address</td>
1022
                  <td width="78%" class="vtable"> <input name="pptp_remote" type="text" class="formfld unknown" id="pptp_remote" size="20" value="<?=htmlspecialchars($pconfig['pptp_remote']);?>">
1023
                  </td>
1024
                </tr>
1025
                <tr>
1026
                  <td width="22%" valign="top" class="vncell">Dial on demand</td>
1027
                  <td width="78%" class="vtable"><input name="pptp_dialondemand" type="checkbox" id="pptp_dialondemand" value="enable" <?php if ($pconfig['pptp_dialondemand']) echo "checked"; ?>" >
1028
                    <strong>Enable Dial-On-Demand mode</strong><br>
1029
		    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>
1030
                </tr>
1031
                <tr>
1032
                  <td width="22%" valign="top" class="vncell">Idle timeout</td>
1033
                  <td width="78%" class="vtable">
1034
                    <input name="pptp_idletimeout" type="text" class="formfld unknown" id="pptp_idletimeout" size="8" value="<?=htmlspecialchars($pconfig['pptp_idletimeout']);?>"> 
1035
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>
1036
                </tr>
1037
	</table>
1038
	</td>
1039
	</tr>
1040
	<tr>
1041
		<td width="100" valign="top"></td>
1042
		<td> 
1043
			<br/>
1044
			<input name="Submit" type="submit" class="formbtn" value="Save">
1045
		</td>
1046
	</tr>
1047
        <?php
1048
		/* Wireless interface? */
1049
		if (isset($wancfg['wireless'])):
1050
	?>
1051
                <tr>
1052
                  <td colspan="2" valign="top" height="16"></td>
1053
		</tr>
1054
                <tr>
1055
                  <td colspan="2" valign="top" class="listtopic">Wireless configuration</td>
1056
		</tr>
1057
		<tr>
1058
			<td valign="top" class="vncellreq">Standard</td>
1059
			<td class="vtable">
1060
			<select name="standard" class="formselect" id="standard">
1061
				<?php
1062
				foreach($wl_modes as $wl_standard => $wl_channels) {
1063
					echo "<option ";
1064
					if ($pconfig['standard'] == "$wl_standard")
1065
						echo "selected ";
1066
					echo "value=\"$wl_standard\">802.$wl_standard</option>\n";
1067
				}
1068
				?>
1069
				</select>
1070
			</td>
1071
		</tr>
1072
		<tr>
1073
			<td valign="top" class="vncellreq">Mode</td>
1074
			<td class="vtable">
1075
			<select name="mode" class="formselect" id="mode">
1076
				<option <? if ($pconfig['mode'] == 'bss') echo "selected";?> value="bss">Infrastructure (BSS)</option>
1077
				<option <? if ($pconfig['mode'] == 'adhoc') echo "selected";?> value="adhoc">Ad-hoc (IBSS)</option>
1078
				<option <? if ($pconfig['mode'] == 'hostap') echo "selected";?> value="hostap">Access Point</option>
1079
			</select>
1080
			</td>
1081
		</tr>
1082
		<tr>
1083
			<td valign="top" class="vncellreq">802.11g OFDM Protection Mode</td>
1084
			<td class="vtable">
1085
			<select name="protmode" class="formselect" id="protmode">
1086
				<option <? if ($pconfig['protmode'] == 'off') echo "selected";?> value="off">Protection mode off</option>
1087
				<option <? if ($pconfig['protmode'] == 'cts') echo "selected";?> value="cts">Protection mode CTS to self</option>
1088
				<option <? if ($pconfig['protmode'] == 'rtscts') echo "selected";?> value="rtscts">Protection mode RTS and CTS</option>
1089
			</select>
1090
			<br/>
1091
			For IEEE 802.11g, use the specified technique for protecting OFDM frames in a mixed 11b/11g network.
1092
			<br/>
1093
			</td>
1094
		</tr>
1095
		<tr>
1096
			<td valign="top" class="vncellreq">SSID</td>
1097
			<td class="vtable"><input name="ssid" type="text" class="formfld unknown" id="ssid" size="20" value="<?=htmlspecialchars($pconfig['ssid']); ?>">
1098
			</td>
1099
                </tr>
1100
		<tr>
1101
			<td valign="top" class="vncell">802.11g only</td>
1102
			<td class="vtable"><input name="pureg_enable" type="checkbox" value="yes"  class="formfld" id="pureg_enable" <? if ($pconfig['pureg_enable']) echo "checked";?>>
1103
			<br/>When operating as an access point in 802.11g mode allow only 11g-capable stations to associate (11b-only stations are not permitted to associate).
1104
			</td>
1105
		</tr>
1106
		<tr>
1107
			<td valign="top" class="vncell">Allow intra-BSS communication</td>
1108
			<td class="vtable"><input name="apbridge_enable" type="checkbox" value="yes"  class="formfld" id="apbridge_enable" <? if ($pconfig['apbridge_enable']) echo "checked";?>>
1109
			<br/>
1110
			When operating as an access point, enable this if you want to pass packets between wireless clients directly.
1111
			<br/>
1112
			Disabling the internal bridging is useful when traffic is to be processed with packet filtering.
1113
			</td>
1114
		</tr>
1115
		<tr>
1116
			<td valign="top" class="vncell">Enable WME</td>
1117
			<td class="vtable"><input name="wme_enable" type="checkbox" class="formfld" id="wme_enable" value="yes" <? if ($pconfig['wme_enable']) echo "checked";?>>
1118
			<br/>Setting this option will force the card to use WME (wireless QoS).
1119
			</td>
1120
		</tr>
1121
		<tr>
1122
			<td valign="top" class="vncell">Enable Hide SSID</td>
1123
			<td class="vtable"><input name="hidessid_enable" type="checkbox" class="formfld" id="hidessid_enable" value="yes" <? if ($pconfig['hidessid_enable']) echo "checked";?>>
1124
			<br/>
1125
			Setting this option will force the card to NOT broadcast its SSID
1126
			<br/>
1127
			(this might create problems for some clients). </td>
1128
		</tr>
1129
                <tr>
1130
			<td valign="top" class="vncellreq">Transmit power</td>
1131
			<td class="vtable">
1132
			<select name="txpower" class="formselect" id="txpower">
1133
			<?
1134
				for($x = 99; $x > 0; $x--) {
1135
					if($pconfig["txpower"] == $x)
1136
						$SELECTED = " SELECTED";
1137
					else
1138
						$SELECTED = "";
1139
					echo "<option {$SELECTED}>{$x}</option>\n";
1140
				}
1141
			?>
1142
			</select><br/>
1143
			Note: Typically only a few discreet power settings are available and the driver will use the setting closest to the specified value.  Not all adaptors support changing the transmit power setting.
1144
			</td>
1145
		</tr>
1146
                <tr>
1147
			<td valign="top" class="vncellreq">Channel</td>
1148
			<td class="vtable"><select name="channel" class="formselect" id="channel">
1149
				<option <? if ($pconfig['channel'] == 0) echo "selected"; ?> value="0">Auto</option>
1150
				<?php
1151
				foreach($wl_modes as $wl_standard => $wl_channels) {
1152
					if($wl_standard == "11g") { $wl_standard = "11b/g"; }
1153
					foreach($wl_channels as $wl_channel) {
1154
						echo "<option ";
1155
						if ($pconfig['channel'] == "$wl_channel") {
1156
							echo "selected ";
1157
						}
1158
						echo "value=\"$wl_channel\">$wl_standard - $wl_channel</option>\n";
1159
					}
1160
				}
1161
				?>
1162
			</select>
1163
			<br/>
1164
			Note: Not all channels may be supported by your card
1165
		</tr>
1166
		<tr>
1167
			<td valign="top" class="vncell">Distance setting</td>
1168
			<td class="vtable"><input name="distance" type="text" class="formfld unknown" id="distance" size="5" value="<?=htmlspecialchars($pconfig['distance']);?>">
1169
			<br/>
1170
			Note: This field can be used to tune ACK/CTS timers to fit the distance between AP and Client<br/>
1171
			(measured in Meters and works only for Atheros based cards !)
1172
			</td>
1173
		</tr>
1174
		<tr>
1175
			<td valign="top" class="vncell">WEP</td>
1176
			<td class="vtable"> <input name="wep_enable" type="checkbox" id="wep_enable" value="yes" <? if ($pconfig['wep_enable']) echo "checked"; ?>>
1177
			<strong>Enable WEP</strong>
1178
			<table border="0" cellspacing="0" cellpadding="0">
1179
		<tr>
1180
                        <td>&nbsp;</td>
1181
                        <td>&nbsp;</td>
1182
                        <td>&nbsp;TX key&nbsp;</td>
1183
		</tr>
1184
		<tr>
1185
                        <td>Key 1:&nbsp;&nbsp;</td>
1186
                        <td> <input name="key1" type="text" class="formfld unknown" id="key1" size="30" value="<?=htmlspecialchars($pconfig['key1']);?>"></td>
1187
                        <td align="center"> <input name="txkey" type="radio" value="1" <? if ($pconfig['txkey'] == 1) echo "checked";?>></td>
1188
		</tr>
1189
		<tr>
1190
                        <td>Key 2:&nbsp;&nbsp;</td>
1191
                        <td> <input name="key2" type="text" class="formfld unknown" id="key2" size="30" value="<?=htmlspecialchars($pconfig['key2']);?>"></td>
1192
                        <td align="center"> <input name="txkey" type="radio" value="2" <? if ($pconfig['txkey'] == 2) echo "checked";?>></td>
1193
		</tr>
1194
		<tr>
1195
                        <td>Key 3:&nbsp;&nbsp;</td>
1196
                        <td> <input name="key3" type="text" class="formfld unknown" id="key3" size="30" value="<?=htmlspecialchars($pconfig['key3']);?>"></td>
1197
                        <td align="center"> <input name="txkey" type="radio" value="3" <? if ($pconfig['txkey'] == 3) echo "checked";?>></td>
1198
		</tr>
1199
		<tr>
1200
                        <td>Key 4:&nbsp;&nbsp;</td>
1201
                        <td> <input name="key4" type="text" class="formfld unknown" id="key4" size="30" value="<?=htmlspecialchars($pconfig['key4']);?>"></td>
1202
                        <td align="center"> <input name="txkey" type="radio" value="4" <? if ($pconfig['txkey'] == 4) echo "checked";?>></td>
1203
		</tr>
1204
			</table>
1205
			<br/>
1206
			40 (64) bit keys may be entered as 5 ASCII characters or 10 hex digits preceded by '0x'.<br/>
1207
			104 (128) bit keys may be entered as 13 ASCII characters or 26 hex digits preceded by '0x'.
1208
		   	</td>
1209
                </tr>
1210
                <tr>
1211
			<td valign="top" class="vncell">WPA</td>
1212
			<td class="vtable"><input name="wpa_enable" type="checkbox" class="formfld" id="wpa_enable" value="yes" <? if ($pconfig['wpa_enable']) echo "checked"; ?>>
1213
			<strong>Enable WPA</strong>
1214
			<br/><br/>
1215
			<table border="0" cellspacing="0" cellpadding="0">
1216
			<tr>
1217
                        <td>&nbsp;</td>
1218
                        <td>&nbsp;WPA Pre Shared Key&nbsp;</td>
1219
			</tr>
1220
			<tr>
1221
			<td>PSK:&nbsp;&nbsp;</td>
1222
			<td><input name="passphrase" type="text" class="formfld unknown" id="passphrase" size="66" value="<?=htmlspecialchars($pconfig['passphrase']);?>"></td>
1223
			</tr>
1224
			</table>
1225
			<br/>Passphrase must be from 8 to 63 chars.
1226
			</td>
1227
	        </tr>
1228
		<tr>
1229
			<td valign="top" class="vncell">WPA Mode</td>
1230
			<td class="vtable"><select name="wpa_mode" class="formselect" id="wpa_mode">
1231
			<option <? if ($pconfig['wpa_mode'] == '1') echo "selected";?> value="1">WPA</option>
1232
			<option <? if ($pconfig['wpa_mode'] == '2') echo "selected";?> value="2">WPA2</option>
1233
			<option <? if ($pconfig['wpa_mode'] == '3') echo "selected";?> value="3">Both</option>
1234
			</select>
1235
			</td>
1236
		</tr>
1237
		<tr>
1238
			<td valign="top" class="vncell">WPA Key Management Mode</td>
1239
			<td class="vtable"><select name="wpa_key_mgmt" class="formselect" id="wpa_key_mgmt">
1240
			<option <? if ($pconfig['wpa_key_mgmt'] == 'WPA-PSK') echo "selected";?> value="WPA-PSK">Pre Shared Key</option>
1241
			<option <? if ($pconfig['wpa_key_mgmt'] == 'WPA-EAP') echo "selected";?> value="WPA-EAP">Extensible Authentication Protocol</option>
1242
			<option <? if ($pconfig['wpa_key_mgmt'] == 'WPA-PSK WPA-EAP') echo "selected";?> value="WPA-PSK WPA-EAP">Both</option>
1243
 			</select>
1244
			</td>
1245
		</tr>
1246
		<? /*
1247
		<tr>
1248
			<td valign="top" class="vncell">Enable MAC Filtering</td>
1249
			<td class="vtable"><input name="mac_acl_enable" type="checkbox" value="yes" class="formfld" id="mac_acl_enable" <? if ($pconfig['mac_acl_enable']) echo "checked"; ?>>
1250
			Setting this option will enable the use of a mac filterlist to allow/deny association based on mac address
1251
			<br/><br/>
1252
			<select name="macaddr_acl" class="formselect" id="macaddr_acl">
1253
                        <option <? if ($pconfig['macaddr_acl'] == '0') echo "selected";?> value="0">Allow</option>
1254
			<option <? if ($pconfig['macaddr_acl'] == '1') echo "selected";?> value="1">Deny</option>
1255
			<option <? if ($pconfig['macaddr_acl'] == '2') echo "selected";?> value="2">Radius</option>
1256
			</select>
1257
			<br/><br/>
1258
			Setting this to "Allow" will allow all clients in not in deny list, while "Deny" will deny all clients not in allow list.
1259
			Radius will cause allow and deny list to be searched and then query radius.</br>
1260
			</td>
1261
		</tr>
1262
		*/ ?>
1263
		<tr>
1264
			<td valign="top" class="vncell">Authentication</td>
1265
			<td class="vtable"><select name="auth_algs" class="formselect" id="auth_algs">
1266
			<option <? if ($pconfig['auth_algs'] == '1') echo "selected";?> value="1">Open System Authentication</option>
1267
			<option <? if ($pconfig['auth_algs'] == '2') echo "selected";?> value="2">Shared Key Authentication</option>
1268
			<option <? if ($pconfig['auth_algs'] == '3') echo "selected";?> value="3">Both</option>
1269
			</select>
1270
			<br/>Note: Shared Key Authentication requires WEP.</br>
1271
			</td>
1272
		</tr>
1273
		<tr>
1274
			<td valign="top" class="vncell">WPA Pairwise</td>
1275
			<td class="vtable"><select name="wpa_pairwise" class="formselect" id="wpa_pairwise">
1276
			<option <? if ($pconfig['wpa_pairwise'] == 'CCMP TKIP') echo "selected";?> value="CCMP TKIP">Both</option>
1277
			<option <? if ($pconfig['wpa_pairwise'] == 'CCMP') echo "selected";?> value="CCMP">AES</option>
1278
			<option <? if ($pconfig['wpa_pairwise'] == 'TKIP') echo "selected";?> value="TKIP">TKIP</option>
1279
			</select>
1280
			</td>
1281
		</tr>
1282
		<tr>
1283
			<td valign="top" class="vncell">Key Rotation</td>
1284
			<td class="vtable"><input name="wpa_group_rekey" type="text" class="formfld unknown" id="wpa_group_rekey" size="30" value="<? echo $pconfig['wpa_group_rekey'] ? $pconfig['wpa_group_rekey'] : "60";?>">
1285
			<br/>Allowed values are 1-9999 but should not be longer than Master Key Regeneration time.
1286
			</td>
1287
		</tr>
1288
		<tr>
1289
			<td valign="top" class="vncell">Master Key Regeneration</td>
1290
			<td class="vtable"><input name="wpa_gmk_rekey" type="text" class="formfld" id="wpa_gmk_rekey" size="30" value="<? echo $pconfig['wpa_gmk_rekey'] ? $pconfig['wpa_gmk_rekey'] : "3600";?>">
1291
			<br/>Allowed values are 1-9999 but should not be shorter than Key Rotation time.
1292
			</td>
1293
		</tr>
1294
		<tr>
1295
			<td valign="top" class="vncell">Strict Key Regeneration</td>
1296
			<td class="vtable"><input name="wpa_strict_rekey" type="checkbox" value="yes"  class="formfld" id="wpa_strict_rekey" <? if ($pconfig['wpa_strict_rekey']) echo "checked"; ?>>
1297
			<br/>Setting this option will force the AP to rekey whenever a client disassociates.
1298
			</td>
1299
		</tr>
1300
		<tr>
1301
			<td valign="top" class="vncell">Enable IEEE802.1X</td>
1302
			<td class="vtable"><input name="ieee8021x" type="checkbox" value="yes"  class="formfld" id="ieee8021x" <? if ($pconfig['ieee8021x']) echo "checked";?>>
1303
			<br/>Setting this option will enable 802.1x authentication.
1304
			</td>
1305
		</tr>
1306
	<? endif; ?>
1307
                <tr>
1308
                        <td colspan="2" valign="top" height="10"></td>
1309
                </tr>
1310
                <tr>
1311
                  <td colspan="2" valign="top" class="listtopic">Other</td>
1312
                </tr>
1313
                <tr>
1314
                        <td width="22%" valign="top" class="vncell">FTP Helper</td>
1315
                        <td width="78%" class="vtable">
1316
                                <input name="disableftpproxy" type="checkbox" id="disableftpp
1317
roxy" value="yes" <?php if ($pconfig['disableftpproxy']) echo "checked"; ?> />
1318
                                <strong>Disable the userland FTP-Proxy application</strong>
1319
                                <br />
1320
                        </td>
1321
                </tr>
1322
                <tr>
1323
                  <td height="16" colspan="2" valign="top"></td>
1324
                </tr>
1325
                <tr>
1326
                  <td valign="middle">&nbsp;</td>
1327
                  <td class="vtable"><a name="rfc1918"></a> <input name="blockpriv" type="checkbox" id="blockpriv" value="yes" <?php if ($pconfig['blockpriv']) echo "checked"; ?>>
1328
                    <strong>Block private networks</strong><br>
1329
                    When set, this option blocks traffic from IP addresses that
1330
                    are reserved for private<br>
1331
                    networks as per RFC 1918 (10/8, 172.16/12, 192.168/16) as
1332
                    well as loopback addresses<br>
1333
                    (127/8). You should generally leave this option turned on,
1334
                    unless your WAN network<br>
1335
                    lies in such a private address space, too.</td>
1336
                </tr>
1337
                <tr>
1338
                  <td valign="middle">&nbsp;</td>
1339
                  <td class="vtable"> <input name="blockbogons" type="checkbox" id="blockbogons" value="yes" <?php if ($pconfig['blockbogons']) echo "checked"; ?>>
1340
                    <strong>Block bogon networks</strong><br>
1341
                    When set, this option blocks traffic from IP addresses that
1342
                    are reserved (but not RFC 1918) or not yet assigned by IANA.<br>
1343
                    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>
1344
		</tr>
1345
    </tr>
1346
	<tr>
1347
	<td width="100" valign="top">
1348
			&nbsp;
1349
	</td>
1350
	<td>
1351
		<br/>
1352
		<input name="Submit" type="submit" class="formbtn" value="Save">
1353
		<input name="if" type="hidden" id="if" value="<?=$if;?>">
1354
	</td>
1355
	</tr>
1356
	</table>
1357
  </td>
1358
</table>
1359
</form>
1360
<script language="JavaScript">
1361
<!--
1362
<?php
1363
if ($if == "wan" || $if == "lan")
1364
	echo "\$('allcfg').appear();";
1365
else
1366
	echo "show_allcfg(document.iform.enable);";
1367
echo "updateType('{$pconfig['type']}')";
1368
?>
1369
//-->
1370
</script>
1371
<?php include("fend.inc"); ?>
1372
</body>
1373
</html>
(74-74/211)