From 9c9e8f8214bd1f8677e66187f35724f412415fe2 Mon Sep 17 00:00:00 2001 From: Longxiang Lyu Date: Wed, 5 Aug 2026 04:06:04 +0000 Subject: [PATCH] [intfsorch] Preserve port MAC when updating router interface MAC IntfsOrch::doTask() reconciles a router interface's SRC_MAC on every update: if the mac parsed from INTF_TABLE is empty (the zero sentinel written by intfmgr for interfaces without a per-interface MAC), it falls back to gMacAddress and, when that differs from the tracked MAC, issues a set_router_interface_attribute(SRC_MAC). The create path in setIntf() derives the tracked MAC from port.m_mac (falling back to gMacAddress only when the port has none), but the update path fell back straight to gMacAddress. For a VLAN SVI whose gateway MAC is configured on the VLAN (e.g. a dual-ToR shared MAC populated into port.m_mac from VLAN_TABLE), the two never agree: the RIF is created with the VLAN MAC, then the update immediately overwrites it with the switch MAC. On dual-ToR this replaces the shared gateway MAC with a per-device MAC and breaks seamless mux failover. Mirror the create path by preferring port.m_mac and only falling back to gMacAddress when the port has no MAC. This keeps the update symmetric with create so no spurious SRC_MAC set is generated. Behavior is unchanged for routed PHY/LAG interfaces (port.m_mac empty -> gMacAddress) and for SAG interfaces (intfmgr writes a non-zero anycast MAC, so the fallback is not taken). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Longxiang Lyu --- orchagent/intfsorch.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/orchagent/intfsorch.cpp b/orchagent/intfsorch.cpp index 4ee5850a2d..f638d89acb 100644 --- a/orchagent/intfsorch.cpp +++ b/orchagent/intfsorch.cpp @@ -1078,7 +1078,10 @@ void IntfsOrch::doTask(Consumer &consumer) if (!mac) { - mac = gMacAddress; + // Prefer the port's own MAC (e.g. a VLAN SVI's gateway MAC populated + // from VLAN_TABLE) and only fall back to the switch MAC when the port + // has none. + mac = port.m_mac ? port.m_mac : gMacAddress; } // update mac if it is changed