1
|
<?php
|
2
|
/*
|
3
|
status_wireless.php
|
4
|
Copyright (C) 2004 Scott Ullrich
|
5
|
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
|
this list of conditions and the following disclaimer.
|
12
|
|
13
|
2. Redistributions in binary form must reproduce the above copyright
|
14
|
notice, this list of conditions and the following disclaimer in the
|
15
|
documentation and/or other materials provided with the distribution.
|
16
|
|
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
|
/*
|
29
|
pfSense_MODULE: interfaces
|
30
|
*/
|
31
|
|
32
|
##|+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
|
require_once("guiconfig.inc");
|
40
|
|
41
|
$pgtitle = array("Diagnostics","Wireless Status");
|
42
|
include("head.inc");
|
43
|
|
44
|
$if = $_POST['if'];
|
45
|
if($_GET['if'] <> "")
|
46
|
$if = $_GET['if'];
|
47
|
|
48
|
$ciflist = get_configured_interface_with_descr();
|
49
|
if(empty($if)) {
|
50
|
/* Find the first interface
|
51
|
that is wireless */
|
52
|
foreach($ciflist as $interface => $ifdescr) {
|
53
|
if(is_interface_wireless($interface))
|
54
|
$if = $interface;
|
55
|
}
|
56
|
}
|
57
|
?>
|
58
|
|
59
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
|
60
|
<?php
|
61
|
include("fbegin.inc");
|
62
|
?>
|
63
|
<form action="status_wireless.php" method="post">
|
64
|
<?php if ($savemsg) print_info_box($savemsg); ?>
|
65
|
|
66
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
67
|
<tr><td>
|
68
|
<?php
|
69
|
$tab_array = array();
|
70
|
foreach($ciflist as $interface => $ifdescr) {
|
71
|
if (is_interface_wireless($interface)) {
|
72
|
$enabled = false;
|
73
|
if($if == $interface)
|
74
|
$enabled = true;
|
75
|
$tab_array[] = array("Status ($ifdescr)", $enabled, "status_wireless.php?if={$interface}");
|
76
|
}
|
77
|
}
|
78
|
display_top_tabs($tab_array);
|
79
|
?>
|
80
|
</td></tr>
|
81
|
<tr><td>
|
82
|
<div id="mainarea">
|
83
|
<table class="tabcont" colspan="3" cellpadding="3" width="100%">
|
84
|
<?php
|
85
|
|
86
|
|
87
|
/* table header */
|
88
|
print "<tr><td colspan=7><b>Nearby access points or ad-hoc peers.<br/></td></tr>\n";
|
89
|
print "\n<tr>";
|
90
|
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
|
$rwlif = get_real_interface($if);
|
101
|
exec("/sbin/ifconfig {$rwlif} list scan 2>&1", $states, $ret);
|
102
|
/* Skip Header */
|
103
|
array_shift($states);
|
104
|
|
105
|
$counter=0;
|
106
|
foreach($states as $state) {
|
107
|
/* Split by Mac address for the SSID Field */
|
108
|
$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
|
$ssid = $split[0];
|
111
|
$bssid = $bssid[0];
|
112
|
/* 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
|
print "<tr>";
|
122
|
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
|
print "</tr>\n";
|
130
|
}
|
131
|
|
132
|
print "</table><table class=\"tabcont\" colspan=\"3\" cellpadding=\"3\" width=\"100%\">";
|
133
|
|
134
|
/* table header */
|
135
|
print "\n<tr>";
|
136
|
print "<tr><td colspan=7><b>Associated or ad-hoc peers.<br/></td></tr>\n";
|
137
|
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
|
|
150
|
$states = array();
|
151
|
exec("/sbin/ifconfig {$rwlif} list sta 2>&1", $states, $ret);
|
152
|
array_shift($states);
|
153
|
|
154
|
$counter=0;
|
155
|
foreach($states as $state) {
|
156
|
$split = preg_split("/[ ]+/i", $state);
|
157
|
/* Split the rest by using spaces for this line using the 2nd part */
|
158
|
print "<tr>";
|
159
|
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
|
print "</tr>\n";
|
170
|
}
|
171
|
|
172
|
/* XXX: what stats to we get for adhoc mode? */
|
173
|
|
174
|
?>
|
175
|
</table>
|
176
|
</div>
|
177
|
</td></tr>
|
178
|
</table>
|
179
|
|
180
|
<?php include("fend.inc"); ?>
|
181
|
</body>
|
182
|
</html>
|