net: bridge: mcast: don’t delete permanent entries when fast leave is enabled [Linux 4.9.189]

This Linux kernel change "net: bridge: mcast: don’t delete permanent entries when fast leave is enabled" is included in the Linux 4.9.189 release. This change is authored by Nikolay Aleksandrov <nikolay [at] cumulusnetworks.com> on Tue Jul 30 14:21:00 2019 +0300. The commit for this change in Linux stable tree is 6d9235b (patch) which is from upstream commit 5c725b6. The same Linux upstream change may have been applied to various maintained Linux releases and you can find all Linux releases containing changes from upstream 5c725b6.

net: bridge: mcast: don't delete permanent entries when fast leave is enabled

[ Upstream commit 5c725b6b65067909548ac9ca9bc777098ec9883d ]

When permanent entries were introduced by the commit below, they were
exempt from timing out and thus igmp leave wouldn't affect them unless
fast leave was enabled on the port which was added before permanent
entries existed. It shouldn't matter if fast leave is enabled or not
if the user added a permanent entry it shouldn't be deleted on igmp
leave.

Before:
$ echo 1 > /sys/class/net/eth4/brport/multicast_fast_leave
$ bridge mdb add dev br0 port eth4 grp 229.1.1.1 permanent
$ bridge mdb show
dev br0 port eth4 grp 229.1.1.1 permanent

< join and leave 229.1.1.1 on eth4 >

$ bridge mdb show
$

After:
$ echo 1 > /sys/class/net/eth4/brport/multicast_fast_leave
$ bridge mdb add dev br0 port eth4 grp 229.1.1.1 permanent
$ bridge mdb show
dev br0 port eth4 grp 229.1.1.1 permanent

< join and leave 229.1.1.1 on eth4 >

$ bridge mdb show
dev br0 port eth4 grp 229.1.1.1 permanent

Fixes: ccb1c31a7a87 ("bridge: add flags to distinguish permanent mdb entires")
Signed-off-by: Nikolay Aleksandrov <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

There are 3 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 net/bridge/br_multicast.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c
index 3626174..80c81c7e 100644
--- a/net/bridge/br_multicast.c
+++ b/net/bridge/br_multicast.c
@@ -1489,6 +1489,9 @@ static int br_ip6_multicast_query(struct net_bridge *br,
            if (p->port != port)
                continue;

+           if (p->flags & MDB_PG_FLAGS_PERMANENT)
+               break;
+
            rcu_assign_pointer(*pp, p->next);
            hlist_del_init(&p->mglist);
            del_timer(&p->timer);

Leave a Reply

Your email address will not be published. Required fields are marked *