Re: [PATCH RFC] net: bridge: mcast: don't clear L2 host_joined on port group deletion
From: Ido Schimmel
Date: Sun Jun 14 2026 - 06:54:36 EST
On Wed, Jun 10, 2026 at 10:31:23AM +0200, Cedric Jehasse via B4 Relay wrote:
> From: Cedric Jehasse <cedric.jehasse@xxxxxxxxxx>
>
> For a static L2 multicast group that has both a host entry and a port
> entry, deleting the port entry also removes the host entry, and the
> whole group then disappears from "bridge mdb show".
>
> To reproduce:
> bridge mdb add dev br0 port br0 grp 01:02:03:04:05:06 permanent
> bridge mdb add dev br0 port swp1 grp 01:02:03:04:05:06 permanent
> bridge mdb del dev br0 port swp1 grp 01:02:03:04:05:06 permanent
> bridge mdb show # the "port br0" host entry is gone, too
Please show the output in the commit message and also show that this
differs from regular (*, G) entries where the host entry is not removed
following the deletion of the port entry.
>
> br_multicast_del_pg() processes every non-(*,G) entry through the S,G
> path, which removes the port group from br->sg_port_tbl and then calls
> br_multicast_sg_del_exclude_ports(). L2 entries are stored in
> sg_port_tbl as well, so they take this path too.
>
> When the last port is removed in br_multicast_sg_del_exclude_ports it
> sets "sgmp->host_joined = false", clearing the host membership directly
> and bypassing br_multicast_host_leave(). With host_joined now false and
> no ports left, br_multicast_del_pg() arms the group timer and
> br_multicast_group_expired() tears down the whole mdb entry -- even
> though the host membership was explicitly and permanently configured
> from user space.
>
> Keep removing L2 port groups from sg_port_tbl, but skip the S,G
> EXCLUDE-mode handling for them. The host membership of an L2 group is
> managed solely via br_multicast_host_join() / br_multicast_host_leave().
>
> Signed-off-by: Cedric Jehasse <cedric.jehasse@xxxxxxxxxx>
The patch seems OK to me, but please add a test case in bridge_mdb.sh.
I checked the code and AFAICT this never worked, so target at net-next
without a fixes tag: Support for L2 multicast groups was added in
955062b03fa62, but at this point the mode handling already existed in
br_multicast_del_pg().