Project

General

Profile

Download (5.73 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
	
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 d0330501 Scott Ullrich
function gentitle_pkg($pgname) {
42 63637de9 Bill Marquette
	global $config;
43 d0330501 Scott Ullrich
	return $config['system']['hostname'] . "." . $config['system']['domain'] . " - " . $pgname;
44 5b237745 Scott Ullrich
}
45
46 d88c6a9f Scott Ullrich
$pgtitle = array("Diagnostics","Wireless Status");
47 4df96eff Scott Ullrich
include("head.inc");
48
49 d0330501 Scott Ullrich
$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 5b237745 Scott Ullrich
?>
62
63 d0330501 Scott Ullrich
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
64
<?php
65
include("fbegin.inc");
66
?>
67 53961f06 Scott Ullrich
<form action="status_wireless.php" method="post">
68 d0330501 Scott Ullrich
<?php if ($savemsg) print_info_box($savemsg); ?>
69 d0440f75 Scott Ullrich
70 d0330501 Scott Ullrich
<table width="100%" border="0" cellpadding="0" cellspacing="0">
71
<tr><td>
72
<?php
73
$tab_array = array();
74 f2f0c37e Scott Ullrich
$mode = "";
75 d0330501 Scott Ullrich
foreach($config['interfaces'] as $interface) {
76
	if($interface['wireless'] <> "") {
77 59f6095f Scott Ullrich
		if($if == $interface['if']) {
78 d0330501 Scott Ullrich
			$enabled = true;
79 59f6095f Scott Ullrich
			$mode = $interface['wireless']['mode'];
80
		} else
81 d0330501 Scott Ullrich
			$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 53961f06 Scott Ullrich
<tr><td>
93
<div id="mainarea">
94
<table class="tabcont" colspan="3" cellpadding="3" width="100%">
95 351cbef7 Scott Ullrich
<?php
96
97 c29ad853 Scott Ullrich
98 f2f0c37e Scott Ullrich
	/* table header */
99 e2d90eac Seth Mos
	print "\n<tr>";
100 f2f0c37e Scott Ullrich
	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 e2d90eac Seth Mos
	exec("/sbin/ifconfig {$if}_wlan0 list scan 2>&1", $states, $ret);
111
	/* Skip Header */
112
	array_shift($states);
113 d0330501 Scott Ullrich
114 f2f0c37e Scott Ullrich
	$counter=0;
115
	foreach($states as $state) {
116 e2d90eac Seth Mos
		/* Split by Mac address for the SSID Field */
117
		$split = preg_split("/[ ]+[0-9a-f][[0-9a-f]\:[0-9a-f][[0-9a-f]\:/i", $state);
118
		$ssid = $split[0];
119
		/* Split the rest by using spaces for this line using the 2nd part */
120
		$split = preg_split("/[ ]+/i", $split[1]);
121
		$bssid = $split[0];
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 c29ad853 Scott Ullrich
139
	print "</table><table class=\"tabcont\" colspan=\"3\" cellpadding=\"3\" width=\"100%\">";
140
141 f2f0c37e Scott Ullrich
	/* table header */
142 e2d90eac Seth Mos
	print "\n<tr>";
143 f2f0c37e Scott Ullrich
	print "<tr bgcolor='#990000'>";
144
	print "<td><b><font color='#ffffff'>ADDR</td>";
145
	print "<td><b><font color='#ffffff'>AID</td>";
146
	print "<td><b><font color='#ffffff'>CHAN</td>";
147
	print "<td><b><font color='#ffffff'>RATE</td>";
148
	print "<td><b><font color='#ffffff'>RSSI</td>";
149
	print "<td><b><font color='#ffffff'>IDLE</td>";
150
	print "<td><b><font color='#ffffff'>TXSEQ</td>";
151
	print "<td><b><font color='#ffffff'>RXSEQ</td>";
152
	print "<td><b><font color='#ffffff'>CAPS</td>";
153
	print "<td><b><font color='#ffffff'>ERP</td>";
154
	print "</tr>\n\n";
155 d0330501 Scott Ullrich
156 e2d90eac Seth Mos
	exec("/sbin/ifconfig {$if}_wlan0 list sta 2>&1", $states, $ret);
157
	array_shift($states);
158 f2f0c37e Scott Ullrich
159
	$counter=0;
160
	foreach($states as $state) {
161
		$state_fixed = str_replace("  ", " ", $state);
162
		$state_fixed = str_replace("  ", " ", $state_fixed);
163
		$state_fixed = str_replace("  ", " ", $state_fixed);
164
		$state_split = split(" ", $state_fixed);
165
		print "<tr>";
166
		print "<td>{$state_split[0]}</td>";
167
		print "<td>{$state_split[1]}</td>";
168
		print "<td>{$state_split[2]}</td>";
169
		print "<td>{$state_split[3]}</td>";
170
		print "<td>{$state_split[4]}</td>";
171
		print "<td>{$state_split[5]}</td>";
172
		print "<td>{$state_split[6]}</td>";
173
		print "<td>{$state_split[7]}</td>";
174
		print "<td>{$state_split[8]}</td>";
175
		print "<td>{$state_split[9]}</td>";
176
		print "</tr>\n";
177
		print "<!-- $state_fixed -->\n";
178
	}
179 351cbef7 Scott Ullrich
180 f2f0c37e Scott Ullrich
/* XXX: what stats to we get for adhoc mode? */ 
181
182 351cbef7 Scott Ullrich
?>
183 d0330501 Scott Ullrich
</table>
184 53961f06 Scott Ullrich
</div>
185 d0330501 Scott Ullrich
</td></tr>
186
</table>
187 d0440f75 Scott Ullrich
188 5b237745 Scott Ullrich
<?php include("fend.inc"); ?>
189 d0330501 Scott Ullrich
</body>
190
</html>