summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2010-09-27 13:59:51 +0000
committerJo-Philipp Wich <jow@openwrt.org>2010-09-27 13:59:51 +0000
commitc3b79ead2ef3df23a4f24cbd0b71ff1792b70655 (patch)
treea6cf669b57b6ab2253ed9a9898c78c3ff2e1dd19
parent2540d278c59e4d1b33efccc4ffab8c7240ba598d (diff)
[libiwinfo] fix crash in iwinfo cli when operating on monitor interfaces
-rwxr-xr-xcontrib/package/iwinfo/src/iwinfo.lua14
1 files changed, 9 insertions, 5 deletions
diff --git a/contrib/package/iwinfo/src/iwinfo.lua b/contrib/package/iwinfo/src/iwinfo.lua
index bbd2ff750..caa2816fe 100755
--- a/contrib/package/iwinfo/src/iwinfo.lua
+++ b/contrib/package/iwinfo/src/iwinfo.lua
@@ -24,12 +24,16 @@ end
function print_info(api, dev)
local iw = iwinfo[api]
+ local enc = iw.encryption(dev)
- printf("%-9s Type: %s ESSID: \"%s\"", dev, api, iw.ssid(dev))
- printf(" Access Point: %s", iw.bssid(dev))
+ printf("%-9s Type: %s ESSID: \"%s\"",
+ dev, api, s(iw.ssid(dev)))
+
+ printf(" Access Point: %s",
+ s(iw.bssid(dev)))
printf(" Mode: %s Channel: %d (%.3f GHz)",
- iw.mode(dev), iw.channel(dev), n(iw.frequency(dev)) / 1000)
+ iw.mode(dev), n(iw.channel(dev)), n(iw.frequency(dev)) / 1000)
printf(" Tx-Power: %s dBm Link Quality: %s/%s",
s(iw.txpower(dev)), s(iw.quality(dev)), s(iw.quality_max(dev)))
@@ -41,7 +45,7 @@ function print_info(api, dev)
n(iw.bitrate(dev)) / 1000)
printf(" Encryption: %s",
- iw.encryption(dev).description)
+ s(enc and enc.description))
print("")
end
@@ -84,7 +88,7 @@ function print_txpwrlist(api, dev)
for _, pe in ipairs(pl) do
printf("%s%3d dBm (%4d mW)",
(cp == pe.dbm) and "*" or " ",
- pe.dbm, pe.mw)
+ n(pe.dbm), n(pe.mw))
end
else
print("No TX power information available")