Skip to contentSkip to conversation

net: macvlan: fix multicast delivery to bridge ports with shared source MAC

PATCH Superseded Kibaek Yoo 3 participants 5 messages Feb 25 – Mar 4

Subsystems (3)
lore
Share & tools
lore

Kibaek Yoo

author
#0 lore raw

PATCH 1/1 net: macvlan: fix multicast delivery to bridge ports with shared source MAC

When a macvlan interface in bridge mode shares its MAC address with an external source (e.g., VRRP virtual MAC), incoming multicast frames from that external source are incorrectly identified as locally originated. macvlan_hash_lookup() matches the source MAC to a local macvlan, causing macvlan_multicast_rx() to skip delivery to bridge ports under the assumption they already received the frame during transmission.

This assumption fails for protocols like VRRP where multiple hosts legitimately share the same virtual MAC address. The local macvlan never transmitted the frame, so bridge ports never saw it, yet the multicast is not delivered to them.

Fix this by passing NULL as the source device and including MACVLAN_MODE_BRIDGE in the mode mask for the else branch of macvlan_multicast_rx(). This ensures all VEPA and bridge mode macvlan interfaces receive incoming multicast regardless of source MAC matching. The trade-off is that looped-back locally-originated multicasts may be delivered to bridge ports a second time, but multicast consumers already handle duplicate frames.

---
 drivers/net/macvlan.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/net/macvlan.c +8 -4
index a71f058ec..ea22909cb 100644
@@ -313,11 +313,15 @@ static void macvlan_multicast_rx(const struct macvlan_port *port,
 				  MACVLAN_MODE_BRIDGE);
 	else
 		/*
-		 * flood only to VEPA ports, bridge ports
-		 * already saw the frame on the way out.
+		 * Flood to VEPA and bridge ports. We cannot distinguish
+		 * a looped-back locally-originated multicast from one
+		 * sent by an external source sharing the same source MAC
+		 * (e.g., VRRP virtual MAC), so deliver to bridge ports
+		 * as well to ensure correct reception in all cases.
 		 */
-		macvlan_broadcast(skb, port, src->dev,
-				  MACVLAN_MODE_VEPA);
+		macvlan_broadcast(skb, port, NULL,
+				  MACVLAN_MODE_VEPA |
+				  MACVLAN_MODE_BRIDGE);
 }
 
 static void macvlan_process_broadcast(struct work_struct *w)
Signature · 1 line
2.50.1 (Apple Git-155)
maintainer
#1 lore raw
Quoted 8 lines · On Wed, 25 Feb 2026 19:00:24 +0900 Kibaek Yoo wrote:

When a macvlan interface in bridge mode shares its MAC address with an external source (e.g., VRRP virtual MAC), incoming multicast frames from that external source are incorrectly identified as locally originated. macvlan_hash_lookup() matches the source MAC to a local macvlan, causing macvlan_multicast_rx() to skip delivery to bridge ports under the assumption they already received the frame during transmission.

Quoted 7 lines

This assumption fails for protocols like VRRP where multiple hosts legitimately share the same virtual MAC address. The local macvlan never transmitted the frame, so bridge ports never saw it, yet the multicast is not delivered to them.

Fix this by passing NULL as the source device and including MACVLAN_MODE_BRIDGE in the mode mask for the else branch of

The change looks fine, AFAICT. But please rephrase the commit message to avoid making it sound like a fix. The VRRP use case is rather odd and it was simply not supported earlier. Now you're adding support with the tradeoff you note below. We don't want AI-based backporting bots to pull this into LTS.

Please try to add a test case for your use case in selftests.

Quoted 5 lines

macvlan_multicast_rx(). This ensures all VEPA and bridge mode macvlan interfaces receive incoming multicast regardless of source MAC matching. The trade-off is that looped-back locally-originated multicasts may be delivered to bridge ports a second time, but multicast consumers already handle duplicate frames.

Signature · 1 line
pw-bot: cr
author
#2 lore raw

PATCH v2 1/2 net: macvlan: support multicast rx for bridge ports with shared source MAC

In reply to Kibaek Yoo

