Project

General

Profile

Download (20.8 KB) Statistics
| Branch: | Tag: | Revision:
1 ac3f8318 Espen Johansen
<? 
2 8600af6f Scott Ullrich
/* $Id$ */
3
/*
4
	interfaces_wlan.inc
5
	part of m0n0wall (http://m0n0.ch/wall)
6
	
7
	Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
8
	All rights reserved.
9
	
10
	Redistribution and use in source and binary forms, with or without
11
	modification, are permitted provided that the following conditions are met:
12
	
13
	1. Redistributions of source code must retain the above copyright notice,
14
	   this list of conditions and the following disclaimer.
15
	
16
	2. Redistributions in binary form must reproduce the above copyright
17
	   notice, this list of conditions and the following disclaimer in the
18
	   documentation and/or other materials provided with the distribution.
19
	
20
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
21
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
22
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
23
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
24
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
	POSSIBILITY OF SUCH DAMAGE.
30
*/
31
32 8f71faba Espen Johansen
$wlchannels = array(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,34,36,38,40,42,44,46,48,50,52,56,58,60,64,100,104,108,112,116,120,124,128,132,136,140,149,152,153,157,160,161,165);
33 8600af6f Scott Ullrich
34
function wireless_config_init() {
35
	global $optcfg, $pconfig;
36 8f71faba Espen Johansen
37 8600af6f Scott Ullrich
	$pconfig['standard'] = $optcfg['wireless']['standard'];
38
	$pconfig['mode'] = $optcfg['wireless']['mode'];
39
	$pconfig['ssid'] = $optcfg['wireless']['ssid'];
40
	$pconfig['stationname'] = $optcfg['wireless']['stationname'];
41
	$pconfig['channel'] = $optcfg['wireless']['channel'];
42 8f71faba Espen Johansen
	$pconfig['txpower'] = $optcfg['wireless']['txpower'];
43 d213185e Espen Johansen
	$pconfig['wme_enable'] = isset($optcfg['wireless']['wme']['enable']);
44
	$pconfig['pureg_enable'] = isset($optcfg['wireless']['pureg']['enable']);
45 ac3f8318 Espen Johansen
	$pconfig['apbridge_enable'] = isset($optcfg['wireless']['apbridge']['enable']);
46 d213185e Espen Johansen
	$pconfig['turbo_enable'] = isset($optcfg['wireless']['turbo']['enable']);
47 8f71faba Espen Johansen
	$pconfig['authmode'] = $optcfg['wireless']['authmode'];
48 d213185e Espen Johansen
	$pconfig['hidessid_enable'] = isset($optcfg['wireless']['hidessid']['enable']);
49 8f71faba Espen Johansen
	$pconfig['debug_mode'] = $optcfg['wireless']['wpa']['debug_mode'];
50
	$pconfig['macaddr_acl'] = $optcfg['wireless']['wpa']['macaddr_acl'];
51
	$pconfig['auth_algs'] = $optcfg['wireless']['wpa']['auth_algs'];
52
	$pconfig['wpa_mode'] = $optcfg['wireless']['wpa']['wpa_mode'];
53
	$pconfig['wpa_key_mgmt'] = $optcfg['wireless']['wpa']['wpa_key_mgmt'];
54
	$pconfig['wpa_pairwise'] = $optcfg['wireless']['wpa']['wpa_pairwise'];
55
	$pconfig['wpa_group_rekey'] = $optcfg['wireless']['wpa']['wpa_group_rekey'];
56
	$pconfig['wpa_gmk_rekey'] = $optcfg['wireless']['wpa']['wpa_gmk_rekey'];
57 6518f0a6 Scott Ullrich
	$pconfig['wpa_strict_rekey'] = isset($optcfg['wireless']['wpa']['wpa_strict_rekey']);
58 8f71faba Espen Johansen
	$pconfig['passphrase'] = $optcfg['wireless']['wpa']['passphrase'];
59 ac3f8318 Espen Johansen
	$pconfig['ieee8021x_enable'] = isset($optcfg['wireless']['wpa']['ieee8021x']['enable']);
60 8f71faba Espen Johansen
	$pconfig['ext_wpa_sw'] = $optcfg['wireless']['wpa']['ext_wpa_sw'];
61
	$pconfig['wpa_enable'] = isset($optcfg['wireless']['wpa']['enable']);
62 8600af6f Scott Ullrich
	$pconfig['wep_enable'] = isset($optcfg['wireless']['wep']['enable']);
63 8f71faba Espen Johansen
	$pconfig['mac_acl'] = $optcfg['wireless']['mac_acl'];
64
65 8600af6f Scott Ullrich
	if (is_array($optcfg['wireless']['wep']['key'])) {
66
		$i = 1;
67
		foreach ($optcfg['wireless']['wep']['key'] as $wepkey) {
68
			$pconfig['key' . $i] = $wepkey['value'];
69
			if (isset($wepkey['txkey']))
70
				$pconfig['txkey'] = $i;
71
			$i++;
72
		}
73
		if (!isset($wepkey['txkey']))
74
			$pconfig['txkey'] = 1;
75
	}
76
}
77
78
function wireless_config_post() {
79
	global $optcfg, $pconfig;
80
81
	unset($input_errors);
82
83
	/* input validation */
84
	if ($_POST['enable']) {
85
		$reqdfields = explode(" ", "mode ssid");
86
		$reqdfieldsn = explode(",", "Mode,SSID");
87
		do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
88
		
89
		if (!$input_errors) {
90
			/* bridge check (hostap only!) */
91
			if ($pconfig['bridge'] && ($pconfig['mode'] != "hostap"))
92
				$input_errors[] = "Bridging a wireless interface is only possible in hostap mode.";
93
		}
94
	}
95
96
	/* loop through keys and enforce size */
97
	for ($i = 1; $i <= 4; $i++) {
98
		if ($_POST['key' . $i]) {
99 192fd3d1 Scott Ullrich
			/* 64 bit */
100 ea206efb Scott Ullrich
			if(strlen($_POST['key' . $i]) == 5)
101
				continue;
102 bcf53132 Scott Ullrich
			if(strlen($_POST['key' . $i]) == 10) {
103
				/* hex key */
104
				if(stristr($_POST['key' . $i], "0x") == false) {
105
					$_POST['key' . $i] = "0x" . $_POST['key' . $i];
106
				}
107 ea206efb Scott Ullrich
				continue;
108 bcf53132 Scott Ullrich
			}
109 18547c5d Scott Ullrich
			if(strlen($_POST['key' . $i]) == 12) {
110
				/* hex key */
111
				if(stristr($_POST['key' . $i], "0x") == false) {
112
					$_POST['key' . $i] = "0x" . $_POST['key' . $i];
113
				}
114
				continue;
115
			}			
116 192fd3d1 Scott Ullrich
			/* 128 bit */
117 ea206efb Scott Ullrich
			if(strlen($_POST['key' . $i]) == 13)
118
				continue;
119 bcf53132 Scott Ullrich
			if(strlen($_POST['key' . $i]) == 26) {
120
				/* hex key */
121
				if(stristr($_POST['key' . $i], "0x") == false) {
122
					$_POST['key' . $i] = "0x" . $_POST['key' . $i];
123
				}			
124 ea206efb Scott Ullrich
				continue;
125 bcf53132 Scott Ullrich
			}
126 c33565ad Scott Ullrich
			if(strlen($_POST['key' . $i]) == 28)
127
				continue;
128 ea206efb Scott Ullrich
			$input_errors[] =  "Invalid wep key size.   Sizes should be 40 (64) bit keys or 104 (128) bit.";
129 b4197106 Scott Ullrich
			break;
130 8600af6f Scott Ullrich
		}
131
	}
132
133
	if (!$input_errors) {
134 8f71faba Espen Johansen
135 8600af6f Scott Ullrich
		$optcfg['wireless']['standard'] = $_POST['standard'];
136
		$optcfg['wireless']['mode'] = $_POST['mode'];
137
		$optcfg['wireless']['ssid'] = $_POST['ssid'];
138
		$optcfg['wireless']['stationname'] = $_POST['stationname'];
139
		$optcfg['wireless']['channel'] = $_POST['channel'];
140 20172515 Scott Ullrich
		$optcfg['wireless']['authmode'] = $_POST['authmode'];		
141 8600af6f Scott Ullrich
		$optcfg['wireless']['txpower'] = $_POST['txpower'];
142 20172515 Scott Ullrich
		
143 8f71faba Espen Johansen
		$optcfg['wireless']['wpa']['macaddr_acl'] = $_POST['macaddr_acl'];
144
		$optcfg['wireless']['wpa']['auth_algs'] = $_POST['auth_algs'];
145
		$optcfg['wireless']['wpa']['wpa_mode'] = $_POST['wpa_mode'];
146
		$optcfg['wireless']['wpa']['wpa_key_mgmt'] = $_POST['wpa_key_mgmt'];
147
		$optcfg['wireless']['wpa']['wpa_pairwise'] = $_POST['wpa_pairwise'];
148
		$optcfg['wireless']['wpa']['wpa_group_rekey'] = $_POST['wpa_group_rekey'];
149
		$optcfg['wireless']['wpa']['wpa_gmk_rekey'] = $_POST['wpa_gmk_rekey'];
150
		$optcfg['wireless']['wpa']['passphrase'] = $_POST['passphrase'];
151
		$optcfg['wireless']['wpa']['ext_wpa_sw'] = $_POST['ext_wpa_sw'];
152 fa16d51e Scott Ullrich
153 20172515 Scott Ullrich
		if($_POST['hidessid_enable'] == "yes") 
154
			$optcfg['wireless']['hidessid']['enable'] = true;
155
		else
156
			unset($optcfg['wireless']['hidessid']['enable']);
157
158
		if($_POST['ieee8021x_enable'] == "yes")
159
			$optcfg['wireless']['wpa']['ieee8021x']['enable'] = true;
160
		else
161
			unset($optcfg['wireless']['wpa']['ieee8021x']['enable']);
162
		
163
		if($_POST['wpa_strict_rekey'] == "yes")
164
			$optcfg['wireless']['wpa']['wpa_strict_rekey'] = true;
165
		else
166
			unset($optcfg['wireless']['wpa']['wpa_strict_rekey']);
167
168
		if($_POST['debug_mode'] == "yes") 
169
			$optcfg['wireless']['wpa']['debug_mode'] = true;
170
		else
171
			unset($optcfg['wireless']['wpa']['debug_mode']);
172
173
		if($_POST['wpa_enable'] == "yes") 
174 fa16d51e Scott Ullrich
			$optcfg['wireless']['wpa']['enable'] = $_POST['wpa_enable'] = true;
175
		else
176
			unset($optcfg['wireless']['wpa']['enable']);
177
178 20172515 Scott Ullrich
		if($_POST['wep_enable'] == "yes") 
179 fa16d51e Scott Ullrich
			$optcfg['wireless']['wep']['enable'] = $_POST['wep_enable'] = true;
180
		else
181
			unset($optcfg['wireless']['wep']['enable']);
182
183 20172515 Scott Ullrich
		if($_POST['wme_enable'] == "yes") 
184 fa16d51e Scott Ullrich
			$optcfg['wireless']['wme']['enable'] = $_POST['wme_enable'] = true;
185
		else
186
			unset($optcfg['wireless']['wme']['enable']);
187
188 20172515 Scott Ullrich
		if($_POST['pureg_enable'] == "yes")
189 fa16d51e Scott Ullrich
			$optcfg['wireless']['pureg']['enable'] = $_POST['pureg_enable'] = true;
190
		else
191
			unset($optcfg['wireless']['pureg']['enable']);
192
193 20172515 Scott Ullrich
		if($_POST['apbridge_enable'] == "yes") 
194 fa16d51e Scott Ullrich
			$optcfg['wireless']['apbridge']['enable'] = $_POST['apbridge_enable'] = true;
195
		else
196
			unset($optcfg['wireless']['apbridge']['enable']);
197
198 20172515 Scott Ullrich
		if($_POST['turbo_enable'] == "yes") 
199 fa16d51e Scott Ullrich
			$optcfg['wireless']['turbo']['enable'] = $_POST['turbo_enable'] = true;
200
		else
201
			unset($optcfg['wireless']['turbo']['enable']);
202
203 8600af6f Scott Ullrich
		$optcfg['wireless']['wep']['key'] = array();
204 d213185e Espen Johansen
205 8600af6f Scott Ullrich
		for ($i = 1; $i <= 4; $i++) {
206
			if ($_POST['key' . $i]) {
207
				$newkey = array();
208
				$newkey['value'] = $_POST['key' . $i];
209
				if ($_POST['txkey'] == $i)
210
					$newkey['txkey'] = true;
211
				$optcfg['wireless']['wep']['key'][] = $newkey;
212
			}
213
		}
214
	}
215
	
216
	return $input_errors;
217
}
218
219
function wireless_config_print() {
220
	global $optcfg, $pconfig, $wlchannels, $g;
221
?>
222 f881baa3 Scott Ullrich
223
<script language="JavaScript">
224
	function openwindow(url) {
225
		var oWin = window.open(url,"pfSensePop","width=620,height=400,top=150,left=150");
226
		if (oWin==null || typeof(oWin)=="undefined") {
227
			return false;
228
		} else {
229
			return true;
230
		}
231
	}
232
</script>
233 8600af6f Scott Ullrich
                <tr> 
234
                  <td colspan="2" valign="top" height="16"></td>
235 ac3f8318 Espen Johansen
		</tr>
236
237 8600af6f Scott Ullrich
                <tr> 
238
                  <td colspan="2" valign="top" class="listtopic">Wireless configuration</td>
239 ac3f8318 Espen Johansen
		</tr>
240
		<tr>
241
			<td valign="top" class="vncellreq">Standard</td>
242
			<td class="vtable">
243
			<select name="standard" class="formfld" id="standard">
244
				<option <? if ($pconfig['standard'] == '11b') echo "selected";?> value="11b">802.11b</option>
245
				<option <? if ($pconfig['standard'] == '11g') echo "selected";?> value="11g">802.11g</option>
246
				<option <? if ($pconfig['standard'] == '11a') echo "selected";?> value="11a">802.11a</option>
247
				</select>
248
			</td>
249
		</tr>
250
		<tr>
251
			<td valign="top" class="vncellreq">Mode</td>
252
			<td class="vtable">
253
			<select name="mode" class="formfld" id="mode">
254
				<option <? if ($pconfig['mode'] == 'bss') echo "selected";?> value="bss">Infrastructure (BSS)</option>
255
				<option <? if ($pconfig['mode'] == 'adhoc') echo "selected";?> value="adhoc">Ad-hoc (IBSS)</option>
256
				<option <? if ($pconfig['mode'] == 'hostap') echo "selected";?> value="hostap">Access Point</option>
257
			</select>
258
			</td>
259
		</tr>
260
		<tr>
261 d213185e Espen Johansen
			<td valign="top" class="vncellreq">SSID</td>
262
			<td class="vtable"><?=$mandfldhtml;?><input name="ssid" type="text" class="formfld" id="ssid" size="20" value="<?=htmlspecialchars($pconfig['ssid']);?>">
263
			</td>
264 8600af6f Scott Ullrich
                </tr>
265 d213185e Espen Johansen
		<tr>
266 8f71faba Espen Johansen
			<td valign="top" class="vncell">802.11g only</td>
267 20172515 Scott Ullrich
			<td class="vtable"><input name="pureg_enable" type="checkbox" value="yes"  class="formfld" id="pureg_enable" value="yes" <? if ($pconfig['pureg_enable']) echo "checked";?>>
268 d213185e Espen Johansen
			<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).
