diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2010-10-30 02:33:06 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2010-10-30 02:33:06 +0000 |
commit | 2b7ba80b8a441356f3b1b3a51cc120843c6c1b68 (patch) | |
tree | e8cb3ca5023982d07f63e40f98d003f789da19c7 /libs | |
parent | 87fd9de5b6e5cc2d319c896f4ab7b3ad0c56ae7e (diff) |
libs/core: fix various bugs in network model
Diffstat (limited to 'libs')
-rw-r--r-- | libs/core/luasrc/model/network.lua | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/libs/core/luasrc/model/network.lua b/libs/core/luasrc/model/network.lua index 858753f7f..101bba38d 100644 --- a/libs/core/luasrc/model/network.lua +++ b/libs/core/luasrc/model/network.lua @@ -161,8 +161,8 @@ end function init(cursor) - uci_r = cursor or luci.model.uci.cursor() - uci_s = cursor:substate() + uci_r = cursor or uci.cursor() + uci_s = uci_r:substate() ifs = { } brs = { } @@ -898,9 +898,9 @@ function wifidev.add_wifinet(self, options) options = options or { } options.device = self.sid - local wnet = uci_r:section("wifidev", "wifi-iface", nil, options) + local wnet = uci_r:section("wireless", "wifi-iface", nil, options) if wnet then - return wifinet(wnet) + return wifinet(wnet, options) end end @@ -921,7 +921,7 @@ end wifinet = utl.class() -function wifinet.__init__(self, net) +function wifinet.__init__(self, net, data) self.sid = net local dev = uci_s:get("wireless", self.sid, "ifname") @@ -940,8 +940,9 @@ function wifinet.__init__(self, net) end self.wdev = dev - self.iwdata = uci_s:get_all("wireless", self.sid) or { } self.iwinfo = dev and sys.wifi.getiwinfo(dev) or { } + self.iwdata = data or uci_s:get_all("wireless", self.sid) or + uci_r:get_all("wireless", self.sid) or { } end function wifinet.get(self, opt) @@ -1008,7 +1009,7 @@ function wifinet.active_ssid(self) end function wifinet.active_bssid(self) - return _stror(self.iwinfo.bssid, self.iwinfo.bssid) or "00:00:00:00:00:00" + return _stror(self.iwinfo.bssid, self.iwdata.bssid) or "00:00:00:00:00:00" end function wifinet.active_encryption(self) |