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>
This commit is contained in:
Jo-Philipp Wich 2018-01-03 21:27:10 +01:00
parent b121f95862
commit 75e9338b87

View file

@ -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