269
			</td>
270
		</tr>
271 ac3f8318 Espen Johansen
		<tr>
272
			<td valign="top" class="vncell">Allow intra-BSS communication</td>
273 20172515 Scott Ullrich
			<td class="vtable"><input name="apbridge_enable" type="checkbox" value="yes"  class="formfld" id="apbridge_enable" value="yes" <? if ($pconfig['apbridge_enable']) echo "checked";?>>
274 ac3f8318 Espen Johansen
			<br/>
275
			When operating as an access point, enable this if you want to pass packets between wireless clients directly.
276
			<br/>
277
			Disabling the internal bridging is useful when traffic is to be processed with packet filtering.
278 8f71faba Espen Johansen
			</td>
279
		</tr>
280
		<tr>
281
			<td valign="top" class="vncell">Enable turbo mode</td>
282 20172515 Scott Ullrich
			<td class="vtable"><input name="turbo_enable" type="checkbox" value="yes"  class="formfld" id="turbo_enable" value="yes" <? if ($pconfig['turbo_enable']) echo "checked";?>>
283 8f71faba Espen Johansen
			<br/>Setting this option will force the card to use turbo mode.
284 eb6ce097 Espen Johansen
			<br/>use "ifconfig interface list channel" to list turbo capable channels.
285 8f71faba Espen Johansen
			</td>
