public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Kibaek Yoo <psykibaek@gmail.com>
To: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Kibaek Yoo <psykibaek@gmail.com>
Subject: [PATCH] net: macvlan: fix multicast delivery to bridge ports with shared source MAC
Date: Wed, 25 Feb 2026 19:00:24 +0900	[thread overview]
Message-ID: <20260225100024.38937-1-psykibaek@gmail.com> (raw)

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.

Signed-off-by: Kibaek Yoo <psykibaek@gmail.com>
---
 drivers/net/macvlan.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index a71f058ec..ea22909cb 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -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)
-- 
2.50.1 (Apple Git-155)


             reply	other threads:[~2026-02-25 10:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-25 10:00 Kibaek Yoo [this message]
2026-02-28  3:04 ` [PATCH] net: macvlan: fix multicast delivery to bridge ports with shared source MAC Jakub Kicinski
2026-02-28  7:16 ` [PATCH v2 1/2] net: macvlan: support multicast rx for " Kibaek Yoo
2026-02-28  7:16   ` [PATCH v2 2/2] selftests: net: add macvlan multicast test for " Kibaek Yoo
2026-03-04  2:50   ` [PATCH v2 1/2] net: macvlan: support multicast rx for bridge ports with " patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260225100024.38937-1-psykibaek@gmail.com \
    --to=psykibaek@gmail.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox