aboutsummaryrefslogtreecommitdiffstats
path: root/net/bridge/br_fdb.c
diff options
context:
space:
mode:
authorHubert Sokolowski <hubert.sokolowski@intel.com>2015-01-05 12:29:21 -0500
committerDavid S. Miller <davem@davemloft.net>2015-01-05 22:52:06 -0500
commit6cb69742daa1770fe1ce54cf45f8951376518176 (patch)
tree9702ba0fd2bb81888b65b68983a35c0893b8d3c0 /net/bridge/br_fdb.c
parentd4253c6258912057b33190a113d490f295c93352 (diff)
net: Do not call ndo_dflt_fdb_dump if ndo_fdb_dump is defined
Add checking whether the call to ndo_dflt_fdb_dump is needed. It is not expected to call ndo_dflt_fdb_dump unconditionally by some drivers (i.e. qlcnic or macvlan) that defines own ndo_fdb_dump. Other drivers define own ndo_fdb_dump and don't want ndo_dflt_fdb_dump to be called at all. At the same time it is desirable to call the default dump function on a bridge device. Fix attributes that are passed to dev->netdev_ops->ndo_fdb_dump. Add extra checking in br_fdb_dump to avoid duplicate entries as now filter_dev can be NULL. Following tests for filtering have been performed before the change and after the patch was applied to make sure they are the same and it doesn't break the filtering algorithm. [root@localhost ~]# cd /root/iproute2-3.18.0/bridge [root@localhost bridge]# modprobe dummy [root@localhost bridge]# ./bridge fdb add f1:f2:f3:f4:f5:f6 dev dummy0 [root@localhost bridge]# brctl addbr br0 [root@localhost bridge]# brctl addif br0 dummy0 [root@localhost bridge]# ip link set dev br0 address 02:00:00:12:01:04 [root@localhost bridge]# # show all [root@localhost bridge]# ./bridge fdb show 33:33:00:00:00:01 dev p2p1 self permanent 01:00:5e:00:00:01 dev p2p1 self permanent 33:33:ff:ac:ce:32 dev p2p1 self permanent 33:33:00:00:02:02 dev p2p1 self permanent 01:00:5e:00:00:fb dev p2p1 self permanent 33:33:00:00:00:01 dev p7p1 self permanent 01:00:5e:00:00:01 dev p7p1 self permanent 33:33:ff:79:50:53 dev p7p1 self permanent 33:33:00:00:02:02 dev p7p1 self permanent 01:00:5e:00:00:fb dev p7p1 self permanent f2:46:50:85:6d:d9 dev dummy0 master br0 permanent f2:46:50:85:6d:d9 dev dummy0 vlan 1 master br0 permanent 33:33:00:00:00:01 dev dummy0 self permanent f1:f2:f3:f4:f5:f6 dev dummy0 self permanent 33:33:00:00:00:01 dev br0 self permanent 02:00:00:12:01:04 dev br0 vlan 1 master br0 permanent 02:00:00:12:01:04 dev br0 master br0 permanent [root@localhost bridge]# # filter by bridge [root@localhost bridge]# ./bridge fdb show br br0 f2:46:50:85:6d:d9 dev dummy0 master br0 permanent f2:46:50:85:6d:d9 dev dummy0 vlan 1 master br0 permanent 33:33:00:00:00:01 dev dummy0 self permanent f1:f2:f3:f4:f5:f6 dev dummy0 self permanent 33:33:00:00:00:01 dev br0 self permanent 02:00:00:12:01:04 dev br0 vlan 1 master br0 permanent 02:00:00:12:01:04 dev br0 master br0 permanent [root@localhost bridge]# # filter by port [root@localhost bridge]# ./bridge fdb show brport dummy0 f2:46:50:85:6d:d9 master br0 permanent f2:46:50:85:6d:d9 vlan 1 master br0 permanent 33:33:00:00:00:01 self permanent f1:f2:f3:f4:f5:f6 self permanent [root@localhost bridge]# # filter by port + bridge [root@localhost bridge]# ./bridge fdb show br br0 brport dummy0 f2:46:50:85:6d:d9 master br0 permanent f2:46:50:85:6d:d9 vlan 1 master br0 permanent 33:33:00:00:00:01 self permanent f1:f2:f3:f4:f5:f6 self permanent [root@localhost bridge]# Signed-off-by: Hubert Sokolowski <hubert.sokolowski@intel.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.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c
index cc36e59db7d7..e6e0372bc3cd 100644
--- a/net/bridge/br_fdb.c
+++ b/net/bridge/br_fdb.c
@@ -686,6 +686,9 @@ int br_fdb_dump(struct sk_buff *skb,
686 if (!(dev->priv_flags & IFF_EBRIDGE)) 686 if (!(dev->priv_flags & IFF_EBRIDGE))
687 goto out; 687 goto out;
688 688
689 if (!filter_dev)
690 idx = ndo_dflt_fdb_dump(skb, cb, dev, NULL, idx);
691
689 for (i = 0; i < BR_HASH_SIZE; i++) { 692 for (i = 0; i < BR_HASH_SIZE; i++) {
690 struct net_bridge_fdb_entry *f; 693 struct net_bridge_fdb_entry *f;
691 694
@@ -697,7 +700,7 @@ int br_fdb_dump(struct sk_buff *skb,
697 (!f->dst || f->dst->dev != filter_dev)) { 700 (!f->dst || f->dst->dev != filter_dev)) {
698 if (filter_dev != dev) 701 if (filter_dev != dev)
699 goto skip; 702 goto skip;
700 /* !f->dst is a speacial case for bridge 703 /* !f->dst is a special case for bridge
701 * It means the MAC belongs to the bridge 704 * It means the MAC belongs to the bridge
702 * Therefore need a little more filtering 705 * Therefore need a little more filtering
703 * we only want to dump the !f->dst case 706 * we only want to dump the !f->dst case
@@ -705,6 +708,8 @@ int br_fdb_dump(struct sk_buff *skb,
705 if (f->dst) 708 if (f->dst)
706 goto skip; 709 goto skip;
707 } 710 }
711 if (!filter_dev && f->dst)
712 goto skip;
708 713
709 if (fdb_fill_info(skb, br, f, 714 if (fdb_fill_info(skb, br, f,
710 NETLINK_CB(cb->skb).portid, 715 NETLINK_CB(cb->skb).portid,