Project

General

Profile

Download (6.35 KB) Statistics
| Branch: | Tag: | Revision:
1 d0330501 Scott Ullrich
<?php
2 5b237745 Scott Ullrich
/*
3
	status_wireless.php
4 d0330501 Scott Ullrich
	Copyright (C) 2004 Scott Ullrich
5 5b237745 Scott Ullrich
	All rights reserved.
6 1f3a3ed2 jim-p
7 5b237745 Scott Ullrich
	Redistribution and use in source and binary forms, with or without
8
	modification, are permitted provided that the following conditions are met:
9 1f3a3ed2 jim-p
10 5b237745 Scott Ullrich
	1. Redistributions of source code must retain the above copyright notice,
11 d0330501 Scott Ullrich
	this list of conditions and the following disclaimer.
12 1f3a3ed2 jim-p
13 5b237745 Scott Ullrich
	2. Redistributions in binary form must reproduce the above copyright
14 d0330501 Scott Ullrich
	notice, this list of conditions and the following disclaimer in the
15
	documentation and/or other materials provided with the distribution.
16 1f3a3ed2 jim-p
17 5b237745 Scott Ullrich
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
18
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
19
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
20
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
21
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26
	POSSIBILITY OF SUCH DAMAGE.
27
*/
28 1d333258 Scott Ullrich
/*
29
	pfSense_MODULE:	interfaces
30
*/
31 5b237745 Scott Ullrich
32 6b07c15a Matthew Grooms
##|+PRIV
33
##|*IDENT=page-diagnostics-wirelessstatus
34 d1104fa6 Chris Buechler
##|*NAME=Status: Wireless page
35
##|*DESCR=Allow access to the 'Status: Wireless' page.
36 6b07c15a Matthew Grooms
##|*MATCH=status_wireless.php*
37
##|-PRIV
38
39 d0330501 Scott Ullrich
require_once("guiconfig.inc");
40 5b237745 Scott Ullrich
41 41740617 Rafael Lucas
$pgtitle = array(gettext("Status"),gettext("Wireless"));
42 b32dd0a6 jim-p
$shortcut_section = "wireless";
43 4df96eff Scott Ullrich
include("head.inc");
44
45 d0330501 Scott Ullrich
$if = $_POST['if'];
46
if($_GET['if'] <> "")
47
	$if = $_GET['if'];
48 64b2f3c8 Ermal Lu?i
49
$ciflist = get_configured_interface_with_descr();
50
if(empty($if)) {
51 d0330501 Scott Ullrich
	/* Find the first interface
52
	   that is wireless */
53 64b2f3c8 Ermal Lu?i
	foreach($ciflist as $interface => $ifdescr) {
54 be2b47d5 Erik Fonnesbeck
		if(is_interface_wireless(get_real_interface($interface))) {
55 64b2f3c8 Ermal Lu?i
			$if = $interface;
56 be2b47d5 Erik Fonnesbeck
			break;
57
		}
58 d0330501 Scott Ullrich
	}
59
}
60 5b237745 Scott Ullrich
?>
61
62 d0330501 Scott Ullrich
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
63
<?php
64
include("fbegin.inc");
65
?>
66 53961f06 Scott Ullrich
<form action="status_wireless.php" method="post">
67 d0330501 Scott Ullrich
<?php if ($savemsg) print_info_box($savemsg); ?>
68 d0440f75 Scott Ullrich
69 d0330501 Scott Ullrich
<table width="100%" border="0" cellpadding="0" cellspacing="0">
70
<tr><td>
71
<?php
72
$tab_array = array();
73 64b2f3c8 Ermal Lu?i
foreach($ciflist as $interface => $ifdescr) {
74 88e9bceb smos
	if (is_interface_wireless(get_real_interface($interface))) {
75 64b2f3c8 Ermal Lu?i
		$enabled = false;
76 a2b724a6 Ermal Lu?i
		if($if == $interface)
77 d0330501 Scott Ullrich
			$enabled = true;
78 24357d92 jim-p
		$tab_array[] = array(gettext("Status") . " ({$ifdescr})", $enabled, "status_wireless.php?if={$interface}");
79 d0330501 Scott Ullrich
	}
80
}
81 72d2682c Erik Fonnesbeck
$rwlif = get_real_interface($if);
82 6f87ed42 Chris Buechler
if($_POST['rescanwifi'] <> "") {
83 4362a612 Chris Buechler
	mwexec_bg("/sbin/ifconfig {$rwlif} scan 2>&1");
84 c3ff89b4 Renato Botelho
	$savemsg = gettext("Rescan has been initiated in the background. Refresh this page in 10 seconds to see the results.");
85 6f87ed42 Chris Buechler
}
86 ea52942c Chris Buechler
if ($savemsg) print_info_box($savemsg);
87 d0330501 Scott Ullrich
display_top_tabs($tab_array);
88
?>
89
</td></tr>
90 53961f06 Scott Ullrich
<tr><td>
91 1f3a3ed2 jim-p
<div id="mainarea" class="tabcont">
92
<input type="hidden" name="if" id="if" value="<?php echo $if; ?>">
93
<b><input type="submit" name="rescanwifi" id="rescanwifi" value="Rescan"></b><br/><br/>
94
<b><?php echo gettext("Nearby access points or ad-hoc peers"); ?></b>
95
<table class="tabcont sortable" colspan="3" cellpadding="3" width="100%">
96
	<thead>
97
		<tr bgcolor='#990000'>
98
			<td><b><font color='#ffffff'>SSID</font></b></td>
99
			<td><b><font color='#ffffff'>BSSID</font></b></td>
100
			<td><b><font color='#ffffff'>CHAN</font></b></td>
101
			<td><b><font color='#ffffff'>RATE</font></b></td>
102
			<td><b><font color='#ffffff'>RSSI</font></b></td>
103
			<td><b><font color='#ffffff'>INT</font></b></td>
104
			<td><b><font color='#ffffff'>CAPS</font></b></td>
105
		</tr>
106
	</thead>
107
	<tbody>
108 351cbef7 Scott Ullrich
<?php
109 64b2f3c8 Ermal Lu?i
	exec("/sbin/ifconfig {$rwlif} list scan 2>&1", $states, $ret);
110 e2d90eac Seth Mos
	/* Skip Header */
111
	array_shift($states);
112 d0330501 Scott Ullrich
113 f2f0c37e Scott Ullrich
	$counter=0;
114
	foreach($states as $state) {
115 e2d90eac Seth Mos
		/* Split by Mac address for the SSID Field */
116 22275785 Seth Mos
		$split = preg_split("/([0-9a-f][[0-9a-f]\:[0-9a-f][[0-9a-f]\:[0-9a-f][[0-9a-f]\:[0-9a-f][[0-9a-f]\:[0-9a-f][[0-9a-f]\:[0-9a-f][[0-9a-f])/i", $state);
117
		preg_match("/([0-9a-f][[0-9a-f]\:[0-9a-f][[0-9a-f]\:[0-9a-f][[0-9a-f]\:[0-9a-f][[0-9a-f]\:[0-9a-f][[0-9a-f]\:[0-9a-f][[0-9a-f])/i", $state, $bssid);
118 2bf0ada5 jim-p
		$ssid = htmlspecialchars($split[0]);
119 22275785 Seth Mos
		$bssid = $bssid[0];
120 e2d90eac Seth Mos
		/* Split the rest by using spaces for this line using the 2nd part */
121
		$split = preg_split("/[ ]+/i", $split[1]);
122
		$channel = $split[1];
123
		$rate = $split[2];
124
		$rssi = $split[3];
125
		$int = $split[4];
126
		$caps = "$split[5] $split[6] $split[7] $split[8] $split[9] $split[10] $split[11] ";
127
128 bdeca4ed Scott Ullrich
		print "<tr>";
129 e2d90eac Seth Mos
		print "<td>{$ssid}</td>";
130
		print "<td>{$bssid}</td>";
131
		print "<td>{$channel}</td>";
132
		print "<td>{$rate}</td>";
133
		print "<td>{$rssi}</td>";
134
		print "<td>{$int}</td>";
135
		print "<td>{$caps}</td>";
136 6c40c007 Scott Ullrich
		print "</tr>\n";
137 f2f0c37e Scott Ullrich
	}
138 1f3a3ed2 jim-p
?>
139
	</tbody>
140
</table>
141
<b><?php echo gettext("Associated or ad-hoc peers"); ?></b><br/>
142
<table class="tabcont sortable" colspan="3" cellpadding="3" width="100%">
143
	<thead>
144
		<tr bgcolor='#990000'>
145
			<td><b><font color='#ffffff'>ADDR</font></b></td>
146
			<td><b><font color='#ffffff'>AID</font></b></td>
147
			<td><b><font color='#ffffff'>CHAN</font></b></td>
148
			<td><b><font color='#ffffff'>RATE</font></b></td>
149
			<td><b><font color='#ffffff'>RSSI</font></b></td>
150
			<td><b><font color='#ffffff'>IDLE</font></b></td>
151
			<td><b><font color='#ffffff'>TXSEQ</font></b></td>
152
			<td><b><font color='#ffffff'>RXSEQ</font></b></td>
153
			<td><b><font color='#ffffff'>CAPS</font></b></td>
154
			<td><b><font color='#ffffff'>ERP</font></b></td>
155
		</tr>
156
	</thead>
157
	<tbody>
158 c29ad853 Scott Ullrich
159 1f3a3ed2 jim-p
<?php
160 105bb6a6 Seth Mos
	$states = array();
161 64b2f3c8 Ermal Lu?i
	exec("/sbin/ifconfig {$rwlif} list sta 2>&1", $states, $ret);
162 e2d90eac Seth Mos
	array_shift($states);
163 f2f0c37e Scott Ullrich
164
	$counter=0;
165
	foreach($states as $state) {
166 105bb6a6 Seth Mos
		$split = preg_split("/[ ]+/i", $state);
167
		/* Split the rest by using spaces for this line using the 2nd part */
168 f2f0c37e Scott Ullrich
		print "<tr>";
169 105bb6a6 Seth Mos
		print "<td>{$split[0]}</td>";
170
		print "<td>{$split[1]}</td>";
171
		print "<td>{$split[2]}</td>";
172
		print "<td>{$split[3]}</td>";
173
		print "<td>{$split[4]}</td>";
174
		print "<td>{$split[5]}</td>";
175
		print "<td>{$split[6]}</td>";
176
		print "<td>{$split[7]}</td>";
177
		print "<td>{$split[8]}</td>";
178
		print "<td>{$split[9]}</td>";
179 f2f0c37e Scott Ullrich
		print "</tr>\n";
180
	}
181 351cbef7 Scott Ullrich
182 1f3a3ed2 jim-p
/* XXX: what stats to we get for adhoc mode? */
183 f2f0c37e Scott Ullrich
184 351cbef7 Scott Ullrich
?>
185 1f3a3ed2 jim-p
	</tbody>
186 d0330501 Scott Ullrich
</table>
187 4ca92170 Chris Buechler
</div><br>
188 1f3a3ed2 jim-p
	<b>Flags:</b> A = authorized, E = Extended Rate (802.11g), P = Power save mode<br>
189
	<b>Capabilities:</b> E = ESS (infrastructure mode), I = IBSS (ad-hoc mode), P = privacy (WEP/TKIP/AES),
190
		S = Short preamble, s = Short slot time
191 d0330501 Scott Ullrich
</td></tr>
192
</table>
193 d0440f75 Scott Ullrich
194 5b237745 Scott Ullrich
<?php include("fend.inc"); ?>
195 d0330501 Scott Ullrich
</body>
196
</html>