286
		</tr>
287
		<tr>
288
			<td valign="top" class="vncell">Enable WME</td>
289 20172515 Scott Ullrich
			<td class="vtable"><input name="wme_enable" type="checkbox" value="yes"  class="formfld" id="wme_enable" value="yes" <? if ($pconfig['wme_enable']) echo "checked";?>>
290 8f71faba Espen Johansen
			<br/>Setting this option will force the card to use WME (wireless QoS).
291
			</td>
292
		</tr>
293
		<tr>
294
			<td valign="top" class="vncell">Enable Hide SSID</td>
295 20172515 Scott Ullrich
			<td class="vtable"><input name="hidessid_enable" type="checkbox" value="yes"  class="formfld" id="hidessid_enable" value="yes" <? if ($pconfig['hidessid_enable']) echo "checked";?>>
296 ac3f8318 Espen Johansen
			<br/>
297
			Setting this option will force the card to NOT broadcast it's SSID
298
			<br/>
299
			(this might create problems for some clients). </td>
300 8f71faba Espen Johansen
		</tr> 
301 8600af6f Scott Ullrich
                <tr> 
302 8f71faba Espen Johansen
			<td valign="top" class="vncellreq">Transmit power</td>
303
			<td class="vtable">
304 8600af6f Scott Ullrich
			<select name="txpower">
