Changeset 5425

Show
Ignore:
Timestamp:
10/27/09 22:34:06 (4 years ago)
Author:
jow
Message:

libs/core: fixes for luci.model.firewall, luci.model.network and luci.model.network.wireless

Location:
luci/trunk/libs/core/luasrc/model
Files:
3 modified

Legend:

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

    r5388 r5425  
    235235            src     = self:name(), 
    236236            dest    = dest, 
    237             mtu_fix = with_mtu_fix and true or false 
     237            mtu_fix = with_mtu_fix and "1" or "0" 
    238238        }) 
    239239        return s and forwarding(s) 
     
    253253            src     = src, 
    254254            dest    = self:name(), 
    255             mtu_fix = with_mtu_fix and true or false 
     255            mtu_fix = with_mtu_fix and "1" or "0" 
    256256        }) 
    257257        return s and forwarding(s) 
    258258    end 
     259end 
     260 
     261function zone.del_forwardings_by(self, what) 
     262    local name = self:name() 
     263    ub.uci:foreach("firewall", "forwarding", 
     264        function(s) 
     265            if s.src and s.dest and s[what] == name then 
     266                ub.uci:delete("firewall", s['.name']) 
     267            end 
     268        end) 
    259269end 
    260270 
  • luci/trunk/libs/core/luasrc/model/network.lua

    r5405 r5425  
    218218 
    219219function get_interface(self, i) 
    220     return ifs[i] and interface(i) 
     220    if ifs[i] then 
     221        return interface(i) 
     222    else 
     223        local j 
     224        for j, _ in pairs(ifs) do 
     225            if ifs[j].sid == i then 
     226                return interface(j) 
     227            end 
     228        end 
     229    end 
    221230end 
    222231 
  • luci/trunk/libs/core/luasrc/model/network/wireless.lua

    r5405 r5425  
    4545            local device = s.device or "wlan0" 
    4646            local state = st:get_all("wireless", s['.name']) 
    47             local name = state.ifname or device .. ".network" .. count 
     47            local name = device .. ".network" .. count 
    4848             
    49             ifs[state and state.ifname or name] = { 
     49            ifs[name] = { 
    5050                idx      = count, 
    51                 name     = state and state.ifname or name, 
     51                name     = name, 
    5252                rawname  = state and state.ifname or name, 
    5353                flags    = { },