Macvlan bridge mode currently does not handle the case where an external source shares its MAC address with a local macvlan interface. When such a frame arrives, macvlan_hash_lookup() matches the source MAC to the local macvlan, and macvlan_multicast_rx() assumes bridge ports already received the frame during local transmission. Since the frame actually originated externally, bridge ports never saw it.

This situation arises with protocols like VRRP, where multiple hosts use the same virtual MAC address.

Support this by passing NULL as the source device and including MACVLAN_MODE_BRIDGE in the mode mask for the else branch of macvlan_multicast_rx(). This ensures all VEPA and bridge mode macvlan interfaces receive incoming multicast regardless of source MAC matching. The trade-off is that looped-back locally-originated multicasts may be delivered to bridge ports a second time, but multicast consumers already handle duplicate frames.

---
 drivers/net/macvlan.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/net/macvlan.c +8 -4
index a71f058eceef0..ea22909cb09de 100644
@@ -313,11 +313,15 @@ static void macvlan_multicast_rx(const struct macvlan_port *port,
 				  MACVLAN_MODE_BRIDGE);
 	else
 		/*
-		 * flood only to VEPA ports, bridge ports
-		 * already saw the frame on the way out.
+		 * Flood to VEPA and bridge ports. We cannot distinguish
+		 * a looped-back locally-originated multicast from one
+		 * sent by an external source sharing the same source MAC
+		 * (e.g., VRRP virtual MAC), so deliver to bridge ports
+		 * as well to ensure correct reception in all cases.
 		 */
-		macvlan_broadcast(skb, port, src->dev,
-				  MACVLAN_MODE_VEPA);
+		macvlan_broadcast(skb, port, NULL,
+				  MACVLAN_MODE_VEPA |
+				  MACVLAN_MODE_BRIDGE);
 }
 
 static void macvlan_process_broadcast(struct work_struct *w)
Signature · 1 line
2.50.1 (Apple Git-155)
author
#3 lore raw

PATCH v2 2/2 selftests: net: add macvlan multicast test for shared source MAC

Add a selftest that verifies multicast delivery to a macvlan bridge port when the source MAC of the incoming frame matches the macvlan's own MAC address.

This scenario occurs with protocols like VRRP where multiple hosts share the same virtual MAC address. Without the corresponding kernel change, macvlan bridge mode does not handle this case and the multicast frame is not delivered.

---
 tools/testing/selftests/net/Makefile          |  1 +
 .../selftests/net/macvlan_mcast_shared_mac.sh | 93 +++++++++++++++++++
 2 files changed, 94 insertions(+)
 create mode 100755 tools/testing/selftests/net/macvlan_mcast_shared_mac.sh
tools/testing/selftests/net/Makefile +1 -0
index afdea6d95bde0..c12f6f600ee5e 100644
@@ -54,6 +54,7 @@ TEST_PROGS := \
 	l2tp.sh \
 	link_netns.py \
 	lwt_dst_cache_ref_loop.sh \
+	macvlan_mcast_shared_mac.sh \
 	msg_zerocopy.sh \
 	nat6to4.sh \
 	ndisc_unsolicited_na_test.sh \
tools/testing/selftests/net/macvlan_mcast_shared_mac.sh new file +93 -0

93 lines not on this page · raw message

Signature · 1 line
2.50.1 (Apple Git-155)
#4 lore raw

Re: [PATCH v2 1/2] net: macvlan: support multicast rx for bridge ports with shared source MAC

In reply to Kibaek Yoo
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Sat, 28 Feb 2026 16:16:12 +0900 you wrote:

Macvlan bridge mode currently does not handle the case where an external source shares its MAC address with a local macvlan interface. When such a frame arrives, macvlan_hash_lookup() matches the source MAC to the local macvlan, and macvlan_multicast_rx() assumes bridge ports already received the frame during local transmission. Since the frame actually originated externally, bridge ports never saw it.

[...]

Here is the summary with links:
- [v2,1/2] net: macvlan: support multicast rx for bridge ports with shared source MAC

    https://git.kernel.org/netdev/net-next/c/b52363f706e5
  - [v2,2/2] selftests: net: add macvlan multicast test for shared source MAC
    https://git.kernel.org/netdev/net-next/c/4ad96a7c9e2c

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html