305 ac3f8318 Espen Johansen
			<?
306 60ae7b45 Scott Ullrich
				for($x = 99; $x > 0; $x--) {
307 8600af6f Scott Ullrich
					if($pconfig["txpower"] == $x)
308
						$SELECTED = " SELECTED";
309
					else
310
						$SELECTED = "";
311
					echo "<option {$SELECTED}>{$x}</option>\n";
312
				}
313 8f71faba Espen Johansen
			?>
314
			</select><br/>
315 8600af6f Scott Ullrich
			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.
316 8f71faba Espen Johansen
			</td>
317
		</tr>
318 8600af6f Scott Ullrich
                <tr> 
319
                  <td valign="top" class="vncellreq">Channel</td>
320
                  <td class="vtable"><select name="channel" class="formfld" id="channel">
321 ac3f8318 Espen Johansen
                      <option <? if ($pconfig['channel'] == 0) echo "selected";?> value="0">Auto</option>
322
                      <?
323 8600af6f Scott Ullrich
					  foreach ($wlchannels as $channel): ?>
324 ac3f8318 Espen Johansen
                      <option <? if ($channel == $pconfig['channel']) echo "selected";?> value="<?=$channel;?>">
325 8600af6f Scott Ullrich
                      <?=$channel;?>
326
                      </option>
