Changeset 5391
- Timestamp:
- 10/10/09 15:53:39 (4 years ago)
- Files:
-
- 1 modified
-
luci/trunk/libs/core/luasrc/model/network.lua (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
luci/trunk/libs/core/luasrc/model/network.lua
r5387 r5391 33 33 34 34 local ub = uct.bind("network") 35 local ifs, brs 35 local ifs, brs, sws 36 36 37 37 function init(cursor) … … 43 43 ifs = { } 44 44 brs = { } 45 sws = { } 45 46 46 47 -- read interface information … … 48 49 for n, i in ipairs(nxo.getifaddrs()) do 49 50 local name = i.name:match("[^:]+") 51 local prnt = name:match("^([^%.]+)%.") 50 52 51 53 if not _M:ignore_interface(name) then … … 58 60 ip6addrs = { } 59 61 } 62 63 if prnt then 64 sws[name] = true 65 sws[prnt] = true 66 end 60 67 61 68 if i.family == "packet" then … … 230 237 local ifaces = { } 231 238 local iface 232 for _, iface in ub:list( 233 (self:ifname() or '') .. ' ' .. (self:device() or '') 234 ) do 239 for _, iface in ipairs(ub:list(self:ifname())) do 235 240 iface = iface:match("[^:]+") 236 241 if ifs[iface] then … … 243 248 function network.contains_interface(self, iface) 244 249 local i 245 local ifaces = ub:list( 246 (self:ifname() or '') .. ' ' .. (self:device() or '') 247 ) 250 local ifaces = ub:list(self:ifname()) 248 251 249 252 if type(iface) ~= "string" then … … 291 294 elseif brs[self.ifname] then 292 295 return "bridge" 293 elseif s elf.ifname:match("%.") then296 elseif sws[self.ifname] or self.ifname:match("%.") then 294 297 return "switch" 295 298 else
