diff options
author | Erik Fonnesbeck <efonnes@gmail.com> | 2010-05-02 00:51:42 -0600 |
---|---|---|
committer | Erik Fonnesbeck <efonnes@gmail.com> | 2010-05-02 00:51:42 -0600 |
commit | f4094f0ddc3a26668d4cf272380b683c4ee039e5 (patch) | |
tree | 4c570ad778eb51cfc3c7622e4091f54789b0f508 /etc/inc/interfaces.inc | |
parent | 4b85f09622889a4a6665e55a61bcf732da8d1bd2 (diff) | |
download | pfsense-f4094f0ddc3a26668d4cf272380b683c4ee039e5.zip pfsense-f4094f0ddc3a26668d4cf272380b683c4ee039e5.tar.gz |
Display some extra information about the available wireless channels.
Diffstat (limited to 'etc/inc/interfaces.inc')
-rw-r--r-- | etc/inc/interfaces.inc | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc index edf92dd..41048d7 100644 --- a/etc/inc/interfaces.inc +++ b/etc/inc/interfaces.inc @@ -3037,7 +3037,6 @@ function get_wireless_modes($interface) { if(is_interface_wireless($wlif)) { $cloned_interface = get_real_interface($interface); - $wi = 1; $chan_list = "/sbin/ifconfig {$cloned_interface} list chan"; $stack_list = "/usr/bin/awk -F\"Channel \" '{ gsub(/\\*/, \" \"); print \$2 \"\\\n\" \$3 }'"; $format_list = "/usr/bin/awk '{print \$5 \" \" \$6 \",\" \$1}'"; @@ -3076,6 +3075,30 @@ function get_wireless_modes($interface) { return($wireless_modes); } +/* return channel numbers, frequency, max txpower, and max regulation txpower */ +function get_wireless_channel_info($interface) { + $wireless_channels = array(); + + $wlif = interface_translate_type_to_real($interface); + + if(is_interface_wireless($wlif)) { + $cloned_interface = get_real_interface($interface); + $chan_list = "/sbin/ifconfig {$cloned_interface} list txpower"; + $stack_list = "/usr/bin/awk -F\"Channel \" '{ gsub(/\\*/, \" \"); print \$2 \"\\\n\" \$3 }'"; + $format_list = "/usr/bin/awk '{print \$1 \",\" \$3 \" \" \$4 \",\" \$5 \",\" \$7}'"; + + $interface_channels = ""; + exec("$chan_list | $stack_list | sort -u | $format_list 2>&1", $interface_channels); + + foreach ($interface_channels as $channel_line) { + $channel_line = explode(",", $channel_line); + if(!isset($wireless_channels[$channel_line[0]])) + $wireless_channels[$channel_line[0]] = $channel_line; + } + } + return($wireless_channels); +} + /****f* interfaces/get_interface_mtu * NAME * get_interface_mtu - Return the mtu of an interface |