David Miller
2019-Aug-16 20:04 UTC
[Bridge] [PATCH net-next v2 0/4] net: bridge: mdb: allow dump/add/del of host-joined entries
From: Nikolay Aleksandrov <nikolay at cumulusnetworks.com> Date: Wed, 14 Aug 2019 20:04:57 +0300> This set makes the bridge dump host-joined mdb entries, they should be > treated as normal entries since they take a slot and are aging out.... Please respin with this warning fixed: net/bridge/br_mdb.c: In function ?br_mdb_add?: net/bridge/br_mdb.c:725:4: warning: ?p? may be used uninitialized in this function [-Wmaybe-uninitialized] __br_mdb_notify(dev, p, entry, RTM_NEWMDB); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [davem at localhost net-next]$ gcc --version gcc (GCC) 8.3.1 20190223 (Red Hat 8.3.1-2) Copyright (C) 2018 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Nikolay Aleksandrov
2019-Aug-17 11:22 UTC
[Bridge] [PATCH net-next v3 0/4] net: bridge: mdb: allow dump/add/del of host-joined entries
Hi, This set makes the bridge dump host-joined mdb entries, they should be treated as normal entries since they take a slot and are aging out. We already have notifications for them but we couldn't dump them until now so they remained hidden. We dump them similar to how they're notified, in order to keep user-space compatibility with the dumped objects (e.g. iproute2 dumps mdbs in a format which can be fed into add/del commands) we allow host-joined groups also to be added/deleted via mdb commands. That can later be used for L2 mcast MAC manipulation as was recently discussed. Note that iproute2 changes are not necessary, this set will work with the current user-space mdb code. Patch 01 - a trivial comment move Patch 02 - factors out the mdb filling code so it can be re-used for the host-joined entries Patch 03 - dumps host-joined entries Patch 04 - allows manipulation of host-joined entries via standard mdb calls v3: fix compiler warning in patch 04 (DaveM) v2: change patch 04 to avoid double notification and improve host group manual removal if no ports are present in the group Thanks, Nik Nikolay Aleksandrov (4): net: bridge: mdb: move vlan comments net: bridge: mdb: factor out mdb filling net: bridge: mdb: dump host-joined entries as well net: bridge: mdb: allow add/delete for host-joined groups net/bridge/br_mdb.c | 175 +++++++++++++++++++++++++------------- net/bridge/br_multicast.c | 30 +++++-- net/bridge/br_private.h | 2 + 3 files changed, 142 insertions(+), 65 deletions(-) -- 2.21.0
Nikolay Aleksandrov
2019-Aug-17 11:22 UTC
[Bridge] [PATCH net-next v3 1/4] net: bridge: mdb: move vlan comments
Trivial patch to move the vlan comments in their proper places above the vid 0 checks. Signed-off-by: Nikolay Aleksandrov <nikolay at cumulusnetworks.com> --- net/bridge/br_mdb.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/net/bridge/br_mdb.c b/net/bridge/br_mdb.c index 428af1abf8cc..ee6208c6d946 100644 --- a/net/bridge/br_mdb.c +++ b/net/bridge/br_mdb.c @@ -653,9 +653,6 @@ static int br_mdb_add(struct sk_buff *skb, struct nlmsghdr *nlh, br = netdev_priv(dev); - /* If vlan filtering is enabled and VLAN is not specified - * install mdb entry on all vlans configured on the port. - */ pdev = __dev_get_by_index(net, entry->ifindex); if (!pdev) return -ENODEV; @@ -665,6 +662,9 @@ static int br_mdb_add(struct sk_buff *skb, struct nlmsghdr *nlh, return -EINVAL; vg = nbp_vlan_group(p); + /* If vlan filtering is enabled and VLAN is not specified + * install mdb entry on all vlans configured on the port. + */ if (br_vlan_enabled(br->dev) && vg && entry->vid == 0) { list_for_each_entry(v, &vg->vlan_list, vlist) { entry->vid = v->vid; @@ -745,9 +745,6 @@ static int br_mdb_del(struct sk_buff *skb, struct nlmsghdr *nlh, br = netdev_priv(dev); - /* If vlan filtering is enabled and VLAN is not specified - * delete mdb entry on all vlans configured on the port. - */ pdev = __dev_get_by_index(net, entry->ifindex); if (!pdev) return -ENODEV; @@ -757,6 +754,9 @@ static int br_mdb_del(struct sk_buff *skb, struct nlmsghdr *nlh, return -EINVAL; vg = nbp_vlan_group(p); + /* If vlan filtering is enabled and VLAN is not specified + * delete mdb entry on all vlans configured on the port. + */ if (br_vlan_enabled(br->dev) && vg && entry->vid == 0) { list_for_each_entry(v, &vg->vlan_list, vlist) { entry->vid = v->vid; -- 2.21.0