Project

General

Profile

Download (63.1 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
require("guiconfig.inc");
43

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

    
49
define("CRON_MONTHLY_PATTERN", "0 0 1 * *");
50
define("CRON_WEEKLY_PATTERN", "0 0 * * 0");
51
define("CRON_DAILY_PATTERN", "0 0 * * *");
52
define("CRON_HOURLY_PATTERN", "0 * * * *");
53

    
54
define("CRON_PPPOE_CMD_FILE", "/etc/pppoerestart");
55
define("CRON_PPPOE_CMD", "#!/bin/sh\necho '<?php require(\"interfaces.inc\"); interface_reconfigure($if); services_dyndns_reset($if); ?>' | /usr/local/bin/php -q");
56
define("CRON_PPPOE_CMD_FILE", "{$g['varetc_path']}/pppoe{$if}restart");
57
define("CRON_PPPOE_CMD", "#!/bin/sh\n/usr/bin/touch /tmp/filter_dirty");
58

    
59

    
60
function getMPDCRONSettings() {
61
  global $config;
62

    
63
  if (is_array($config['cron']['item'])) {
64
    for ($i = 0; $i < count($config['cron']['item']); $i++) {
65
      $item = $config['cron']['item'][$i];
66

    
67
      if (strpos($item['command'], CRON_PPPOE_CMD_FILE) !== false) {
68
        return array("ID" => $i, "ITEM" => $item);
69
      }
70
    }
71
  }
72

    
73
  return NULL;
74
}
75

    
76
function getMPDResetTimeFromConfig() {
77
  $itemhash = getMPDCRONSettings();
78
  $cronitem = $itemhash['ITEM'];
79

    
80
  if (isset($cronitem)) {
81

    
82
    return "{$cronitem['minute']} {$cronitem['hour']} {$cronitem['mday']} {$cronitem['month']} {$cronitem['wday']}";
83
  } else {
84
    return NULL;
85
  }
86
}
87

    
88
function remove_bad_chars($string) {
89
        return preg_replace('/[^a-z|_|0-9]/i','',$string);
90
}
91

    
92
if (!is_array($config['gateways']['gateway_item']))
93
	$config['gateways']['gateway_item'] = array();
94
$a_gateways = &$config['gateways']['gateway_item'];
95

    
96
$wancfg = &$config['interfaces'][$if];
97

    
98
$pconfig['pppoe_username'] = $wancfg['pppoe_username'];
99
$pconfig['pppoe_password'] = $wancfg['pppoe_password'];
100
$pconfig['provider'] = $wancfg['provider'];
101
$pconfig['pppoe_dialondemand'] = isset($wancfg['ondemand']);
102
$pconfig['pppoe_idletimeout'] = $wancfg['timeout'];
103

    
104
/* ================================================ */
105
/* = force a connection reset at a specific time? = */
106
/* ================================================ */
107

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

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

    
144
$pconfig['pptp_username'] = $wancfg['pptp_username'];
145
$pconfig['pptp_password'] = $wancfg['pptp_password'];
146
$pconfig['pptp_local'] = $wancfg['local'];
147
$pconfig['pptp_subnet'] = $wancfg['subnet'];
148
$pconfig['pptp_remote'] = $wancfg['remote'];
149
$pconfig['pptp_dialondemand'] = isset($wancfg['ondemand']);
150
$pconfig['pptp_idletimeout'] = $wancfg['timeout'];
151

    
152
$pconfig['disableftpproxy'] = isset($wancfg['disableftpproxy']);
153

    
154
$pconfig['dhcphostname'] = $wancfg['dhcphostname'];
155
$pconfig['alias-address'] = $wancfg['alias-address'];
156
$pconfig['alias-subnet'] = $wancfg['alias-subnet'];
157

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

    
165
if ($if == "wan" || $if == "lan")
166
	$pconfig['enable'] = true;
167
else
168
	$pconfig['enable'] = isset($wancfg['enable']);
169

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

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

    
194
$pconfig['blockpriv'] = isset($wancfg['blockpriv']);
195
$pconfig['blockbogons'] = isset($wancfg['blockbogons']);
196
$pconfig['spoofmac'] = $wancfg['spoofmac'];
197
$pconfig['mtu'] = $wancfg['mtu'];
198

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

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

    
250
if ($_POST['apply']) {
251

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

    
259
		/* ermal -- do not think these are needed at all.
260
                ob_flush();
261
                flush();
262
                sleep(1);
263
		*/
264

    
265
                interface_configure($if);
266

    
267
		system_start_ftp_helpers();
268

    
269
                reset_carp();
270

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

    
277
                /* sync filter configuration */
278
		config_lock();
279
                filter_configure();
280
		config_unlock();
281

    
282
                /* set up static routes */
283
                system_routing_configure();
284
	}
285
	header("Location: interfaces.php?if={$if}");
286
	exit;
287
} else if ($_POST) {
288

    
289
	unset($input_errors);
290
	$pconfig = $_POST;
291
  
292
	/* filter out spaces from descriptions  */
293
        $_POST['descr'] = remove_bad_chars($_POST['descr']);
294

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

    
310
	if ($_POST['enable'] == "yes" || $if == "wan" || $if == "lan") {
311
		/* optional interface if list */
312
                $iflist = get_configured_interface_with_descr();
313

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

    
319
                }
320

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

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

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

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

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

    
453
	if (!$input_errors) {
454

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

    
474
		/* per interface pftpx helper */
475
		if ($_POST['disableftpproxy'] == "yes")
476
			$wancfg['disableftpproxy'] = true;
477

    
478
		$wancfg['descr'] = remove_bad_chars($_POST['descr']);
479
		if ($if == "wan" || $if == "lan")
480
			$wancfg['enable'] = true;
481
		else
482
			$wancfg['enable'] =  $_POST['enable']  == "yes" ? true : false;
483

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

    
514
					$itemhash = getMPDCRONSettings();
515
					$item = $itemhash['ITEM'];
516

    
517
					if (empty($item)) {
518
						$item = array();
519
					}
520

    
521
					if (isset($_POST['pppoe_pr_type']) && $_POST['pppoe_pr_type'] == "custom") {
522
						$wancfg['pppoe']['pppoe-reset-type'] = "custom";
523
						$pconfig['pppoe_pr_custom'] = true;
524

    
525
						$item['minute'] = $_POST['pppoe_resetminute'];
526
						$item['hour'] = $_POST['pppoe_resethour'];
527

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

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

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

    
615
		if($_POST['blockbogons'] == "yes")
616
			$wancfg['blockbogons'] = true;
617
		else
618
			unset($wancfg['blockbogons']);
619

    
620
		$wancfg['spoofmac'] = $_POST['spoofmac'];
621
		$wancfg['mtu'] = $_POST['mtu'];
622

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

    
646
			if ($_POST['hidessid_enable'] == "yes")
647
				$wancfg['wireless']['hidessid']['enable'] = true;
648
			else if (isset($wancfg['wireless']['hidessid']['enable']))
649
				unset($wancfg['wireless']['hidessid']['enable']);
650

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

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

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

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

    
671
			if ($_POST['wpa_enable'] == "yes")
672
				$wancfg['wireless']['wpa']['enable'] = $_POST['wpa_enable'] = true;
673
			else if (isset($wancfg['wireless']['wpa']['enable']))
674
				unset($wancfg['wireless']['wpa']['enable']);
675

    
676
			if ($_POST['wep_enable'] == "yes") {
677
				if (!is_array($wancfg['wireless']['wep']))
678
                        		$wancfg['wireless']['wep'] = array();
679
				$wancfg['wireless']['wep']['enable'] = $_POST['wep_enable'] = true;
680
			} else if (isset($wancfg['wireless']['wep']))
681
				unset($wancfg['wireless']['wep']);
682

    
683
			if ($_POST['wme_enable'] == "yes") {
684
				if (!is_array($wancfg['wireless']['wme']))
685
                        		$wancfg['wireless']['wme'] = array();
686
				$wancfg['wireless']['wme']['enable'] = $_POST['wme_enable'] = true;
687
			} else if (isset($wancfg['wireless']['wme']['enable']))
688
				unset($wancfg['wireless']['wme']['enable']);
689

    
690
			if ($_POST['pureg_enable'] == "yes") {
691
				if (!is_array($wancfg['wireless']['pureg']))
692
                        		$wancfg['wireless']['pureg'] = array();
693
				$wancfg['wireless']['pureg']['enable'] = $_POST['pureg_enable'] = true;
694
			} else if (isset($wancfg['wireless']['pureg']['enable']))
695
				unset($wancfg['wireless']['pureg']['enable']);
696

    
697
			if ($_POST['apbridge_enable'] == "yes") {
698
				if (!is_array($wancfg['wireless']['apbridge']))
699
                        		$wancfg['wireless']['apbridge'] = array();
700
				$wancfg['wireless']['apbridge']['enable'] = $_POST['apbridge_enable'] = true;
701
			} else if (isset($wancfg['wireless']['apbridge']['enable']))
702
				unset($wancfg['wireless']['apbridge']['enable']);
703

    
704
			if ($_POST['standard'] == "11a Turbo") {
705
				if (!is_array($wancfg['wireless']['turbo']))
706
                        		$wancfg['wireless']['turbo'] = array();
707
				$wancfg['wireless']['turbo']['enable'] = true;
708
			} else if (isset($wancfg['wireless']['turbo']['enable']))
709
				unset($wancfg['wireless']['turbo']['enable']);
710

    
711
			$wancfg['wireless']['wep']['key'] = array();
712

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

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

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

    
758
$pgtitle = array("Interfaces", $pconfig['descr']);
759
$closehead = false;
760
include("head.inc");
761

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

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

    
768
<script type="text/javascript" src="/javascript/datepicker/js/datepicker.js"></script>
769
<link href="/javascript/datepicker/css/datepicker.css" rel="stylesheet" type="text/css" />
770

    
771
<script type="text/javascript" src="/javascript/scriptaculous/prototype.js"></script>
772
<script type="text/javascript" src="/javascript/scriptaculous/scriptaculous.js"></script>
773

    
774
<script type="text/javascript">
775
<!--
776

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

    
796
function show_allcfg(obj) {
797
	if (obj.checked)
798
		$('allcfg').appear();
799
	else
800
		$('allcfg').hide();
801
}
802

    
803
function show_mon_config() {
804
	document.getElementById("showmonbox").innerHTML='';
805
	aodiv = document.getElementById('showmon');
806
	aodiv.style.display = "block";
807
}
808

    
809
function openwindow(url) {
810
	var oWin = window.open(url,"pfSensePop","width=620,height=400,top=150,left=150");
811

    
812
	if (oWin==null || typeof(oWin)=="undefined") 
813
		return false;
814
	else 
815
		return true;
816
}
817

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