Show
Ignore:
Timestamp:
10/30/10 03:33:06 (3 years ago)
Author:
jow
Message:

libs/core: fix various bugs in network model

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • luci/trunk/libs/core/luasrc/model/network.lua

    r6349 r6358  
    162162 
    163163function init(cursor) 
    164     uci_r = cursor or luci.model.uci.cursor() 
    165     uci_s = cursor:substate() 
     164    uci_r = cursor or uci.cursor() 
     165    uci_s = uci_r:substate() 
    166166 
    167167    ifs = { } 
     
    899899    options.device = self.sid 
    900900 
    901     local wnet = uci_r:section("wifidev", "wifi-iface", nil, options) 
     901    local wnet = uci_r:section("wireless", "wifi-iface", nil, options) 
    902902    if wnet then 
    903         return wifinet(wnet) 
     903        return wifinet(wnet, options) 
    904904    end 
    905905end 
     
    922922 
    923923wifinet = utl.class() 
    924 function wifinet.__init__(self, net) 
     924function wifinet.__init__(self, net, data) 
    925925    self.sid = net 
    926926 
     
    941941 
    942942    self.wdev   = dev 
    943     self.iwdata = uci_s:get_all("wireless", self.sid) or { } 
    944943    self.iwinfo = dev and sys.wifi.getiwinfo(dev) or { } 
     944    self.iwdata = data or uci_s:get_all("wireless", self.sid) or 
     945        uci_r:get_all("wireless", self.sid) or { } 
    945946end 
    946947 
     
    10091010 
    10101011function wifinet.active_bssid(self) 
    1011     return _stror(self.iwinfo.bssid, self.iwinfo.bssid) or "00:00:00:00:00:00" 
     1012    return _stror(self.iwinfo.bssid, self.iwdata.bssid) or "00:00:00:00:00:00" 
    10121013end 
    10131014