From 8a0bb3689b11089e62c158e57057ccf702342115 Mon Sep 17 00:00:00 2001 From: Prince Sunny Date: Wed, 4 Jan 2023 18:58:55 -0800 Subject: [PATCH] Handle Mac address 'none' (#2593) In some rare cases, kernel neighbor add notifications are received with Mac string as 'none'. Fixing this to prevent crash. --- neighsyncd/neighsync.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/neighsyncd/neighsync.cpp b/neighsyncd/neighsync.cpp index 8f208e73fedd..46f51b9266e7 100644 --- a/neighsyncd/neighsync.cpp +++ b/neighsyncd/neighsync.cpp @@ -143,6 +143,12 @@ void NeighSync::onMsg(int nlmsg_type, struct nl_object *obj) nl_addr2str(rtnl_neigh_get_lladdr(neigh), macStr, MAX_ADDR_SIZE); } + if (!delete_key && !strncmp(macStr, "none", MAX_ADDR_SIZE)) + { + SWSS_LOG_NOTICE("Mac address is 'none' for ADD op, ignoring for %s", ipStr); + return; + } + /* Ignore neighbor entries with Broadcast Mac - Trigger for directed broadcast */ if (!delete_key && (MacAddress(macStr) == MacAddress("ff:ff:ff:ff:ff:ff"))) {