diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2010-09-27 13:59:51 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2010-09-27 13:59:51 +0000 |
commit | c3b79ead2ef3df23a4f24cbd0b71ff1792b70655 (patch) | |
tree | a6cf669b57b6ab2253ed9a9898c78c3ff2e1dd19 /contrib | |
parent | 2540d278c59e4d1b33efccc4ffab8c7240ba598d (diff) |
[libiwinfo] fix crash in iwinfo cli when operating on monitor interfaces
Diffstat (limited to 'contrib')
-rwxr-xr-x | contrib/package/iwinfo/src/iwinfo.lua | 14 |
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") |