From d646b72d4198700c06181f9135a12afc32142c6c Mon Sep 17 00:00:00 2001 From: Sonic Build Admin Date: Thu, 25 Jun 2026 20:49:52 +0000 Subject: [PATCH] [fdbsyncd]: Make VXLAN FDB delete idempotent #### What I did Make duplicate VXLAN FDB delete handling idempotent in `fdbsyncd` by lowering the missing-entry path in `FdbSync::macDelVxlan()` from error-level logging to info-level logging. This fixes the regression introduced by PR #4615 where an expected later kernel delete for a VXLAN FDB entry could log: ```text macDelVxlan: DEL_KEY entry doesn't exist ``` That message was treated as a syslog error by loganalyzer in `sonic-buildimage` PR sonic-net/sonic-buildimage#27663, causing `vxlan/test_vxlan_decap.py::test_vxlan_decap[Enabled]` to fail even though the VXLAN decap dataplane test body passed. #### Why I did it When a remote/VXLAN-learned MAC is replaced by a local MAC, `updateLocalMac()` intentionally removes the entry from the VXLAN FDB cache. A later kernel delete event for the same VXLAN FDB entry is expected and should be a no-op, not an error. Before PR #4615, this missing-cache-entry delete path was silently ignored. This change restores the idempotent behavior while still leaving an info-level trace for debugging. #### How I did it - Changed the missing-entry log in `FdbSync::macDelVxlan()` from `SWSS_LOG_ERROR` to `SWSS_LOG_INFO`. - Extended the existing `TestMacDelVxlan` C++/GMock test to call `macDelVxlan()` twice and verify the cache remains empty after the duplicate delete. #### How I verified it Validated from `sonic-buildimage` using the official SONiC bookworm slave build flow: ```bash BLDENV=bookworm SONIC_BUILD_JOBS=4 make -f Makefile.work target/debs/bookworm/swss_1.0.0_amd64.deb-clean BLDENV=bookworm SONIC_BUILD_JOBS=4 make -f Makefile.work target/debs/bookworm/swss_1.0.0_amd64.deb ``` Results from `target/debs/bookworm/swss_1.0.0_amd64.deb.log`: - `swss_1.0.0_amd64.deb` built successfully. - `dh_auto_test` ran. - `orchagent/p4orch/tests`: 770 passed, 3 skipped, 0 failed, 0 errors. - `tests/mock_tests`: 1071 passed, 1 skipped, 0 failed, 0 errors. - `tests`: 70 passed, 0 failed, 0 errors. Signed-off-by: Sonic Build Admin --- fdbsyncd/fdbsync.cpp | 2 +- tests/mock_tests/fdbsyncd/fdbsyncd_ut.cpp | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/fdbsyncd/fdbsync.cpp b/fdbsyncd/fdbsync.cpp index 9a5a5155..cfcb8bd8 100644 --- a/fdbsyncd/fdbsync.cpp +++ b/fdbsyncd/fdbsync.cpp @@ -889,7 +889,7 @@ void FdbSync::macDelVxlan(string key) macDelVxlanDB(key); m_mac.erase(key); } else { - SWSS_LOG_ERROR("DEL_KEY %s entry doesn't exist", key.c_str()); + SWSS_LOG_DEBUG("DEL_KEY %s ignored; entry is not present in VXLAN FDB cache", key.c_str()); } } diff --git a/tests/mock_tests/fdbsyncd/fdbsyncd_ut.cpp b/tests/mock_tests/fdbsyncd/fdbsyncd_ut.cpp index d60e97b9..0c777380 100644 --- a/tests/mock_tests/fdbsyncd/fdbsyncd_ut.cpp +++ b/tests/mock_tests/fdbsyncd/fdbsyncd_ut.cpp @@ -1554,8 +1554,12 @@ TEST_F(FdbSyncdEvpnMhTest, TestMacDelVxlan) // Now call macDelVxlan which should find and process the entry m_mockFdbSync.macDelVxlan(key); + ASSERT_EQ(0u, m_mockFdbSync.m_mac.count(key)); + + // A later kernel delete for the same VXLAN FDB entry is expected after a local MAC wins. + m_mockFdbSync.macDelVxlan(key); + ASSERT_EQ(0u, m_mockFdbSync.m_mac.count(key)); - ASSERT_TRUE(true); } TEST_F(FdbSyncdEvpnMhTest, TestMacDelVxlanEntryNHG)