327 ac3f8318 Espen Johansen
                      <? endforeach; ?>
328 eb6ce097 Espen Johansen
			</select>
329
			<br/>
330
			Note: Not all channels may be supported by your card
331
			<br/>
332
			use "ifconfig interface list channel" to list channels.</td>
333 8600af6f Scott Ullrich
                </tr>
334
                <tr> 
335
                  <td valign="top" class="vncell">Station name</td>
336
                  <td class="vtable"><input name="stationname" type="text" class="formfld" id="stationname" size="20" value="<?=htmlspecialchars($pconfig['stationname']);?>"> 
337 8f71faba Espen Johansen
                    <br/>
338 8600af6f Scott Ullrich
                    Hint: this field can usually be left blank</td>
339
                </tr>
340 8f71faba Espen Johansen
                <tr>
341
			<td valign="top" class="vncell">WEP</td>
342 20172515 Scott Ullrich
			<td class="vtable"> <input name="wep_enable" type="checkbox" value="yes"  id="wep_enable" value="yes" <? if ($pconfig['wep_enable']) echo "checked"; ?>> 
343 8f71faba Espen Johansen
			<strong>Enable WEP</strong>
344
			<table border="0" cellspacing="0" cellpadding="0">
345
		<tr> 
346 8600af6f Scott Ullrich
                        <td>&nbsp;</td>
