Project

General

Profile

Download (63.2 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/* $Id$ */
3
/*
4
	interfaces.php
5
	Copyright (C) 2007 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
if ($_REQUEST['if'])
43
	$if = $_REQUEST['if'];
44
else
45
	$if = "wan";
46

    
47
define("CRON_MONTHLY_PATTERN", "0 0 1 * *");
48
define("CRON_WEEKLY_PATTERN", "0 0 * * 0");
49
define("CRON_DAILY_PATTERN", "0 0 * * *");
50
define("CRON_HOURLY_PATTERN", "0 * * * *");
51
define("CRON_PPPOE_CMD_FILE", "/etc/pppoerestart");
52
define("CRON_PPPOE_CMD", "#!/bin/sh\necho '<?php require(\"interfaces.inc\"); interfaces_wan_pppoe_restart($if); services_dyndns_reset($if); ?>' | /usr/local/bin/php -q");
53

    
54
function getMPDCRONSettings() {
55
  global $config;
56

    
57
  if (is_array($config['cron']['item'])) {
58
    for ($i = 0; $i < count($config['cron']['item']); $i++) {
59
      $item = $config['cron']['item'][$i];
60

    
61
      if (strpos($item['command'], CRON_PPPOE_CMD_FILE) !== false) {
62
        return array("ID" => $i, "ITEM" => $item);
63
      }
64
    }
65
  }
66

    
67
  return NULL;
68
}
69

    
70
function getMPDResetTimeFromConfig() {
71
  $itemhash = getMPDCRONSettings();
72
  $cronitem = $itemhash['ITEM'];
73

    
74
  if (isset($cronitem)) {
75

    
76
    return "{$cronitem['minute']} {$cronitem['hour']} {$cronitem['mday']} {$cronitem['month']} {$cronitem['wday']}";
77
  } else {
78
    return NULL;
79
  }
80
}
81

    
82
function remove_bad_chars($string) {
83
        return preg_replace('/[^a-z|_|0-9]/i','',$string);
84
}
85

    
86
require("guiconfig.inc");
87

    
88
if (!is_array($config['gateways']['gateway_item']))
89
	$config['gateways']['gateway_item'] = array();
90
$a_gateways = &$config['gateways']['gateway_item'];
91

    
92
$wancfg = &$config['interfaces'][$if];
93

    
94
$pconfig['pppoe_username'] = $wancfg['pppoe_username'];
95
$pconfig['pppoe_password'] = $wancfg['pppoe_password'];
96
$pconfig['provider'] = $wancfg['provider'];
97
$pconfig['pppoe_dialondemand'] = isset($wancfg['ondemand']);
98
$pconfig['pppoe_idletimeout'] = $wancfg['timeout'];
99

    
100
/* ================================================ */
101
/* = force a connection reset at a specific time? = */
102
/* ================================================ */
103

    
104
if (isset($wancfg['pppoe']['pppoe-reset-type'])) {
105
  $resetTime = getMPDResetTimeFromConfig();  
106
  $pconfig['pppoe_preset'] = true;
107
  
108
  if ($wancfg['pppoe']['pppoe-reset-type'] == "custom") {
109
    $resetTime_a = split(" ", $resetTime);
110
    $pconfig['pppoe_pr_custom'] = true;
111
    $pconfig['pppoe_resetminute'] = $resetTime_a[0];
112
    $pconfig['pppoe_resethour'] = $resetTime_a[1];
113

    
114
    /* just initialize $pconfig['pppoe_resetdate'] if the
115
     * coresponding item contains appropriate numeric values.
116
     */
117
    if ($resetTime_a[2] <> "*" && $resetTime_a[3] <> "*") {
118
      $pconfig['pppoe_resetdate'] = "{$resetTime_a[3]}/{$resetTime_a[2]}/" . date("Y");
119
    }
120
  } else if ($wancfg['pppoe']['pppoe-reset-type'] == "preset") {
121
    $pconfig['pppoe_pr_preset'] = true;
122
    
123
    switch ($resetTime) {
124
      case CRON_MONTHLY_PATTERN:
125
        $pconfig['pppoe_monthly'] = true;
126
        break;
127
      case CRON_WEEKLY_PATTERN:
128
        $pconfig['pppoe_weekly'] = true;
129
        break;
130
      case CRON_DAILY_PATTERN:
131
        $pconfig['pppoe_daily'] = true;
132
        break;
133
      case CRON_HOURLY_PATTERN:
134
        $pconfig['pppoe_hourly'] = true;
135
        break;
136
    }
137
  }
138
}
139

    
140
$pconfig['pptp_username'] = $wancfg['pptp_username'];
141
$pconfig['pptp_password'] = $wancfg['pptp_password'];
142
$pconfig['pptp_local'] = $wancfg['local'];
143
$pconfig['pptp_subnet'] = $wancfg['subnet'];
144
$pconfig['pptp_remote'] = $wancfg['remote'];
145
$pconfig['pptp_dialondemand'] = isset($wancfg['ondemand']);
146
$pconfig['pptp_idletimeout'] = $wancfg['timeout'];
147

    
148
$pconfig['disableftpproxy'] = isset($wancfg['disableftpproxy']);
149

    
150
$pconfig['dhcphostname'] = $wancfg['dhcphostname'];
151
$pconfig['alias-address'] = $wancfg['alias-address'];
152
$pconfig['alias-subnet'] = $wancfg['alias-subnet'];
153

    
154
// Populate page descr if it does not exist.
155
if($if == "wan" && !$wancfg['descr'])
156
        $wancfg['descr'] = "WAN";
157
else if ($if == "lan" && !$wancfg['descr'])
158
        $wancfg['descr'] = "LAN";
159
$pconfig['descr'] = remove_bad_chars($wancfg['descr']);
160

    
161
if ($if == "wan" || $if == "lan")
162
	$pconfig['enable'] = true;
163
else
164
	$pconfig['enable'] = isset($wancfg['enable']);
165

    
166
if (is_array($config['aliases']['alias']))
167
foreach($config['aliases']['alias'] as $alias)
168
        if($alias['name'] == $wancfg['descr'])
169
                $input_errors[] = gettext("Sorry, an alias with the name {$wancfg['descr']} a
170
lready exists.");
171

    
172
if ($wancfg['ipaddr'] == "dhcp") {
173
	$pconfig['type'] = "dhcp";
174
} else if ($wancfg['ipaddr'] == "carpdev-dhcp") {
175
	$pconfig['type'] = "carpdev-dhcp";
176
	$pconfig['ipaddr'] = "";	    
177
} else if ($wancfg['ipaddr'] == "pppoe") {
178
	$pconfig['type'] = "pppoe";
179
} else if ($wancfg['ipaddr'] == "pptp") {
180
	$pconfig['type'] = "pptp";
181
} else if ($wancfg['ipaddr'] != "") {
182
	$pconfig['type'] = "static";
183
	$pconfig['ipaddr'] = $wancfg['ipaddr'];
184
	$pconfig['subnet'] = $wancfg['subnet'];
185
	$pconfig['gateway'] = $wancfg['gateway'];
186
	$pconfig['pointtopoint'] = $wancfg['pointtopoint'];
187
} else
188
	$pconfig['type'] = "none";
189

    
190
$pconfig['blockpriv'] = isset($wancfg['blockpriv']);
191
$pconfig['blockbogons'] = isset($wancfg['blockbogons']);
192
$pconfig['spoofmac'] = $wancfg['spoofmac'];
193
$pconfig['mtu'] = $wancfg['mtu'];
194

    
195
/* Wireless interface? */
196
if (isset($wancfg['wireless'])) {
197
	/* Get wireless modes */
198
	$curif = convert_friendly_interface_to_real_interface_name($if);
199
	$wl_modes = get_wireless_modes($curif);
200
	
201
	$pconfig['standard'] = $wancfg['wireless']['standard'];
202
	$pconfig['mode'] = $wancfg['wireless']['mode'];
203
	$pconfig['protmode'] = $wancfg['wireless']['protmode'];
204
	$pconfig['ssid'] = $wancfg['wireless']['ssid'];
205
	$pconfig['channel'] = $wancfg['wireless']['channel'];
206
	$pconfig['txpower'] = $wancfg['wireless']['txpower'];
207
	$pconfig['distance'] = $wancfg['wireless']['distance'];
208
	$pconfig['wme_enable'] = isset($wancfg['wireless']['wme']['enable']);
209
	$pconfig['pureg_enable'] = isset($wancfg['wireless']['pureg']['enable']);
210
	$pconfig['apbridge_enable'] = isset($wancfg['wireless']['apbridge']['enable']);
211
	$pconfig['authmode'] = $wancfg['wireless']['authmode'];
212
	$pconfig['hidessid_enable'] = isset($wancfg['wireless']['hidessid']['enable']);
213
	if (is_array($wancfg['wireless']['wpa'])) {
214
		$pconfig['debug_mode'] = $wancfg['wireless']['wpa']['debug_mode'];
215
		$pconfig['macaddr_acl'] = $wancfg['wireless']['wpa']['macaddr_acl'];
216
		$pconfig['mac_acl_enable'] = isset($wancfg['wireless']['wpa']['mac_acl_enable']);
217
		$pconfig['auth_algs'] = $wancfg['wireless']['wpa']['auth_algs'];
218
		$pconfig['wpa_mode'] = $wancfg['wireless']['wpa']['wpa_mode'];
219
		$pconfig['wpa_key_mgmt'] = $wancfg['wireless']['wpa']['wpa_key_mgmt'];
220
		$pconfig['wpa_pairwise'] = $wancfg['wireless']['wpa']['wpa_pairwise'];
221
		$pconfig['wpa_group_rekey'] = $wancfg['wireless']['wpa']['wpa_group_rekey'];
222
		$pconfig['wpa_gmk_rekey'] = $wancfg['wireless']['wpa']['wpa_gmk_rekey'];
223
		$pconfig['wpa_strict_rekey'] = isset($wancfg['wireless']['wpa']['wpa_strict_rekey']);
224
		$pconfig['passphrase'] = $wancfg['wireless']['wpa']['passphrase'];
225
		$pconfig['ieee8021x'] = isset($wancfg['wireless']['wpa']['ieee8021x']['enable']);
226
		$pconfig['ext_wpa_sw'] = $wancfg['wireless']['wpa']['ext_wpa_sw'];
227
		$pconfig['wpa_enable'] = isset($wancfg['wireless']['wpa']['enable']);
228
	}
229
	$pconfig['wep_enable'] = isset($wancfg['wireless']['wep']['enable']);
230
	$pconfig['mac_acl'] = $wancfg['wireless']['mac_acl'];
231

    
232
	if (is_array($wancfg['wireless']['wep']) &&
233
		is_array($wancfg['wireless']['wep']['key'])) {
234
		$i = 1;
235
		foreach ($wancfg['wireless']['wep']['key'] as $wepkey) {
236
			$pconfig['key' . $i] = $wepkey['value'];
237
			if (isset($wepkey['txkey']))
238
				$pconfig['txkey'] = $i;
239
			$i++;
240
		}
241
		if (!isset($wepkey['txkey']))
242
			$pconfig['txkey'] = 1;
243
	}
244
}
245

    
246
if ($_POST['apply']) {
247

    
248
	unset($input_errors);
249
	if (!file_exists($d_landirty_path))
250
		$intput_errors[] = "You have already applied your settings!";
251
	else {	
252
               	unlink_if_exists("{$g['tmp_path']}/config.cache");
253
		unlink_if_exists("{$d_landirty_path}");
254

    
255
		/* ermal -- do not think these are needed at all.
256
                ob_flush();
257
                flush();
258
                sleep(1);
259
		*/
260

    
261
                interface_configure($if);
262

    
263
		system_start_ftp_helpers();
264

    
265
                reset_carp();
266

    
267
		if ($if == "lan") {
268
			/* restart snmp so that it binds to correct address */
269
			services_snmpd_configure();
270
			$savemsg = "The changes have been applied.  You may need to correct your web browser's IP address.";
271
		} 
272

    
273
                /* sync filter configuration */
274
		config_lock();
275
                filter_configure();
276
		config_unlock();
277

    
278
                /* set up static routes */
279
                system_routing_configure();
280
	}
281
	header("Location: interfaces.php?if={$if}");
282
	exit;
283
} else if ($_POST) {
284

    
285
	unset($input_errors);
286
	$pconfig = $_POST;
287
  
288
	/* filter out spaces from descriptions  */
289
        $_POST['descr'] = remove_bad_chars($_POST['descr']);
290

    
291
	/* okay first of all, cause we are just hidding the PPPoE HTML
292
         * fields releated to PPPoE resets, we are going to unset $_POST
293
         * vars, if the reset feature should not be used. Otherwise the
294
         * data validation procedure below, may trigger a false error
295
         * message.
296
         */        
297
	if (empty($_POST['pppoe_preset'])) {
298
                unset($_POST['pppoe_pr_type']);                
299
		unset($_POST['pppoe_resethour']);
300
                unset($_POST['pppoe_resetminute']);
301
                unset($_POST['pppoe_resetdate']);
302
                unset($_POST['pppoe_pr_preset_val']);                
303
		unlink_if_exists(CRON_PPPOE_CMD_FILE);
304
        }
305

    
306
	if ($_POST['enable'] == "yes" || $if == "wan" || $if == "lan") {
307
		/* optional interface if list */
308
                $iflist = get_configured_interface_with_descr();
309

    
310
                /* description unique? */
311
                foreach ($iflist as $ifent => $ifdescr) {
312
                        if ($if != $ifent && $ifdescr == $_POST['descr'])
313
                                $input_errors[] = "An interface with the specified description already exists.";
314

    
315
                }
316

    
317
	/* input validation */
318
	if ($_POST['type'] == "static") {
319
		$reqdfields = explode(" ", "ipaddr subnet gateway");
320
		$reqdfieldsn = explode(",", "IP address,Subnet bit count,Gateway");
321
		do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
322
	} else if ($_POST['type'] == "PPPoE") {
323
		if ($_POST['pppoe_dialondemand']) {
324
			$reqdfields = explode(" ", "pppoe_username pppoe_password pppoe_dialondemand pppoe_idletimeout");
325
			$reqdfieldsn = explode(",", "PPPoE username,PPPoE password,Dial on demand,Idle timeout value");
326
		} else {
327
			$reqdfields = explode(" ", "pppoe_username pppoe_password");
328
			$reqdfieldsn = explode(",", "PPPoE username,PPPoE password");
329
		}
330
		do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
331
	} else if ($_POST['type'] == "PPTP") {
332
		if ($_POST['pptp_dialondemand']) {
333
			$reqdfields = explode(" ", "pptp_username pptp_password pptp_local pptp_subnet pptp_remote pptp_dialondemand pptp_idletimeout");
334
			$reqdfieldsn = explode(",", "PPTP username,PPTP password,PPTP local IP address,PPTP subnet,PPTP remote IP address,Dial on demand,Idle timeout value");
335
		} else {
336
			$reqdfields = explode(" ", "pptp_username pptp_password pptp_local pptp_subnet pptp_remote");
337
			$reqdfieldsn = explode(",", "PPTP username,PPTP password,PPTP local IP address,PPTP subnet,PPTP remote IP address");
338
		}
339
		do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
340
	}
341

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

    
345
	if (($_POST['ipaddr'] && !is_ipaddr($_POST['ipaddr']))) {
346
		$input_errors[] = "A valid IP address must be specified.";
347
	}
348
	if (($_POST['subnet'] && !is_numeric($_POST['subnet']))) {
349
		$input_errors[] = "A valid subnet bit count must be specified.";
350
	}
351
	if (($_POST['alias-address'] && !is_ipaddr($_POST['alias-address']))) {
352
		$input_errors[] = "A valid alias IP address must be specified.";
353
	}
354
	if (($_POST['alias-subnet'] && !is_numeric($_POST['alias-subnet']))) {
355
		$input_errors[] = "A valid alias subnet bit count must be specified.";
356
	}
357
	if ($_POST['gateway'] != "none") {
358
		$match = false;
359
		foreach($a_gateways as $gateway) {
360
			if(in_array($_POST['gateway'], $gateway)) {
361
				$match = true;
362
			}
363
		}
364
		if(!$match)
365
			$input_errors[] = "A valid gateway must be specified.";
366
	}
367
	if (($_POST['pointtopoint'] && !is_ipaddr($_POST['pointtopoint']))) {
368
		$input_errors[] = "A valid point-to-point IP address must be specified.";
369
	}
370
	if (($_POST['provider'] && !is_domain($_POST['provider']))) {
371
		$input_errors[] = "The service name contains invalid characters.";
372
	}
373
	if (($_POST['pppoe_idletimeout'] != "") && !is_numericint($_POST['pppoe_idletimeout'])) {
374
		$input_errors[] = "The idle timeout value must be an integer.";
375
	}
376
	if ($_POST['pppoe_resethour'] <> "" && !is_numericint($_POST['pppoe_resethour']) && 
377
		$_POST['pppoe_resethour'] >= 0 && $_POST['pppoe_resethour'] <=23) {
378
		$input_errors[] = gettext("A valid PPPoE reset hour must be specified (0-23).");
379
	}
380
	if ($_POST['pppoe_resetminute'] <> "" && !is_numericint($_POST['pppoe_resetminute']) && 
381
		$_POST['pppoe_resetminute'] >= 0 && $_POST['pppoe_resetminute'] <=59) {
382
		$input_errors[] = gettext("A valid PPPoE reset minute must be specified (0-59).");
383
	}
384
	if ($_POST['pppoe_resetdate'] <> "" && !is_numeric(str_replace("/", "", $_POST['pppoe_resetdate']))) {
385
		$input_errors[] = gettext("A valid PPPoE reset date must be specified (mm/dd/yyyy).");
386
	}
387
	if (($_POST['pptp_local'] && !is_ipaddr($_POST['pptp_local']))) {
388
		$input_errors[] = "A valid PPTP local IP address must be specified.";
389
	}
390
	if (($_POST['pptp_subnet'] && !is_numeric($_POST['pptp_subnet']))) {
391
		$input_errors[] = "A valid PPTP subnet bit count must be specified.";
392
	}
393
	if (($_POST['pptp_remote'] && !is_ipaddr($_POST['pptp_remote']))) {
394
		$input_errors[] = "A valid PPTP remote IP address must be specified.";
395
	}
396
	if (($_POST['pptp_idletimeout'] != "") && !is_numericint($_POST['pptp_idletimeout'])) {
397
		$input_errors[] = "The idle timeout value must be an integer.";
398
	}
399
	if (($_POST['spoofmac'] && !is_macaddr($_POST['spoofmac']))) {
400
		$input_errors[] = "A valid MAC address must be specified.";
401
	}
402
	if ($_POST['mtu'] && ($_POST['mtu'] < 576)) {
403
		$input_errors[] = "The MTU must be greater than 576 bytes.";
404
	}
405

    
406
	/* Wireless interface? */
407
	if (isset($wancfg['wireless'])) {
408
		$reqdfields = explode(" ", "mode ssid");
409
		$reqdfieldsn = explode(",", "Mode,SSID");
410
		do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
411

    
412
		/* loop through keys and enforce size */
413
		for ($i = 1; $i <= 4; $i++) {
414
			if ($_POST['key' . $i]) {
415
				/* 64 bit */
416
				if (strlen($_POST['key' . $i]) == 5)
417
					continue;
418
				if (strlen($_POST['key' . $i]) == 10) {
419
					/* hex key */
420
					if (stristr($_POST['key' . $i], "0x") == false) {
421
						$_POST['key' . $i] = "0x" . $_POST['key' . $i];
422
					}
423
					continue;
424
				}
425
				if (strlen($_POST['key' . $i]) == 12) {
426
					/* hex key */
427
					if(stristr($_POST['key' . $i], "0x") == false) {
428
					$_POST['key' . $i] = "0x" . $_POST['key' . $i];
429
					}
430
					continue;
431
				}
432
				/* 128 bit */
433
				if (strlen($_POST['key' . $i]) == 13)
434
					continue;
435
				if (strlen($_POST['key' . $i]) == 26) {
436
					/* hex key */
437
					if (stristr($_POST['key' . $i], "0x") == false)
438
						$_POST['key' . $i] = "0x" . $_POST['key' . $i];
439
					continue;
440
				}
441
				if(strlen($_POST['key' . $i]) == 28)
442
					continue;
443
				$input_errors[] =  "Invalid wep key size.   Sizes should be 40 (64) bit keys or 104 (128) bit.";
444
				break;
445
			}
446
		}
447
	}
448

    
449
	if (!$input_errors) {
450

    
451
		unset($wancfg['ipaddr']);
452
		unset($wancfg['subnet']);
453
		unset($wancfg['gateway']);
454
		unset($wancfg['pointtopoint']);
455
		unset($wancfg['dhcphostname']);
456
		unset($wancfg['pppoe_username']);
457
		unset($wancfg['pppoe_password']);
458
		unset($wancfg['pptp_username']);
459
		unset($wancfg['pptp_password']);
460
		unset($wancfg['provider']);
461
		unset($wancfg['ondemand']);
462
		unset($wancfg['timeout']);
463
		if ($wancfg['pppoe']['pppoe-reset-type'])
464
			unset($wancfg['pppoe']['pppoe-reset-type']);
465
		unset($wancfg['local']);
466
		unset($wancfg['subnet']);
467
		unset($wancfg['remote']);
468
		unset($wancfg['disableftpproxy']);
469

    
470
		/* per interface pftpx helper */
471
		if ($_POST['disableftpproxy'] == "yes")
472
			$wancfg['disableftpproxy'] = true;
473

    
474
		$wancfg['descr'] = remove_bad_chars($_POST['descr']);
475
		if ($if == "wan" || $if == "lan")
476
			$wancfg['enable'] = true;
477
		else
478
			$wancfg['enable'] =  $_POST['enable']  == "yes" ? true : false;
479

    
480
		if ($_POST['type'] == "static") {
481
			$wancfg['ipaddr'] = $_POST['ipaddr'];
482
			$wancfg['subnet'] = $_POST['subnet'];
483
			if ($_POST['gateway'] != "none")
484
				$wancfg['gateway'] = $_POST['gateway'];
485
			if (isset($wancfg['ispointtopoint']))
486
				$wancfg['pointtopoint'] = $_POST['pointtopoint'];
487
		} else if ($_POST['type'] == "dhcp") {
488
			$wancfg['ipaddr'] = "dhcp";
489
			$wancfg['dhcphostname'] = $_POST['dhcphostname'];
490
			$wancfg['alias-address'] = $_POST['alias-address'];
491
			$wancfg['alias-subnet'] = $_POST['alias-subnet'];
492
		} else if ($_POST['type'] == "carpdev-dhcp") {
493
			$wancfg['ipaddr'] = "carpdev-dhcp";
494
			$wancfg['dhcphostname'] = $_POST['dhcphostname'];
495
			$wancfg['alias-address'] = $_POST['alias-address'];
496
			$wancfg['alias-subnet'] = $_POST['alias-subnet'];			
497
		} else if ($_POST['type'] == "pppoe") {
498
			$wancfg['ipaddr'] = "pppoe";
499
			$wancfg['pppoe_username'] = $_POST['pppoe_username'];
500
			$wancfg['pppoe_password'] = $_POST['pppoe_password'];
501
			$wancfg['provider'] = $_POST['provider'];
502
			$wancfg['ondemand'] = $_POST['pppoe_dialondemand'] ? true : false;
503
			$wancfg['timeout'] = $_POST['pppoe_idletimeout'];
504
      
505
			/* perform a periodic reset? */
506
			if (isset($_POST['pppoe_preset'])) {
507
				if (! is_array($config['cron']['item'])) 
508
					$config['cron']['item'] = array(); 
509

    
510
					$itemhash = getMPDCRONSettings();
511
					$item = $itemhash['ITEM'];
512

    
513
					if (empty($item)) {
514
						$item = array();
515
					}
516

    
517
					if (isset($_POST['pppoe_pr_type']) && $_POST['pppoe_pr_type'] == "custom") {
518
						$wancfg['pppoe']['pppoe-reset-type'] = "custom";
519
						$pconfig['pppoe_pr_custom'] = true;
520

    
521
						$item['minute'] = $_POST['pppoe_resetminute'];
522
						$item['hour'] = $_POST['pppoe_resethour'];
523

    
524
						if (isset($_POST['pppoe_resetdate']) && 
525
							$_POST['pppoe_resetdate'] <> "" && 
526
							strlen($_POST['pppoe_resetdate']) == 10) {
527
							$date = explode("/", $_POST['pppoe_resetdate']);
528
							$item['mday'] = $date[1];
529
							$item['month'] = $date[0];
530
						} else {
531
							$item['mday'] = "*";
532
							$item['month'] = "*";
533
						}
534
						$item['wday'] = "*";
535
						$item['who'] = "root";
536
						$item['command'] = CRON_PPPOE_CMD_FILE;
537
					} else if (isset($_POST['pppoe_pr_type']) && $_POST['pppoe_pr_type'] = "preset") {
538
						$wancfg['pppoe']['pppoe-reset-type'] = "preset";
539
						$pconfig['pppoe_pr_preset'] = true;
540

    
541
						switch ($_POST['pppoe_pr_preset_val']) {
542
							case "monthly":
543
								$item['minute'] = "0";
544
								$item['hour'] = "0";
545
								$item['mday'] = "1";
546
								$item['month'] = "*";
547
								$item['wday'] = "*";
548
								$item['who'] = "root";
549
								$item['command'] = CRON_PPPOE_CMD_FILE;
550
								break;
551
					        	case "weekly":
552
								$item['minute'] = "0";
553
								$item['hour'] = "0";
554
								$item['mday'] = "*";
555
								$item['month'] = "*";
556
								$item['wday'] = "0";
557
								$item['who'] = "root";
558
								$item['command'] = CRON_PPPOE_CMD_FILE;
559
								break;
560
							case "daily":
561
								$item['minute'] = "0";
562
								$item['hour'] = "0";
563
								$item['mday'] = "*";
564
								$item['month'] = "*";
565
								$item['wday'] = "*";
566
								$item['who'] = "root";
567
								$item['command'] = CRON_PPPOE_CMD_FILE;
568
								break;
569
							case "hourly":
570
								$item['minute'] = "0";
571
								$item['hour'] = "*";
572
								$item['mday'] = "*";
573
								$item['month'] = "*";
574
								$item['wday'] = "*";
575
								$item['who'] = "root";
576
								$item['command'] = CRON_PPPOE_CMD_FILE;
577
								break;
578
						} // end switch
579
					} // end if
580
				if (isset($itemhash['ID'])) {
581
					$config['cron']['item'][$itemhash['ID']] = $item;
582
				} else {
583
					$config['cron']['item'][] = $item;
584
				}
585
			} // end if
586
		} else if ($_POST['type'] == "pptp") {
587
			$wancfg['ipaddr'] = "pptp";
588
			$wancfg['pptp_username'] = $_POST['pptp_username'];
589
			$wancfg['pptp_password'] = $_POST['pptp_password'];
590
			$wancfg['local'] = $_POST['pptp_local'];
591
			$wancfg['subnet'] = $_POST['pptp_subnet'];
592
			$wancfg['remote'] = $_POST['pptp_remote'];
593
			$wancfg['ondemand'] = $_POST['pptp_dialondemand'] ? true : false;
594
			$wancfg['timeout'] = $_POST['pptp_idletimeout'];
595
		}
596
    
597
		/* reset cron items if necessary */
598
		if (empty($_POST['pppoe_preset'])) {
599
			/* test whether a cron item exists and unset() it if necessary */
600
			$itemhash = getMPDCRONSettings();
601
			$item = $itemhash['ITEM'];
602
			if (isset($item))
603
				unset($config['cron']['item'][$itemhash['ID']]); 
604
		}
605

    
606
		if($_POST['blockpriv'] == "yes")
607
			$wancfg['blockpriv'] = true;
608
		else
609
			unset($wancfg['blockpriv']);
610

    
611
		if($_POST['blockbogons'] == "yes")
612
			$wancfg['blockbogons'] = true;
613
		else
614
			unset($wancfg['blockbogons']);
615

    
616
		$wancfg['spoofmac'] = $_POST['spoofmac'];
617
		$wancfg['mtu'] = $_POST['mtu'];
618

    
619
		if (isset($wancfg['wireless'])) {
620
			if (!is_array($wancfg['wireless']))
621
				$wancfg['wireless'] = array();
622
			$wancfg['wireless']['standard'] = $_POST['standard'];
623
			$wancfg['wireless']['mode'] = $_POST['mode'];
624
			$wancfg['wireless']['protmode'] = $_POST['protmode'];
625
			$wancfg['wireless']['ssid'] = $_POST['ssid'];
626
			$wancfg['wireless']['channel'] = $_POST['channel'];
627
			$wancfg['wireless']['authmode'] = $_POST['authmode'];
628
			$wancfg['wireless']['txpower'] = $_POST['txpower'];
629
			$wancfg['wireless']['distance'] = $_POST['distance'];
630
			if (!is_array($wancfg['wireless']['wpa']))
631
				$wancfg['wireless']['wpa'] = array();
632
			$wancfg['wireless']['wpa']['macaddr_acl'] = $_POST['macaddr_acl'];
633
			$wancfg['wireless']['wpa']['auth_algs'] = $_POST['auth_algs'];
634
			$wancfg['wireless']['wpa']['wpa_mode'] = $_POST['wpa_mode'];
635
			$wancfg['wireless']['wpa']['wpa_key_mgmt'] = $_POST['wpa_key_mgmt'];
636
			$wancfg['wireless']['wpa']['wpa_pairwise'] = $_POST['wpa_pairwise'];
637
			$wancfg['wireless']['wpa']['wpa_group_rekey'] = $_POST['wpa_group_rekey'];
638
			$wancfg['wireless']['wpa']['wpa_gmk_rekey'] = $_POST['wpa_gmk_rekey'];
639
			$wancfg['wireless']['wpa']['passphrase'] = $_POST['passphrase'];
640
			$wancfg['wireless']['wpa']['ext_wpa_sw'] = $_POST['ext_wpa_sw'];
641

    
642
			if ($_POST['hidessid_enable'] == "yes")
643
				$wancfg['wireless']['hidessid']['enable'] = true;
644
			else if (isset($wancfg['wireless']['hidessid']['enable']))
645
				unset($wancfg['wireless']['hidessid']['enable']);
646

    
647
			if ($_POST['mac_acl_enable'] == "yes")
648
				$wancfg['wireless']['wpa']['mac_acl_enable'] = true;
649
			else if (isset($wancfg['wireless']['wpa']['mac_acl_enable']))
650
				unset($wancfg['wireless']['wpa']['mac_acl_enable']);
651

    
652
			if ($_POST['ieee8021x'] == "yes")
653
				$wancfg['wireless']['wpa']['ieee8021x']['enable'] = true;
654
			else if (isset($wancfg['wireless']['wpa']['ieee8021x']['enable']))
655
				unset($wancfg['wireless']['wpa']['ieee8021x']['enable']);
656

    
657
			if ($_POST['wpa_strict_rekey'] == "yes")
658
				$wancfg['wireless']['wpa']['wpa_strict_rekey'] = true;
659
			else if (isset($wancfg['wireless']['wpa']['wpa_strict_rekey']))
660
				unset($wancfg['wireless']['wpa']['wpa_strict_rekey']);
661

    
662
			if ($_POST['debug_mode'] == "yes")
663
				$wancfg['wireless']['wpa']['debug_mode'] = true;
664
			else if (isset($wancfg['wireless']['wpa']['debug_mode']))
665
				unset($wancfg['wireless']['wpa']['debug_mode']);
666

    
667
			if ($_POST['wpa_enable'] == "yes")
668
				$wancfg['wireless']['wpa']['enable'] = $_POST['wpa_enable'] = true;
669
			else if (isset($wancfg['wireless']['wpa']['enable']))
670
				unset($wancfg['wireless']['wpa']['enable']);
671

    
672
			if ($_POST['wep_enable'] == "yes") {
673
				if (!is_array($wancfg['wireless']['wep']))
674
                        		$wancfg['wireless']['wep'] = array();
675
				$wancfg['wireless']['wep']['enable'] = $_POST['wep_enable'] = true;
676
			} else if (isset($wancfg['wireless']['wep']))
677
				unset($wancfg['wireless']['wep']);
678

    
679
			if ($_POST['wme_enable'] == "yes") {
680
				if (!is_array($wancfg['wireless']['wme']))
681
                        		$wancfg['wireless']['wme'] = array();
682
				$wancfg['wireless']['wme']['enable'] = $_POST['wme_enable'] = true;
683
			} else if (isset($wancfg['wireless']['wme']['enable']))
684
				unset($wancfg['wireless']['wme']['enable']);
685

    
686
			if ($_POST['pureg_enable'] == "yes") {
687
				if (!is_array($wancfg['wireless']['pureg']))
688
                        		$wancfg['wireless']['pureg'] = array();
689
				$wancfg['wireless']['pureg']['enable'] = $_POST['pureg_enable'] = true;
690
			} else if (isset($wancfg['wireless']['pureg']['enable']))
691
				unset($wancfg['wireless']['pureg']['enable']);
692

    
693
			if ($_POST['apbridge_enable'] == "yes") {
694
				if (!is_array($wancfg['wireless']['apbridge']))
695
                        		$wancfg['wireless']['apbridge'] = array();
696
				$wancfg['wireless']['apbridge']['enable'] = $_POST['apbridge_enable'] = true;
697
			} else if (isset($wancfg['wireless']['apbridge']['enable']))
698
				unset($wancfg['wireless']['apbridge']['enable']);
699

    
700
			if ($_POST['standard'] == "11a Turbo") {
701
				if (!is_array($wancfg['wireless']['turbo']))
702
                        		$wancfg['wireless']['turbo'] = array();
703
				$wancfg['wireless']['turbo']['enable'] = true;
704
			} else if (isset($wancfg['wireless']['turbo']['enable']))
705
				unset($wancfg['wireless']['turbo']['enable']);
706

    
707
			$wancfg['wireless']['wep']['key'] = array();
708

    
709
			for ($i = 1; $i <= 4; $i++) {
710
				if ($_POST['key' . $i]) {
711
					$newkey = array();
712
					$newkey['value'] = $_POST['key' . $i];
713
					if ($_POST['txkey'] == $i)
714
						$newkey['txkey'] = true;
715
					$wancfg['wireless']['wep']['key'][] = $newkey;
716
				}
717
			}
718
		}
719

    
720
		write_config();
721
	
722
		/* finally install the pppoerestart file */
723
		if (isset($_POST['pppoe_preset'])) {
724
			config_lock();
725
			conf_mount_rw();
726
      
727
			if (! file_exists(CRON_PPPOE_CMD_FILE)) {
728
				file_put_contents(CRON_PPPOE_CMD_FILE, CRON_PPPOE_CMD);
729
				chmod(CRON_PPPOE_CMD_FILE, 0700);
730
			}
731
      
732
			/* regenerate cron settings/crontab file */
733
			configure_cron();
734
			sigkillbypid("{$g['varrun_path']}/cron.pid", "HUP");
735
      
736
			conf_mount_ro();
737
			config_unlock();
738
		}
739

    
740
		touch($d_landirty_path);
741
		header("Location: interfaces.php?if={$if}");
742
		exit;
743
	} 
744
	} else {
745
		unset($wancfg['enable']);
746
		interface_bring_down($if);
747
		write_config("Interface {$_POST['descr']}({$if}) is now disabled.");
748
		touch($d_landirty_path);
749
                header("Location: interfaces.php?if={$if}");
750
                exit;
751
	}
752
}
753

    
754
$pgtitle = array("Interfaces", $pconfig['descr']);
755
$closehead = false;
756
include("head.inc");
757

    
758
        $types = array("none" => "None", "static" => "Static", "dhcp" => "DHCP", "pppoe" => "PPPoE", "pptp" => "PPTP" /* , "carpdev-dhcp" => "CarpDev"*/); 
759
?>
760

    
761
<script type="text/javascript" src="/javascript/numericupdown/js/numericupdown.js"></script>
762
<link href="/javascript/numericupdown/css/numericupdown.css" rel="stylesheet" type="text/css" />
763

    
764
<script type="text/javascript" src="/javascript/datepicker/js/datepicker.js"></script>
765
<link href="/javascript/datepicker/css/datepicker.css" rel="stylesheet" type="text/css" />
766

    
767
<script type="text/javascript" src="/javascript/scriptaculous/prototype.js"></script>
768
<script type="text/javascript" src="/javascript/scriptaculous/scriptaculous.js"></script>
769

    
770
<script type="text/javascript">
771
<!--
772

    
773
function updateType(t){
774
        switch(t) {
775
<?php
776
        /* OK, so this is sick using php to generate javascript, but it needed to be done */
777
        foreach ($types as $key => $val) {
778
                echo "          case \"{$key}\": {\n";
779
                $t = $types;
780
                foreach ($t as $k => $v) {
781
                        if ($k != $key) {
782
                                echo "                  $('{$k}').hide();\n";
783
                        }
784
                }
785
                echo "          }\n";
786
        }
787
?>
788
        }
789
        $(t).appear();
790
}
791

    
792
function show_allcfg(obj) {
793
	if (obj.checked)
794
		$('allcfg').appear();
795
	else
796
		$('allcfg').hide();
797
}
798

    
799
function show_mon_config() {
800
	document.getElementById("showmonbox").innerHTML='';
801
	aodiv = document.getElementById('showmon');
802
	aodiv.style.display = "block";
803
}
804

    
805
function openwindow(url) {
806
	var oWin = window.open(url,"pfSensePop","width=620,height=400,top=150,left=150");
807

    
808
	if (oWin==null || typeof(oWin)=="undefined") 
809
		return false;
810
	else 
811
		return true;
812
}
813

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