Skip to content

Commit

Permalink
Ignore neighbor entry with BCAST MAC, check SAI status exists (sonic-…
Browse files Browse the repository at this point in the history
…net#914)

* Ignore neighbor entry with BCAST MAC, check SAI status exists

* Addressed review comment
  • Loading branch information
prsunny authored and yxieca committed May 29, 2019
1 parent c033b23 commit 3e8ad15
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
8 changes: 8 additions & 0 deletions neighsyncd/neighsync.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "ipaddress.h"
#include "netmsg.h"
#include "linkcache.h"
#include "macaddress.h"

#include "neighsync.h"
#include "warm_restart.h"
Expand Down Expand Up @@ -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<FieldValueTuple> fvVector;
FieldValueTuple f("family", family);
FieldValueTuple nh("neigh", macStr);
Expand Down
14 changes: 12 additions & 2 deletions orchagent/neighorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down

0 comments on commit 3e8ad15

Please sign in to comment.