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
|
function gentitle_pkg($pgname) {
|
42
|
global $config;
|
43
|
return $config['system']['hostname'] . "." . $config['system']['domain'] . " - " . $pgname;
|
44
|
}
|
45
|
|
46
|
$pgtitle = array("Diagnostics","Wireless Status");
|
47
|
include("head.inc");
|
48
|
|
49
|
$if = $_POST['if'];
|
50
|
if($_GET['if'] <> "")
|
51
|
$if = $_GET['if'];
|
52
|
if($if == "") {
|
53
|
/* Find the first interface
|
54
|
that is wireless */
|
55
|
foreach($config['interfaces'] as $interface) {
|
56
|
if($interface['wireless'] <> "") {
|
57
|
$if = $interface['if'];
|
58
|
}
|
59
|
}
|
60
|
}
|
61
|
?>
|
62
|
|
63
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
|
64
|
<?php
|
65
|
include("fbegin.inc");
|
66
|
?>
|
67
|
<form action="status_wireless.php" method="post">
|
68
|
<?php if ($savemsg) print_info_box($savemsg); ?>
|
69
|
|
70
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
71
|
<tr><td>
|
72
|
<?php
|
73
|
$tab_array = array();
|
74
|
$mode = "";
|
75
|
foreach($config['interfaces'] as $interface) {
|
76
|
if($interface['wireless'] <> "") {
|
77
|
if($if == $interface['if']) {
|
78
|
$enabled = true;
|
79
|
$mode = $interface['wireless']['mode'];
|
80
|
} else
|
81
|
$enabled = false;
|
82
|
$friendly = convert_real_interface_to_friendly_interface_name($interface['if']);
|
83
|
if($interface['descr'] <> "")
|
84
|
$friendly = $interface['descr'];
|
85
|
$tab_array[] = array("Status ($friendly)", $enabled, "status_wireless.php?if={$interface['if']}");
|
86
|
}
|
87
|
}
|
88
|
/* XXX: add other wireless interfaces here */
|
89
|
display_top_tabs($tab_array);
|
90
|
?>
|
91
|
</td></tr>
|
92
|
<tr><td>
|
93
|
<div id="mainarea">
|
94
|
<table class="tabcont" colspan="3" cellpadding="3" width="100%">
|
95
|
<?php
|
96
|
|
97
|
|
98
|
/* table header */
|
99
|
print "\n<tr><!-- " . count($state_split) . " -->";
|
100
|
print "<tr bgcolor='#990000'>";
|
101
|
print "<td><b><font color='#ffffff'>SSID</td>";
|
102
|
print "<td><b><font color='#ffffff'>BSSID</td>";
|
103
|
print "<td><b><font color='#ffffff'>CHAN</td>";
|
104
|
print "<td><b><font color='#ffffff'>RATE</td>";
|
105
|
print "<td><b><font color='#ffffff'>RSSI</td>";
|
106
|
print "<td><b><font color='#ffffff'>INT</td>";
|
107
|
print "<td><b><font color='#ffffff'>CAPS</td>";
|
108
|
print "</tr>\n\n";
|
109
|
|
110
|
$states=split("\n",`/sbin/ifconfig {$if} list scan | grep -v "CHAN RATE"`);
|
111
|
|
112
|
$counter=0;
|
113
|
foreach($states as $state) {
|
114
|
$state_fixed = str_replace(" ", " ", $state);
|
115
|
$state_fixed = str_replace(" ", " ", $state_fixed);
|
116
|
$state_fixed = str_replace(" ", " ", $state_fixed);
|
117
|
$state_fixed = str_replace(" ", " ", $state_fixed);
|
118
|
$state_fixed = str_replace(" ", " ", $state_fixed);
|
119
|
$state_fixed = str_replace(" ", " ", $state_fixed);
|
120
|
$state_fixed = str_replace(" ", " ", $state_fixed);
|
121
|
$state_split = split(" ", $state_fixed);
|
122
|
print "<tr>";
|
123
|
$state_split = split(" ", $state_fixed);
|
124
|
$items = count($state_split);
|
125
|
$starting_at = $items-8;
|
126
|
print "<tr>";
|
127
|
print "<td>{$state_split[$starting_at]}</td>";
|
128
|
print "<td>{$state_split[$starting_at+1]}</td>";
|
129
|
print "<td>{$state_split[$starting_at+2]}</td>";
|
130
|
print "<td>{$state_split[$starting_at+3]}</td>";
|
131
|
print "<td>{$state_split[$starting_at+4]}</td>";
|
132
|
print "<td>{$state_split[$starting_at+5]}</td>";
|
133
|
print "<td>{$state_split[$starting_at+6]}</td>";
|
134
|
print "</tr>\n";
|
135
|
print "<!-- $state_fixed -->\n";
|
136
|
}
|
137
|
|
138
|
print "</table><table class=\"tabcont\" colspan=\"3\" cellpadding=\"3\" width=\"100%\">";
|
139
|
|
140
|
/* table header */
|
141
|
print "\n<tr><!-- " . count($state_split) . " -->";
|
142
|
print "<tr bgcolor='#990000'>";
|
143
|
print "<td><b><font color='#ffffff'>ADDR</td>";
|
144
|
print "<td><b><font color='#ffffff'>AID</td>";
|
145
|
print "<td><b><font color='#ffffff'>CHAN</td>";
|
146
|
print "<td><b><font color='#ffffff'>RATE</td>";
|
147
|
print "<td><b><font color='#ffffff'>RSSI</td>";
|
148
|
print "<td><b><font color='#ffffff'>IDLE</td>";
|
149
|
print "<td><b><font color='#ffffff'>TXSEQ</td>";
|
150
|
print "<td><b><font color='#ffffff'>RXSEQ</td>";
|
151
|
print "<td><b><font color='#ffffff'>CAPS</td>";
|
152
|
print "<td><b><font color='#ffffff'>ERP</td>";
|
153
|
print "</tr>\n\n";
|
154
|
|
155
|
$states=split("\n",`/sbin/ifconfig {$if} list sta | grep -v "AID CHAN"`);
|
156
|
|
157
|
$counter=0;
|
158
|
foreach($states as $state) {
|
159
|
$state_fixed = str_replace(" ", " ", $state);
|
160
|
$state_fixed = str_replace(" ", " ", $state_fixed);
|
161
|
$state_fixed = str_replace(" ", " ", $state_fixed);
|
162
|
$state_split = split(" ", $state_fixed);
|
163
|
print "<tr>";
|
164
|
print "<td>{$state_split[0]}</td>";
|
165
|
print "<td>{$state_split[1]}</td>";
|
166
|
print "<td>{$state_split[2]}</td>";
|
167
|
print "<td>{$state_split[3]}</td>";
|
168
|
print "<td>{$state_split[4]}</td>";
|
169
|
print "<td>{$state_split[5]}</td>";
|
170
|
print "<td>{$state_split[6]}</td>";
|
171
|
print "<td>{$state_split[7]}</td>";
|
172
|
print "<td>{$state_split[8]}</td>";
|
173
|
print "<td>{$state_split[9]}</td>";
|
174
|
print "</tr>\n";
|
175
|
print "<!-- $state_fixed -->\n";
|
176
|
}
|
177
|
|
178
|
/* XXX: what stats to we get for adhoc mode? */
|
179
|
|
180
|
?>
|
181
|
</table>
|
182
|
</div>
|
183
|
</td></tr>
|
184
|
</table>
|
185
|
|
186
|
<?php include("fend.inc"); ?>
|
187
|
</body>
|
188
|
</html>
|