347
                        <td>&nbsp;</td>
348
                        <td>&nbsp;TX key&nbsp;</td>
349 8f71faba Espen Johansen
		</tr>
350
		<tr> 
351 8600af6f Scott Ullrich
                        <td>Key 1:&nbsp;&nbsp;</td>
352
                        <td> <input name="key1" type="text" class="formfld" id="key1" size="30" value="<?=htmlspecialchars($pconfig['key1']);?>"></td>
353 ac3f8318 Espen Johansen
                        <td align="center"> <input name="txkey" type="radio" value="1" <? if ($pconfig['txkey'] == 1) echo "checked";?>></td>
354 8f71faba Espen Johansen
		</tr>
355
		<tr> 
356 8600af6f Scott Ullrich
                        <td>Key 2:&nbsp;&nbsp;</td>
357
                        <td> <input name="key2" type="text" class="formfld" id="key2" size="30" value="<?=htmlspecialchars($pconfig['key2']);?>"></td>
358 ac3f8318 Espen Johansen
                        <td align="center"> <input name="txkey" type="radio" value="2" <? if ($pconfig['txkey'] == 2) echo "checked";?>></td>
359 8f71faba Espen Johansen
		</tr>
360
		<tr> 
361 8600af6f Scott Ullrich
                        <td>Key 3:&nbsp;&nbsp;</td>
362
                        <td> <input name="key3" type="text" class="formfld" id="key3" size="30" value="<?=htmlspecialchars($pconfig['key3']);?>"></td>
363 ac3f8318 Espen Johansen
                        <td align="center"> <input name="txkey" type="radio" value="3" <? if ($pconfig['txkey'] == 3) echo "checked";?>></td>
364 8f71faba Espen Johansen
		</tr>
365
		<tr> 
366 8600af6f Scott Ullrich
                        <td>Key 4:&nbsp;&nbsp;</td>
367
                        <td> <input name="key4" type="text" class="formfld" id="key4" size="30" value="<?=htmlspecialchars($pconfig['key4']);?>"></td>
368 ac3f8318 Espen Johansen
                        <td align="center"> <input name="txkey" type="radio" value="4" <? if ($pconfig['txkey'] == 4) echo "checked";?>></td>
369 8f71faba Espen Johansen
		</tr>
