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 |
|
|
|
7 |
|
|
Redistribution and use in source and binary forms, with or without
|
8 |
|
|
modification, are permitted provided that the following conditions are met:
|
9 |
|
|
|
10 |
|
|
1. Redistributions of source code must retain the above copyright notice,
|
11 |
d0330501
|
Scott Ullrich
|
this list of conditions and the following disclaimer.
|
12 |
5b237745
|
Scott Ullrich
|
|
13 |
|
|
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 |
5b237745
|
Scott Ullrich
|
|
17 |
|
|
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 |
|
|
##|*NAME=Diagnostics: Wireless Status page
|
35 |
|
|
##|*DESCR=Allow access to the 'Diagnostics: Wireless Status' page.
|
36 |
|
|
##|*MATCH=status_wireless.php*
|
37 |
|
|
##|-PRIV
|
38 |
|
|
|
39 |
d0330501
|
Scott Ullrich
|
require_once("guiconfig.inc");
|
40 |
5b237745
|
Scott Ullrich
|
|
41 |
d88c6a9f
|
Scott Ullrich
|
$pgtitle = array("Diagnostics","Wireless Status");
|
42 |
4df96eff
|
Scott Ullrich
|
include("head.inc");
|
43 |
|
|
|
44 |
d0330501
|
Scott Ullrich
|
$if = $_POST['if'];
|
45 |
|
|
if($_GET['if'] <> "")
|
46 |
|
|
$if = $_GET['if'];
|
47 |
64b2f3c8
|
Ermal Lu?i
|
|
48 |
|
|
$ciflist = get_configured_interface_with_descr();
|
49 |
|
|
if(empty($if)) {
|
50 |
d0330501
|
Scott Ullrich
|
/* Find the first interface
|
51 |
|
|
that is wireless */
|
52 |
64b2f3c8
|
Ermal Lu?i
|
foreach($ciflist as $interface => $ifdescr) {
|
53 |
|
|
if(is_interface_wireless($interface))
|
54 |
|
|
$if = $interface;
|
55 |
d0330501
|
Scott Ullrich
|
}
|
56 |
|
|
}
|
57 |
5b237745
|
Scott Ullrich
|
?>
|
58 |
|
|
|
59 |
d0330501
|
Scott Ullrich
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
|
60 |
|
|
<?php
|
61 |
|
|
include("fbegin.inc");
|
62 |
|
|
?>
|
63 |
53961f06
|
Scott Ullrich
|
<form action="status_wireless.php" method="post">
|
64 |
d0330501
|
Scott Ullrich
|
<?php if ($savemsg) print_info_box($savemsg); ?>
|
65 |
d0440f75
|
Scott Ullrich
|
|
66 |
d0330501
|
Scott Ullrich
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
67 |
|
|
<tr><td>
|
68 |
|
|
<?php
|
69 |
|
|
$tab_array = array();
|
70 |
64b2f3c8
|
Ermal Lu?i
|
foreach($ciflist as $interface => $ifdescr) {
|
71 |
|
|
if (is_interface_wireless($interface)) {
|
72 |
|
|
$enabled = false;
|
73 |
a2b724a6
|
Ermal Lu?i
|
if($if == $interface)
|
74 |
d0330501
|
Scott Ullrich
|
$enabled = true;
|
75 |
64b2f3c8
|
Ermal Lu?i
|
$tab_array[] = array("Status ($ifdescr)", $enabled, "status_wireless.php?if={$interface}");
|
76 |
d0330501
|
Scott Ullrich
|
}
|
77 |
|
|
}
|
78 |
|
|
display_top_tabs($tab_array);
|
79 |
|
|
?>
|
80 |
|
|
</td></tr>
|
81 |
53961f06
|
Scott Ullrich
|
<tr><td>
|
82 |
|
|
<div id="mainarea">
|
83 |
|
|
<table class="tabcont" colspan="3" cellpadding="3" width="100%">
|
84 |
351cbef7
|
Scott Ullrich
|
<?php
|
85 |
|
|
|
86 |
c29ad853
|
Scott Ullrich
|
|
87 |
f2f0c37e
|
Scott Ullrich
|
/* table header */
|
88 |
64b2f3c8
|
Ermal Lu?i
|
print "<tr><td colspan=7><b>Nearby access points or ad-hoc peers.<br/></td></tr>\n";
|
89 |
e2d90eac
|
Seth Mos
|
print "\n<tr>";
|
90 |
f2f0c37e
|
Scott Ullrich
|
print "<tr bgcolor='#990000'>";
|
91 |
|
|
print "<td><b><font color='#ffffff'>SSID</td>";
|
92 |
|
|
print "<td><b><font color='#ffffff'>BSSID</td>";
|
93 |
|
|
print "<td><b><font color='#ffffff'>CHAN</td>";
|
94 |
|
|
print "<td><b><font color='#ffffff'>RATE</td>";
|
95 |
|
|
print "<td><b><font color='#ffffff'>RSSI</td>";
|
96 |
|
|
print "<td><b><font color='#ffffff'>INT</td>";
|
97 |
|
|
print "<td><b><font color='#ffffff'>CAPS</td>";
|
98 |
|
|
print "</tr>\n\n";
|
99 |
|
|
|
100 |
64b2f3c8
|
Ermal Lu?i
|
$rwlif = get_real_interface($if);
|
101 |
|
|
exec("/sbin/ifconfig {$rwlif} list scan 2>&1", $states, $ret);
|
102 |
e2d90eac
|
Seth Mos
|
/* Skip Header */
|
103 |
|
|
array_shift($states);
|
104 |
d0330501
|
Scott Ullrich
|
|
105 |
f2f0c37e
|
Scott Ullrich
|
$counter=0;
|
106 |
|
|
foreach($states as $state) {
|
107 |
e2d90eac
|
Seth Mos
|
/* Split by Mac address for the SSID Field */
|
108 |
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);
|
109 |
|
|
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);
|
110 |
e2d90eac
|
Seth Mos
|
$ssid = $split[0];
|
111 |
22275785
|
Seth Mos
|
$bssid = $bssid[0];
|
112 |
e2d90eac
|
Seth Mos
|
/* Split the rest by using spaces for this line using the 2nd part */
|
113 |
|
|
$split = preg_split("/[ ]+/i", $split[1]);
|
114 |
|
|
$bssid = $split[0];
|
115 |
|
|
$channel = $split[1];
|
116 |
|
|
$rate = $split[2];
|
117 |
|
|
$rssi = $split[3];
|
118 |
|
|
$int = $split[4];
|
119 |
|
|
$caps = "$split[5] $split[6] $split[7] $split[8] $split[9] $split[10] $split[11] ";
|
120 |
|
|
|
121 |
bdeca4ed
|
Scott Ullrich
|
print "<tr>";
|
122 |
e2d90eac
|
Seth Mos
|
print "<td>{$ssid}</td>";
|
123 |
|
|
print "<td>{$bssid}</td>";
|
124 |
|
|
print "<td>{$channel}</td>";
|
125 |
|
|
print "<td>{$rate}</td>";
|
126 |
|
|
print "<td>{$rssi}</td>";
|
127 |
|
|
print "<td>{$int}</td>";
|
128 |
|
|
print "<td>{$caps}</td>";
|
129 |
6c40c007
|
Scott Ullrich
|
print "</tr>\n";
|
130 |
f2f0c37e
|
Scott Ullrich
|
}
|
131 |
c29ad853
|
Scott Ullrich
|
|
132 |
|
|
print "</table><table class=\"tabcont\" colspan=\"3\" cellpadding=\"3\" width=\"100%\">";
|
133 |
|
|
|
134 |
f2f0c37e
|
Scott Ullrich
|
/* table header */
|
135 |
e2d90eac
|
Seth Mos
|
print "\n<tr>";
|
136 |
64b2f3c8
|
Ermal Lu?i
|
print "<tr><td colspan=7><b>Associated or ad-hoc peers.<br/></td></tr>\n";
|
137 |
f2f0c37e
|
Scott Ullrich
|
print "<tr bgcolor='#990000'>";
|
138 |
|
|
print "<td><b><font color='#ffffff'>ADDR</td>";
|
139 |
|
|
print "<td><b><font color='#ffffff'>AID</td>";
|
140 |
|
|
print "<td><b><font color='#ffffff'>CHAN</td>";
|
141 |
|
|
print "<td><b><font color='#ffffff'>RATE</td>";
|
142 |
|
|
print "<td><b><font color='#ffffff'>RSSI</td>";
|
143 |
|
|
print "<td><b><font color='#ffffff'>IDLE</td>";
|
144 |
|
|
print "<td><b><font color='#ffffff'>TXSEQ</td>";
|
145 |
|
|
print "<td><b><font color='#ffffff'>RXSEQ</td>";
|
146 |
|
|
print "<td><b><font color='#ffffff'>CAPS</td>";
|
147 |
|
|
print "<td><b><font color='#ffffff'>ERP</td>";
|
148 |
|
|
print "</tr>\n\n";
|
149 |
d0330501
|
Scott Ullrich
|
|
150 |
105bb6a6
|
Seth Mos
|
$states = array();
|
151 |
64b2f3c8
|
Ermal Lu?i
|
exec("/sbin/ifconfig {$rwlif} list sta 2>&1", $states, $ret);
|
152 |
e2d90eac
|
Seth Mos
|
array_shift($states);
|
153 |
f2f0c37e
|
Scott Ullrich
|
|
154 |
|
|
$counter=0;
|
155 |
|
|
foreach($states as $state) {
|
156 |
105bb6a6
|
Seth Mos
|
$split = preg_split("/[ ]+/i", $state);
|
157 |
|
|
/* Split the rest by using spaces for this line using the 2nd part */
|
158 |
f2f0c37e
|
Scott Ullrich
|
print "<tr>";
|
159 |
105bb6a6
|
Seth Mos
|
print "<td>{$split[0]}</td>";
|
160 |
|
|
print "<td>{$split[1]}</td>";
|
161 |
|
|
print "<td>{$split[2]}</td>";
|
162 |
|
|
print "<td>{$split[3]}</td>";
|
163 |
|
|
print "<td>{$split[4]}</td>";
|
164 |
|
|
print "<td>{$split[5]}</td>";
|
165 |
|
|
print "<td>{$split[6]}</td>";
|
166 |
|
|
print "<td>{$split[7]}</td>";
|
167 |
|
|
print "<td>{$split[8]}</td>";
|
168 |
|
|
print "<td>{$split[9]}</td>";
|
169 |
f2f0c37e
|
Scott Ullrich
|
print "</tr>\n";
|
170 |
|
|
}
|
171 |
351cbef7
|
Scott Ullrich
|
|
172 |
f2f0c37e
|
Scott Ullrich
|
/* XXX: what stats to we get for adhoc mode? */
|
173 |
|
|
|
174 |
351cbef7
|
Scott Ullrich
|
?>
|
175 |
d0330501
|
Scott Ullrich
|
</table>
|
176 |
53961f06
|
Scott Ullrich
|
</div>
|
177 |
d0330501
|
Scott Ullrich
|
</td></tr>
|
178 |
|
|
</table>
|
179 |
d0440f75
|
Scott Ullrich
|
|
180 |
5b237745
|
Scott Ullrich
|
<?php include("fend.inc"); ?>
|
181 |
d0330501
|
Scott Ullrich
|
</body>
|
182 |
|
|
</html>
|