diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2014-10-21 23:38:51 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2014-10-21 23:39:08 +0200 |
commit | ecb0c2f11b861e5035b0397d2396ee4b5e9b3c3e (patch) | |
tree | 4dbcd4c13a35049bb6efd20aab074e715c7f54b7 /modules/base/luasrc/model | |
parent | ff65318ba52109f4ca7eb83a639ecddda2a8b3fc (diff) |
modules/base: work around wireless status changes
The latest netifd updates changed the ubus wireless status reporting in a
way that breaks the current LuCI integration. Work around the changed
format by translating the extended UCI section syntax back to the plain one.
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
Diffstat (limited to 'modules/base/luasrc/model')
-rw-r--r-- | modules/base/luasrc/model/network.lua | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/modules/base/luasrc/model/network.lua b/modules/base/luasrc/model/network.lua index 0aac416ace..6119abd73c 100644 --- a/modules/base/luasrc/model/network.lua +++ b/modules/base/luasrc/model/network.lua @@ -135,13 +135,25 @@ function _wifi_iface(x) end function _wifi_state(key, val, field) + local radio, radiostate, ifc, ifcstate + if not next(_ubuswificache) then _ubuswificache = _ubus:call("network.wireless", "status", {}) or {} + + -- workaround extended section format + for radio, radiostate in pairs(_ubuswificache) do + for ifc, ifcstate in pairs(radiostate.interfaces) do + if ifcstate.section and ifcstate.section:sub(1, 1) == '@' then + local s = _uci_real:get_all('wireless.%s' % ifcstate.section) + if s then + ifcstate.section = s['.name'] + end + end + end + end end - local radio, radiostate for radio, radiostate in pairs(_ubuswificache) do - local ifc, ifcstate for ifc, ifcstate in pairs(radiostate.interfaces) do if ifcstate[key] == val then return ifcstate[field] |