diff options
author | Petr Machata <petrm@mellanox.com> | 2018-04-29 10:56:08 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-04-30 19:42:40 +0300 |
commit | 4d4fd36126d66d6091ca5aaabab262b5da3849c5 (patch) | |
tree | a51be25d13043d00071ac504f98284a47da0ed1a /net/bridge/br_fdb.c | |
parent | 6df93462c2e3ed9656829078aa68214c64619042 (diff) | |
download | linux-4d4fd36126d66d6091ca5aaabab262b5da3849c5.tar.xz |
net: bridge: Publish bridge accessor functions
Add a couple new functions to allow querying FDB and vlan settings of a
bridge.
Signed-off-by: Petr Machata <petrm@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/bridge/br_fdb.c')
-rw-r--r-- | net/bridge/br_fdb.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c index d9e69e4514be..a1c409cacec4 100644 --- a/net/bridge/br_fdb.c +++ b/net/bridge/br_fdb.c @@ -121,6 +121,28 @@ static struct net_bridge_fdb_entry *br_fdb_find(struct net_bridge *br, return fdb; } +struct net_device *br_fdb_find_port(const struct net_device *br_dev, + const unsigned char *addr, + __u16 vid) +{ + struct net_bridge_fdb_entry *f; + struct net_device *dev = NULL; + struct net_bridge *br; + + ASSERT_RTNL(); + + if (!netif_is_bridge_master(br_dev)) + return NULL; + + br = netdev_priv(br_dev); + f = br_fdb_find(br, addr, vid); + if (f && f->dst) + dev = f->dst->dev; + + return dev; +} +EXPORT_SYMBOL_GPL(br_fdb_find_port); + struct net_bridge_fdb_entry *br_fdb_find_rcu(struct net_bridge *br, const unsigned char *addr, __u16 vid) |