diff options
Diffstat (limited to 'usr/local/www')
-rwxr-xr-x | usr/local/www/interfaces_wlan.inc | 44 | ||||
-rwxr-xr-x | usr/local/www/status_wireless.php | 83 |
2 files changed, 76 insertions, 51 deletions
diff --git a/usr/local/www/interfaces_wlan.inc b/usr/local/www/interfaces_wlan.inc index 9b3c41c..0faf3da 100755 --- a/usr/local/www/interfaces_wlan.inc +++ b/usr/local/www/interfaces_wlan.inc @@ -3,7 +3,7 @@ interfaces_wlan.inc part of m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>. + Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>. All rights reserved. Redistribution and use in source and binary forms, with or without @@ -28,9 +28,12 @@ POSSIBILITY OF SUCH DAMAGE. */ +$wlchannels = array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,36,40,42,44,48,50,52,56,58,60,64,149,152,153,157,160,161,165); + function wireless_config_init() { global $optcfg, $pconfig; + $pconfig['standard'] = $optcfg['wireless']['standard']; $pconfig['mode'] = $optcfg['wireless']['mode']; $pconfig['ssid'] = $optcfg['wireless']['ssid']; $pconfig['stationname'] = $optcfg['wireless']['stationname']; @@ -70,6 +73,7 @@ function wireless_config_post() { if (!$input_errors) { + $optcfg['wireless']['standard'] = $_POST['standard']; $optcfg['wireless']['mode'] = $_POST['mode']; $optcfg['wireless']['ssid'] = $_POST['ssid']; $optcfg['wireless']['stationname'] = $_POST['stationname']; @@ -92,7 +96,7 @@ function wireless_config_post() { } function wireless_config_print() { - global $optcfg, $pconfig; + global $optcfg, $pconfig, $wlchannels; ?> <tr> <td colspan="2" valign="top" height="16"></td> @@ -100,12 +104,26 @@ function wireless_config_print() { <tr> <td colspan="2" valign="top" class="listtopic">Wireless configuration</td> </tr> + <?php if (strstr($optcfg['if'], "ath")): ?> + <tr> + <td valign="top" class="vncellreq">Standard</td> + <td class="vtable"><select name="standard" class="formfld" id="standard"> + <?php + $standards = array("11b" => "802.11b", "11g" => "802.11g", "11a" => "802.11a"); + foreach ($standards as $sn => $sv): ?> + <option value="<?=$sn;?>" <?php if ($sn == $pconfig['standard']) echo "selected";?>> + <?=$sv;?> + </option> + <?php endforeach; ?> + </select></td> + </tr> + <?php endif; ?> <tr> <td valign="top" class="vncellreq">Mode</td> - <td class="vtable"> <select name="mode" class="formfld" id="mode"> + <td class="vtable"><select name="mode" class="formfld" id="mode"> <?php $opts = array(); - if (strstr($optcfg['if'], "wi")) + if (strstr($optcfg['if'], "wi") || strstr($optcfg['if'], "ath")) $opts[] = "hostap"; $opts[] = "BSS"; $opts[] = "IBSS"; @@ -121,19 +139,21 @@ function wireless_config_print() { </tr> <tr> <td valign="top" class="vncellreq">SSID</td> - <td class="vtable"><input name="ssid" type="text" class="formfld" id="ssid" size="20" value="<?=htmlspecialchars($pconfig['ssid']);?>"> + <td class="vtable"><?=$mandfldhtml;?><input name="ssid" type="text" class="formfld" id="ssid" size="20" value="<?=htmlspecialchars($pconfig['ssid']);?>"> </td> </tr> <tr> <td valign="top" class="vncellreq">Channel</td> <td class="vtable"><select name="channel" class="formfld" id="channel"> + <option <?php if ($pconfig['channel'] == 0) echo "selected";?> value="0">Auto</option> <?php - for ($i = 0; $i <= 14; $i++): ?> - <option <?php if ($i == $pconfig['channel']) echo "selected";?>> - <? echo($i==0 ? "Auto" : $i) ?> + foreach ($wlchannels as $channel): ?> + <option <?php if ($channel == $pconfig['channel']) echo "selected";?> value="<?=$channel;?>"> + <?=$channel;?> </option> - <?php endfor; ?> - </select></td> + <?php endforeach; ?> + </select> <br> + Note: Not all channels may be supported by your card</td> </tr> <tr> <td valign="top" class="vncell">Station name</td> @@ -144,8 +164,8 @@ function wireless_config_print() { <tr> <td valign="top" class="vncell">WEP</td> <td class="vtable"> <input name="wep_enable" type="checkbox" id="wep_enable" value="yes" <?php if ($pconfig['wep_enable']) echo "checked"; ?>> - <strong>Enable WEP</strong><br> - <table border="0" cellspacing="0" cellpadding="0"> + <strong>Enable WEP</strong> + <table border="0" cellspacing="0" cellpadding="0"> <tr> <td> </td> <td> </td> diff --git a/usr/local/www/status_wireless.php b/usr/local/www/status_wireless.php index c87c8d6..2584067 100755 --- a/usr/local/www/status_wireless.php +++ b/usr/local/www/status_wireless.php @@ -4,7 +4,7 @@ status_wireless.php part of m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>. + Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>. All rights reserved. Redistribution and use in source and binary forms, with or without @@ -29,6 +29,7 @@ POSSIBILITY OF SUCH DAMAGE. */ +$pgtitle = array("Status", "Wireless"); require("guiconfig.inc"); function get_wireless_info($ifdescr) { @@ -63,15 +64,20 @@ function get_wireless_info($ifdescr) { array_shift($aslist); foreach ($aslist as $as) { if ($as) { - $asa = preg_split("/\s+/", $as); - $aslent = array(); - $aslent['mac'] = $asa[0]; - $aslent['rates'] = substr($asa[4], strpos($asa[4], "<")+1, - strpos($asa[4], ">")-strpos($asa[4], "<")-1); - $aslent['sig'] = substr($asa[5], strpos($asa[5], "=")+1); - $ifinfo['aslist'][] = $aslent; + if (preg_match("/^ap/", $as)) { + if (is_array($aslent) && count($aslent)) + $ifinfo['aslist'][] = $aslent; + $aslent = array(); + } else if (preg_match("/BSSID:\s*\[ (.*) \]/", $as, $matches)) { + $aslent['bssid'] = $matches[1]; + } else if (preg_match("/\[dBm\]:\s*\[ .* \/ (.*) \/ (.*) \]/", $as, $matches)) { + $aslent['sig'] = $matches[1]; + $aslent['noise'] = $matches[2]; + } } } + if (is_array($aslent) && count($aslent)) + $ifinfo['aslist'][] = $aslent; } return $ifinfo; @@ -81,32 +87,33 @@ function get_wireless_info($ifdescr) { <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> -<title><?=gentitle("Status: Wireless");?></title> +<title><?=gentitle("pfSense webGUI");?></title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link href="gui.css" rel="stylesheet" type="text/css"> </head> +<form> + <body link="#0000CC" vlink="#0000CC" alink="#0000CC"> <?php include("fbegin.inc"); ?> - <p class="pgtitle">Status: Wireless</p> - <?php $i = 0; $ifdescrs = array(); - - if (is_array($config['interfaces']['wan']['wireless']) && - strstr($config['interfaces']['wan']['if'], "wi")) - $ifdescrs['wan'] = 'WAN'; - - if (is_array($config['interfaces']['lan']['wireless']) && - strstr($config['interfaces']['lan']['if'], "wi")) - $ifdescrs['lan'] = 'LAN'; - - for ($j = 1; isset($config['interfaces']['opt' . $j]); $j++) { - if (is_array($config['interfaces']['opt' . $j]['wireless']) && - isset($config['interfaces']['opt' . $j]['enable']) && - strstr($config['interfaces']['opt' . $j]['if'], "wi")) - $ifdescrs['opt' . $j] = $config['interfaces']['opt' . $j]['descr']; - } - - if (count($ifdescrs) > 0): ?> +<?php $i = 0; $ifdescrs = array(); + + if (is_array($config['interfaces']['wan']['wireless']) && + (strstr($config['interfaces']['wan']['if'], "wi") || strstr($config['interfaces']['wan']['if'], "ath"))) + $ifdescrs['wan'] = 'WAN'; + + if (is_array($config['interfaces']['lan']['wireless']) && + (strstr($config['interfaces']['lan']['if'], "wi") || strstr($config['interfaces']['lan']['if'], "ath"))) + $ifdescrs['lan'] = 'LAN'; + + for ($j = 1; isset($config['interfaces']['opt' . $j]); $j++) { + if (is_array($config['interfaces']['opt' . $j]['wireless']) && + isset($config['interfaces']['opt' . $j]['enable']) && + (strstr($config['interfaces']['opt' . $j]['if'], "wi") || strstr($config['interfaces']['opt' . $j]['if'], "ath"))) + $ifdescrs['opt' . $j] = $config['interfaces']['opt' . $j]['descr']; + } + + if (count($ifdescrs) > 0): ?> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <?php foreach ($ifdescrs as $ifdescr => $ifname): @@ -122,7 +129,7 @@ function get_wireless_info($ifdescr) { <?=htmlspecialchars($ifname);?> interface (SSID "<?=htmlspecialchars($config['interfaces'][$ifdescr]['wireless']['ssid']);?>")</td> </tr> <tr> - <td width="22%" valign="top" class="listhdrr">Signal strength + <td width="22%" valign="top" class="vncellt">Signal strength cache</td> <td width="78%" class="listrpad"> <table width="100%" border="0" cellpadding="0" cellspacing="0"> @@ -155,25 +162,25 @@ function get_wireless_info($ifdescr) { </table></td> </tr><?php if ($ifinfo['aslist']): ?> <tr> - <td width="22%" valign="top" class="listhdrr">Associated stations + <td width="22%" valign="top" class="vncellt">Associated stations </td> <td width="78%" class="listrpad"> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> - <td width="40%" class="listhdrr">MAC address</td> - <td width="40%" class="listhdrr">TX rates</td> - <td width="20%" class="listhdrr">Signal</td> + <td width="40%" class="listhdrr">BSSID</td> + <td width="30%" class="listhdrr">Signal</td> + <td width="30%" class="listhdrr">Noise</td> </tr> <?php foreach ($ifinfo['aslist'] as $as): ?> <tr> <td class="listlr"> - <?=htmlspecialchars($as['mac']);?> + <?=htmlspecialchars($as['bssid']);?> </td> <td class="listr"> - <?=htmlspecialchars($as['rates']);?> + <?=htmlspecialchars($as['sig']);?> dBm </td> <td class="listr"> - <?=htmlspecialchars($as['sig']);?> + <?=htmlspecialchars($as['noise']);?> dBm </td> </tr> <?php endforeach; ?> @@ -182,8 +189,6 @@ function get_wireless_info($ifdescr) { <?php $i++; endforeach; ?> </table> <?php else: ?> -<p><strong>No supported wireless interfaces were found for status display.</strong></p> +<strong>No supported wireless interfaces were found for status display (only cards that use the wi[n] or ath[n] driver are supported).</strong> <?php endif; ?> <?php include("fend.inc"); ?> -</body> -</html> |