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