Skip to content

Commit 3e8ad15

Browse files
prsunnyyxieca
authored andcommitted
Ignore neighbor entry with BCAST MAC, check SAI status exists (sonic-net#914)
* Ignore neighbor entry with BCAST MAC, check SAI status exists * Addressed review comment
1 parent c033b23 commit 3e8ad15

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

neighsyncd/neighsync.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "ipaddress.h"
1010
#include "netmsg.h"
1111
#include "linkcache.h"
12+
#include "macaddress.h"
1213

1314
#include "neighsync.h"
1415
#include "warm_restart.h"
@@ -78,6 +79,13 @@ void NeighSync::onMsg(int nlmsg_type, struct nl_object *obj)
7879

7980
nl_addr2str(rtnl_neigh_get_lladdr(neigh), macStr, MAX_ADDR_SIZE);
8081

82+
/* Ignore neighbor entries with Broadcast Mac - Trigger for directed broadcast */
83+
if (!delete_key && (MacAddress(macStr) == MacAddress("ff:ff:ff:ff:ff:ff")))
84+
{
85+
SWSS_LOG_INFO("Broadcast Mac recieved, ignoring for %s", ipStr);
86+
return;
87+
}
88+
8189
std::vector<FieldValueTuple> fvVector;
8290
FieldValueTuple f("family", family);
8391
FieldValueTuple nh("neigh", macStr);

orchagent/neighorch.cpp

+12-2
Original file line numberDiff line numberDiff line change
@@ -393,9 +393,19 @@ bool NeighOrch::addNeighbor(NeighborEntry neighborEntry, MacAddress macAddress)
393393
status = sai_neighbor_api->create_neighbor_entry(&neighbor_entry, 1, &neighbor_attr);
394394
if (status != SAI_STATUS_SUCCESS)
395395
{
396-
SWSS_LOG_ERROR("Failed to create neighbor %s on %s, rv:%d",
396+
if (status == SAI_STATUS_ITEM_ALREADY_EXISTS)
397+
{
398+
SWSS_LOG_ERROR("Entry exists: neighbor %s on %s, rv:%d",
397399
macAddress.to_string().c_str(), alias.c_str(), status);
398-
return false;
400+
/* Returning True so as to skip retry */
401+
return true;
402+
}
403+
else
404+
{
405+
SWSS_LOG_ERROR("Failed to create neighbor %s on %s, rv:%d",
406+
macAddress.to_string().c_str(), alias.c_str(), status);
407+
return false;
408+
}
399409
}
400410

401411
SWSS_LOG_NOTICE("Created neighbor %s on %s", macAddress.to_string().c_str(), alias.c_str());

0 commit comments

Comments
 (0)