370
			</table>
371
			<br/>
372
			40 (64) bit keys may be entered as 5 ASCII characters or 10 hex digits preceded by '0x'.<br/>
373
			104 (128) bit keys may be entered as 13 ASCII characters or 26 hex digits preceded by '0x'.
374
			<p>For assistance with creating keys, please see
375
			<a href="javascript:if(openwindow('/wlan_strong_key_generator/generator.php') == false) alert('Popup blocker detected.  Action aborted.');">WLAN Strong Key Generator</a>.
376
		   	</td>
377 8600af6f Scott Ullrich
                </tr>
378 8f71faba Espen Johansen
                <tr> 
379
			<td valign="top" class="vncell"><strong>WPA</strong></td>
380 20172515 Scott Ullrich
			<td class="vtable"><input name="wpa_enable" type="checkbox" value="yes"  class="formfld" id="wpa_enable" value="yes" <? if ($pconfig['wpa_enable']) echo "checked"; ?>> 
381 8f71faba Espen Johansen
			<strong>Enable WPA</strong>
382
			<br/><br/>
383
			<table border="0" cellspacing="0" cellpadding="0">
384
			<tr> 
385
                        <td>&nbsp;</td>
386
                        <td>&nbsp;WPA Pre Shared Key&nbsp;</td>
387
		</tr>
388
		<tr>
389
			<td>PSK:&nbsp;&nbsp;</td>
390
			<td>
391
			<input name="passphrase" type="text" class="formfld" id="passphrase" size="66" value="<?=htmlspecialchars($pconfig['passphrase']);?>">
392
			</td>
393
		      </tr>
394
		    </table>
395 92e105b3 Espen Johansen
		<br/>Passphrase must be from 8 to 63 chars.
396 8f71faba Espen Johansen
		</td>
397
	        </tr>
398
		<tr>
399
			<td valign="top" class="vncell">WPA Mode</td>
400
			<td class="vtable"><select name="wpa_mode" class="formfld" id="wpa_mode">
401 ac3f8318 Espen Johansen
			<option <? if ($pconfig['wpa_mode'] == '1') echo "selected";?> value="1">WPA</option>
402
			<option <? if ($pconfig['wpa_mode'] == '2') echo "selected";?> value="2">WPA2</option>
403
			<option <? if ($pconfig['wpa_mode'] == '3') echo "selected";?> value="3">Both</option>
404 8f71faba Espen Johansen
			</select>
405
			</td>
406
		</tr>
407
		<tr>
408
			<td valign="top" class="vncell">WPA Key Management Mode</td>
409
			<td class="vtable"><select name="wpa_key_mgmt" class="formfld" id="wpa_key_mgmt">
410 ac3f8318 Espen Johansen
			<option <? if ($pconfig['wpa_key_mgmt'] == 'WPA-PSK') echo "selected";?> value="WPA-PSK">Pre Shared Key</option>
411
			<option <? if ($pconfig['wpa_key_mgmt'] == 'WPA-EAP') echo "selected";?> value="WPA-EAP">Extensible Authentication Protocol</option>
412
			<option <? if ($pconfig['wpa_key_mgmt'] == 'WPA-PSK WPA-EAP') echo "selected";?> value="WPA-PSK WPA-EAP">Both</option>
413 8f71faba Espen Johansen
 			</select>
414
			</td>
415
		</tr>
416
		<tr>
417
			<td valign="top" class="vncell">Enable MAC Filtering</td>
418 20172515 Scott Ullrich
			<td class="vtable"><input name="macaddr_acl_enable" type="checkbox" value="yes"  class="formfld" id="macaddr_acl_enable" value="yes"<? if ($pconfig['macaddr_acl_enable']) echo "checked"; ?>> 
419 8f71faba Espen Johansen
			Setting this option will enable the use of a mac filterlist to allow deny association based on mac address
420
			<br/><br/>
421
			<select name="mac_acl" class="formfld" id="macaddr_acl">
