libs/core: non-bridge handling fix in network model

This commit is contained in:
Jo-Philipp Wich 2011-09-24 03:31:00 +00:00
parent 3311da13e7
commit 47f011b947

View file

@ -791,26 +791,23 @@ function network.get_interfaces(self)
ifaces[#ifaces+1] = nfs[ifn] ifaces[#ifaces+1] = nfs[ifn]
end end
local num = { } if self:is_bridge() then
local wfs = { } local num = { }
uci_r:foreach("wireless", "wifi-iface", local wfs = { }
function(s) uci_r:foreach("wireless", "wifi-iface",
if s.device then function(s)
num[s.device] = num[s.device] and num[s.device] + 1 or 1 if s.device then
if s.network == self.sid then num[s.device] = num[s.device] and num[s.device] + 1 or 1
ifn = "%s.network%d" %{ s.device, num[s.device] } if s.network == self.sid then
wfs[ifn] = interface(ifn, self) ifn = "%s.network%d" %{ s.device, num[s.device] }
wfs[ifn] = interface(ifn, self)
end
end end
end end)
end)
for ifn in utl.kspairs(wfs) do for ifn in utl.kspairs(wfs) do
ifaces[#ifaces+1] = wfs[ifn] ifaces[#ifaces+1] = wfs[ifn]
end
-- only bridges may cover more than one interface
--if not self:is_bridge() then
-- break
--end
end end
return ifaces return ifaces