]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
net: bridge: Do not offload IGMP/MLD messages
authorJoseph Huang <Joseph.Huang@garmin.com>
Wed, 16 Jul 2025 15:35:50 +0000 (11:35 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 24 Jul 2025 06:56:35 +0000 (08:56 +0200)
[ Upstream commit 683dc24da8bf199bb7446e445ad7f801c79a550e ]

Do not offload IGMP/MLD messages as it could lead to IGMP/MLD Reports
being unintentionally flooded to Hosts. Instead, let the bridge decide
where to send these IGMP/MLD messages.

Consider the case where the local host is sending out reports in response
to a remote querier like the following:

       mcast-listener-process (IP_ADD_MEMBERSHIP)
          \
          br0
         /   \
      swp1   swp2
        |     |
  QUERIER     SOME-OTHER-HOST

In the above setup, br0 will want to br_forward() reports for
mcast-listener-process's group(s) via swp1 to QUERIER; but since the
source hwdom is 0, the report is eligible for tx offloading, and is
flooded by hardware to both swp1 and swp2, reaching SOME-OTHER-HOST as
well. (Example and illustration provided by Tobias.)

Fixes: 472111920f1c ("net: bridge: switchdev: allow the TX data plane forwarding to be offloaded")
Signed-off-by: Joseph Huang <Joseph.Huang@garmin.com>
Acked-by: Nikolay Aleksandrov <razor@blackwall.org>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Link: https://patch.msgid.link/20250716153551.1830255-1-Joseph.Huang@garmin.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/bridge/br_switchdev.c

index 7b41ee8740cbbaf6b959d9273c49ebcd4830a5c8..f10bd6a233dcf96745db9b7c5cc43ddcec15b67e 100644 (file)
@@ -17,6 +17,9 @@ static bool nbp_switchdev_can_offload_tx_fwd(const struct net_bridge_port *p,
        if (!static_branch_unlikely(&br_switchdev_tx_fwd_offload))
                return false;
 
+       if (br_multicast_igmp_type(skb))
+               return false;
+
        return (p->flags & BR_TX_FWD_OFFLOAD) &&
               (p->hwdom != BR_INPUT_SKB_CB(skb)->src_hwdom);
 }