Project

General

Profile

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