- local stat, iwinfo = pcall(require, "iwinfo")
-
- if ifname then
- local d, n = ifname:match("^(%w+)%.network(%d+)")
- local wstate = luci.util.ubus("network.wireless", "status") or { }
-
- d = d or ifname
- n = n and tonumber(n) or 1
-
- if type(wstate[d]) == "table" and
- type(wstate[d].interfaces) == "table" and
- type(wstate[d].interfaces[n]) == "table" and
- type(wstate[d].interfaces[n].ifname) == "string"
- then
- ifname = wstate[d].interfaces[n].ifname
- else
- ifname = d
- end