Project

General

Profile

Download (5.81 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 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);
118
		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);
119 e2d90eac Seth Mos
		$ssid = $split[0];
120 22275785 Seth Mos
		$bssid = $bssid[0];
121 e2d90eac Seth Mos
		/* Split the rest by using spaces for this line using the 2nd part */
122
		$split = preg_split("/[ ]+/i", $split[1]);
123
		$bssid = $split[0];
124
		$channel = $split[1];
125
		$rate = $split[2];
126
		$rssi = $split[3];
127
		$int = $split[4];
128
		$caps = "$split[5] $split[6] $split[7] $split[8] $split[9] $split[10] $split[11] ";
129
130 bdeca4ed Scott Ullrich
		print "<tr>";
131 e2d90eac Seth Mos
		print "<td>{$ssid}</td>";
132
		print "<td>{$bssid}</td>";
133
		print "<td>{$channel}</td>";
134
		print "<td>{$rate}</td>";
135
		print "<td>{$rssi}</td>";
136
		print "<td>{$int}</td>";
137
		print "<td>{$caps}</td>";
138 6c40c007 Scott Ullrich
		print "</tr>\n";
139 f2f0c37e Scott Ullrich
	}
140 c29ad853 Scott Ullrich
141
	print "</table><table class=\"tabcont\" colspan=\"3\" cellpadding=\"3\" width=\"100%\">";
142
143 f2f0c37e Scott Ullrich
	/* table header */
144 e2d90eac Seth Mos
	print "\n<tr>";
145 f2f0c37e Scott Ullrich
	print "<tr bgcolor='#990000'>";
146
	print "<td><b><font color='#ffffff'>ADDR</td>";
147
	print "<td><b><font color='#ffffff'>AID</td>";
148
	print "<td><b><font color='#ffffff'>CHAN</td>";
149
	print "<td><b><font color='#ffffff'>RATE</td>";
150
	print "<td><b><font color='#ffffff'>RSSI</td>";
151
	print "<td><b><font color='#ffffff'>IDLE</td>";
152
	print "<td><b><font color='#ffffff'>TXSEQ</td>";
153
	print "<td><b><font color='#ffffff'>RXSEQ</td>";
154
	print "<td><b><font color='#ffffff'>CAPS</td>";
155
	print "<td><b><font color='#ffffff'>ERP</td>";
156
	print "</tr>\n\n";
157 d0330501 Scott Ullrich
158 105bb6a6 Seth Mos
	$states = array();
159 e2d90eac Seth Mos
	exec("/sbin/ifconfig {$if}_wlan0 list sta 2>&1", $states, $ret);
160
	array_shift($states);
161 f2f0c37e Scott Ullrich
162
	$counter=0;
163
	foreach($states as $state) {
164 105bb6a6 Seth Mos
		$split = preg_split("/[ ]+/i", $state);
165
		/* Split the rest by using spaces for this line using the 2nd part */
166 f2f0c37e Scott Ullrich
		print "<tr>";
167 105bb6a6 Seth Mos
		print "<td>{$split[0]}</td>";
168
		print "<td>{$split[1]}</td>";
169
		print "<td>{$split[2]}</td>";
170
		print "<td>{$split[3]}</td>";
171
		print "<td>{$split[4]}</td>";
172
		print "<td>{$split[5]}</td>";
173
		print "<td>{$split[6]}</td>";
174
		print "<td>{$split[7]}</td>";
175
		print "<td>{$split[8]}</td>";
176
		print "<td>{$split[9]}</td>";
177 f2f0c37e Scott Ullrich
		print "</tr>\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>