Skip to content

Commit

Permalink
set refcount to 0 if calculated as negative.
Browse files Browse the repository at this point in the history
added a ip neigh flush to NH route test.

Signed-off-by: Nikola Dancejic <[email protected]>
  • Loading branch information
Ndancejic committed Jan 10, 2023
1 parent c6b99cb commit 8815c35
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions orchagent/neighorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,8 @@ void NeighOrch::decreaseNextHopRefCount(const NextHopKey &nexthop, uint32_t coun
{
SWSS_LOG_ERROR("Ref count cannot be negative for next_hop_id: 0x%" PRIx64 " with ip: %s and alias: %s",
m_syncdNextHops[nexthop].next_hop_id, nexthop.ip_address.to_string().c_str(), nexthop.alias.c_str());
// Reset refcount to 0 to match expected value
m_syncdNextHops[nexthop].ref_count = 0;
return;
}
m_syncdNextHops[nexthop].ref_count -= count;
Expand Down
6 changes: 6 additions & 0 deletions tests/test_mux.py
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,12 @@ def create_and_test_NH_routes(self, appdb, asicdb, dvs, dvs_route, mac):
self.add_neighbor(dvs, neigh_ipv6, mac)
self.check_nexthop_in_asic_db(asicdb, rtkeys[0])
self.check_nexthop_in_asic_db(asicdb, rtkeys_ipv6[0])
dvs.runcmd(
"ip neigh flush " + neigh_ip
)
dvs.runcmd(
"ip neigh flush " + neigh_ipv6
)

# Cleanup
dvs.runcmd(
Expand Down

0 comments on commit 8815c35

Please sign in to comment.