From e2d90eacaa1d352dbf19d7b9c05b1bc0ee1dc942 Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Sat, 21 Nov 2009 01:21:19 +0100 Subject: Fix the status wireless page for 2.0 using the correct _wlan0 interface name. Also bring over a fix for ssid values with spaces, there is a different fix in 1.2. This one splits on Mac address if they ever decide to list longer mac addresses instead of truncating to 16 characters. The IEEE says it can be upto 32 characters in length. --- usr/local/www/status_wireless.php | 50 ++++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 24 deletions(-) (limited to 'usr') diff --git a/usr/local/www/status_wireless.php b/usr/local/www/status_wireless.php index 6ebac7f..f1f70f3 100755 --- a/usr/local/www/status_wireless.php +++ b/usr/local/www/status_wireless.php @@ -96,7 +96,7 @@ display_top_tabs($tab_array); /* table header */ - print "\n"; + print "\n"; print ""; print "SSID"; print "BSSID"; @@ -107,38 +107,39 @@ display_top_tabs($tab_array); print "CAPS"; print "\n\n"; - $states=split("\n",`/sbin/ifconfig {$if} list scan | grep -v "CHAN RATE"`); + exec("/sbin/ifconfig {$if}_wlan0 list scan 2>&1", $states, $ret); + /* Skip Header */ + array_shift($states); $counter=0; foreach($states as $state) { - $state_fixed = str_replace(" ", " ", $state); - $state_fixed = str_replace(" ", " ", $state_fixed); - $state_fixed = str_replace(" ", " ", $state_fixed); - $state_fixed = str_replace(" ", " ", $state_fixed); - $state_fixed = str_replace(" ", " ", $state_fixed); - $state_fixed = str_replace(" ", " ", $state_fixed); - $state_fixed = str_replace(" ", " ", $state_fixed); - $state_split = split(" ", $state_fixed); - print ""; - $state_split = split(" ", $state_fixed); - $items = count($state_split); - $starting_at = $items-8; + /* Split by Mac address for the SSID Field */ + $split = preg_split("/[ ]+[0-9a-f][[0-9a-f]\:[0-9a-f][[0-9a-f]\:/i", $state); + $ssid = $split[0]; + /* Split the rest by using spaces for this line using the 2nd part */ + $split = preg_split("/[ ]+/i", $split[1]); + $bssid = $split[0]; + $channel = $split[1]; + $rate = $split[2]; + $rssi = $split[3]; + $int = $split[4]; + $caps = "$split[5] $split[6] $split[7] $split[8] $split[9] $split[10] $split[11] "; + print ""; - print "{$state_split[$starting_at]}"; - print "{$state_split[$starting_at+1]}"; - print "{$state_split[$starting_at+2]}"; - print "{$state_split[$starting_at+3]}"; - print "{$state_split[$starting_at+4]}"; - print "{$state_split[$starting_at+5]}"; - print "{$state_split[$starting_at+6]}"; + print "{$ssid}"; + print "{$bssid}"; + print "{$channel}"; + print "{$rate}"; + print "{$rssi}"; + print "{$int}"; + print "{$caps}"; print "\n"; - print "\n"; } print ""; /* table header */ - print "\n"; + print "\n"; print ""; print ""; print ""; @@ -152,7 +153,8 @@ display_top_tabs($tab_array); print ""; print "\n\n"; - $states=split("\n",`/sbin/ifconfig {$if} list sta | grep -v "AID CHAN"`); + exec("/sbin/ifconfig {$if}_wlan0 list sta 2>&1", $states, $ret); + array_shift($states); $counter=0; foreach($states as $state) { -- cgit v1.1
ADDRAIDERP