From: Jo-Philipp Wich Date: Wed, 3 Jan 2018 20:27:10 +0000 (+0100) Subject: luci-base: fix luci.sys.wifi.getiwinfo() on radio names X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=75e9338b87f0dca1a6fdd847236c3a34ea7bd62e;p=project%2Fluci.git 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 --- diff --git a/modules/luci-base/luasrc/sys.lua b/modules/luci-base/luasrc/sys.lua index 3fcfd4def7..84c747f2bd 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