diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2010-12-05 03:57:29 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2010-12-05 03:57:29 +0000 |
commit | 5dd3b57bbbe526b2043da2a0c44fd7389af5834d (patch) | |
tree | 7098b53da9f29e89615236b2e5068c8d2a7e2dc3 | |
parent | ea294f0b645a04db24a7dc75057cec48f6493bd7 (diff) |
libs/core: always use internal network ids for admin links to wifi networks (#172)
-rw-r--r-- | libs/core/luasrc/model/network.lua | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/libs/core/luasrc/model/network.lua b/libs/core/luasrc/model/network.lua index 28237e49a..18c84b624 100644 --- a/libs/core/luasrc/model/network.lua +++ b/libs/core/luasrc/model/network.lua @@ -936,21 +936,22 @@ wifinet = utl.class() function wifinet.__init__(self, net, data) self.sid = net - local dev = uci_s:get("wireless", self.sid, "ifname") - if not dev then - local num = { } - uci_r:foreach("wireless", "wifi-iface", - function(s) - if s.device then - num[s.device] = num[s.device] and num[s.device] + 1 or 1 - if s['.name'] == self.sid then - dev = "%s.network%d" %{ s.device, num[s.device] } - return false - end + local num = { } + local netid + uci_r:foreach("wireless", "wifi-iface", + function(s) + if s.device then + num[s.device] = num[s.device] and num[s.device] + 1 or 1 + if s['.name'] == self.sid then + netid = "%s.network%d" %{ s.device, num[s.device] } + return false end - end) - end + end + end) + + local dev = uci_s:get("wireless", self.sid, "ifname") or netid + self.netid = netid self.wdev = dev self.iwinfo = dev and sys.wifi.getiwinfo(dev) or { } self.iwdata = data or uci_s:get_all("wireless", self.sid) or @@ -1109,7 +1110,7 @@ end function wifinet.adminlink(self) return dsp.build_url("admin", "network", "wireless", - self.iwdata.device, self.wdev) + self.iwdata.device, self.netid) end function wifinet.get_network(self) |