From 3e8ad155dafd63248d7a32937ea657a6cae8977a Mon Sep 17 00:00:00 2001 From: Prince Sunny Date: Tue, 28 May 2019 17:35:33 -0700 Subject: [PATCH] Ignore neighbor entry with BCAST MAC, check SAI status exists (#914) * Ignore neighbor entry with BCAST MAC, check SAI status exists * Addressed review comment --- neighsyncd/neighsync.cpp | 8 ++++++++ orchagent/neighorch.cpp | 14 ++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/neighsyncd/neighsync.cpp b/neighsyncd/neighsync.cpp index 4e889e8613f6..c1f83c3aac4a 100644 --- a/neighsyncd/neighsync.cpp +++ b/neighsyncd/neighsync.cpp @@ -9,6 +9,7 @@ #include "ipaddress.h" #include "netmsg.h" #include "linkcache.h" +#include "macaddress.h" #include "neighsync.h" #include "warm_restart.h" @@ -78,6 +79,13 @@ void NeighSync::onMsg(int nlmsg_type, struct nl_object *obj) nl_addr2str(rtnl_neigh_get_lladdr(neigh), macStr, MAX_ADDR_SIZE); + /* Ignore neighbor entries with Broadcast Mac - Trigger for directed broadcast */ + if (!delete_key && (MacAddress(macStr) == MacAddress("ff:ff:ff:ff:ff:ff"))) + { + SWSS_LOG_INFO("Broadcast Mac recieved, ignoring for %s", ipStr); + return; + } + std::vector fvVector; FieldValueTuple f("family", family); FieldValueTuple nh("neigh", macStr); diff --git a/orchagent/neighorch.cpp b/orchagent/neighorch.cpp index 1594dfd969e4..1eabb8e3aa08 100644 --- a/orchagent/neighorch.cpp +++ b/orchagent/neighorch.cpp @@ -393,9 +393,19 @@ bool NeighOrch::addNeighbor(NeighborEntry neighborEntry, MacAddress macAddress) status = sai_neighbor_api->create_neighbor_entry(&neighbor_entry, 1, &neighbor_attr); if (status != SAI_STATUS_SUCCESS) { - SWSS_LOG_ERROR("Failed to create neighbor %s on %s, rv:%d", + if (status == SAI_STATUS_ITEM_ALREADY_EXISTS) + { + SWSS_LOG_ERROR("Entry exists: neighbor %s on %s, rv:%d", macAddress.to_string().c_str(), alias.c_str(), status); - return false; + /* Returning True so as to skip retry */ + return true; + } + else + { + SWSS_LOG_ERROR("Failed to create neighbor %s on %s, rv:%d", + macAddress.to_string().c_str(), alias.c_str(), status); + return false; + } } SWSS_LOG_NOTICE("Created neighbor %s on %s", macAddress.to_string().c_str(), alias.c_str());