diff options
author | Jo-Philipp Wich <jo@mein.io> | 2019-12-25 18:32:05 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-25 18:32:05 +0100 |
commit | 8362ab8d28c56702b77b99485c59f6cb090cfff9 (patch) | |
tree | ea2c7d8aeee90789666e97450a25d0c8910e422c /modules/luci-compat/luasrc/model/network.lua | |
parent | 7b4efa9ba3a817e914e5cc55139e8822e6bbb8ff (diff) | |
parent | 72247ee09f17fe1f7972de29ca8bc5910a956565 (diff) |
Merge pull request #1951 from tano-systems/luci-base-network-fix
luci-base: network.lua: bridge information request functions fixes
Diffstat (limited to 'modules/luci-compat/luasrc/model/network.lua')
-rw-r--r-- | modules/luci-compat/luasrc/model/network.lua | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/modules/luci-compat/luasrc/model/network.lua b/modules/luci-compat/luasrc/model/network.lua index 1a27b96f91..d717c52db5 100644 --- a/modules/luci-compat/luasrc/model/network.lua +++ b/modules/luci-compat/luasrc/model/network.lua @@ -371,6 +371,7 @@ function init(cursor) b.ifnames[1].bridge = b end _bridge[r[1]] = b + _interfaces[r[1]].bridge = b elseif b then b.ifnames[#b.ifnames+1] = _interfaces[r[2]] b.ifnames[#b.ifnames].bridge = b @@ -1447,20 +1448,21 @@ function interface.ports(self) for _, iface in ipairs(members) do ifaces[#ifaces+1] = interface(iface) end + return ifaces end end function interface.bridge_id(self) - if self.br then - return self.br.id + if self.dev and self.dev.bridge then + return self.dev.bridge.id else return nil end end function interface.bridge_stp(self) - if self.br then - return self.br.stp + if self.dev and self.dev.bridge then + return self.dev.bridge.stp else return false end @@ -1479,7 +1481,8 @@ function interface.is_bridge(self) end function interface.is_bridgeport(self) - return self.dev and self.dev.bridge and true or false + return self.dev and self.dev.bridge and + (self.dev.bridge.name != self:name()) and true or false end function interface.tx_bytes(self) |