summaryrefslogtreecommitdiffhomepage
path: root/modules
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2018-01-03 21:27:10 +0100
committerJo-Philipp Wich <jo@mein.io>2018-01-03 21:27:49 +0100
commit75e9338b87f0dca1a6fdd847236c3a34ea7bd62e (patch)
treef5505face9143f55250baf93455bbd88da71505c /modules
parentb121f958621efd5d81451e2de3e7d35a828645bc (diff)
luci-base: fix luci.sys.wifi.getiwinfo() on radio names
Fall back to using a phy-wide iwinfo handle if the vif query yields no result. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules')
-rw-r--r--modules/luci-base/luasrc/sys.lua14
1 files changed, 12 insertions, 2 deletions
diff --git a/modules/luci-base/luasrc/sys.lua b/modules/luci-base/luasrc/sys.lua
index 3fcfd4def..84c747f2b 100644
--- a/modules/luci-base/luasrc/sys.lua
+++ b/modules/luci-base/luasrc/sys.lua
@@ -453,8 +453,18 @@ wifi = {}
function wifi.getiwinfo(ifname)
ntm.init()
- local wnet = ntm.wifinet(ifname)
- return wnet.iwinfo or { ifname = ifname }
+
+ local wnet = ntm:get_wifinet(ifname)
+ if wnet and wnet.iwinfo then
+ return wnet.iwinfo
+ end
+
+ local wdev = ntm:get_wifidev(ifname)
+ if wdev and wdev.iwinfo then
+ return wdev.iwinfo
+ end
+
+ return { ifname = ifname }
end