422 ac3f8318 Espen Johansen
                        <option <? if ($pconfig['macaddr_acl'] == '0') echo "selected";?> value="0">Allow</option>
423
			<option <? if ($pconfig['macaddr_acl'] == '1') echo "selected";?> value="1">Deny</option>
424
			<option <? if ($pconfig['macaddr_acl'] == '2') echo "selected";?> value="2">Radius</option>
425 8f71faba Espen Johansen
			</select>
426
			<br/><br/>
427
			Setting this to "Allow" will allow all clients in not in deny list, while "Deny" will deny all clients not in allow list. Radius will cause allow and deny list to be searched and then query radius.</br>
428
			</td>
429
		</tr>
430
		<tr>
431
			<td valign="top" class="vncell">Authentication</td>
432
			<td class="vtable"><select name="auth_algs" class="formfld" id="auth_algs">
433 ac3f8318 Espen Johansen
			<option <? if ($pconfig['auth_algs'] == '1') echo "selected";?> value="1">Open System Authentication</option>
434
			<option <? if ($pconfig['auth_algs'] == '2') echo "selected";?> value="2">Shared Key Authentication</option>
435
			<option <? if ($pconfig['auth_algs'] == 'both') echo "selected";?> value="3">Both</option>
436 8f71faba Espen Johansen
			</select>
437
			<br/>Note: Shared Key Authentication requires WEP.</br>
438
			</td>
439
		</tr>
440
		<tr>
441
			<td valign="top" class="vncell">WPA Pairwise</td>
442
			<td class="vtable"><select name="wpa_pairwise" class="formfld" id="wpa_pairwise">
443 ac3f8318 Espen Johansen
			<option <? if ($pconfig['wpa_pairwise'] == 'CCMP TKIP') echo "selected";?> value="CCMP TKIP">Both</option>
444
			<option <? if ($pconfig['wpa_pairwise'] == 'CCMP') echo "selected";?> value="CCMP">AES</option>
445
			<option <? if ($pconfig['wpa_pairwise'] == 'TKIP') echo "selected";?> value="TKIP">TKIP</option>
446 8f71faba Espen Johansen
			</select>
447
			</td>
448
		</tr>
449
		<tr>
450
			<td valign="top" class="vncell">Key Rotation</td>
451 ac3f8318 Espen Johansen
			<td class="vtable"><input name="wpa_group_rekey" type="text" class="formfld" id="wpa_group_rekey" size="30" value="<? echo $pconfig['wpa_group_rekey'] ? $pconfig['wpa_group_rekey'] : "60";?>">
452 8f71faba Espen Johansen
			<br/>Allowed values are 1-9999 but should not be longer than Master Key Regeneration time.
453
			</td>
454
		</tr>
455
		<tr>
456
			<td valign="top" class="vncell">Master Key Regeneration</td>
457 ac3f8318 Espen Johansen
			<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";?>">
458 8f71faba Espen Johansen
			<br/>Allowed values are 1-9999 but should not be shorter than Key Rotation time.
459
			</td>
460
		</tr>
461
		<tr>
462
			<td valign="top" class="vncell">Strict Key Regeneration</td>
463 20172515 Scott Ullrich
			<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"; ?>>
464 d213185e Espen Johansen
			<br/>Setting this option will force the AP to rekey whenever a client disassociates.
465 8f71faba Espen Johansen
			</td>
466
		</tr>
467
		<tr>
468
			<td valign="top" class="vncell">Enable IEEE802.1X</td>
469 20172515 Scott Ullrich
			<td class="vtable"><input name="ieee8021x" type="checkbox" value="yes"  class="formfld" id="ieee8021x" <? if ($pconfig['ieee8021x']) echo "checked";?>>
470 d213185e Espen Johansen
			<br/>Setting this option will enable 802.1x authentication.
471 8f71faba Espen Johansen
			</td>
472
		</tr>
473 ac3f8318 Espen Johansen
<? } ?>