Skip to content

Commit

Permalink
[vnet] Verify if BITMAP route exists before creating new one to avoid…
Browse files Browse the repository at this point in the history
… dublication (sonic-net#1272)

Signed-off-by: Volodymyr Samotiy <volodymyrs@mellanox.com>
  • Loading branch information
Volodymyr Samotiy authored Apr 23, 2020
1 parent e3f2b29 commit d74c2d7
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions orchagent/vnetorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -791,6 +791,12 @@ bool VNetBitmapObject::addTunnelRoute(IpPrefix& ipPrefix, tunnelEndpoint& endp)
sai_ip_address_t underlayAddr;
copy(underlayAddr, endp.ip);

if (tunnelRouteMap_.find(ipPrefix) != tunnelRouteMap_.end())
{
SWSS_LOG_WARN("VNET tunnel route %s exists", ipPrefix.to_string().c_str());
return true;
}

VNetOrch* vnet_orch = gDirectory.get<VNetOrch*>();
for (auto peer : peer_list)
{
Expand Down Expand Up @@ -1093,6 +1099,12 @@ bool VNetBitmapObject::addRoute(IpPrefix& ipPrefix, nextHop& nh)
Port port;
RouteInfo routeInfo;

if (routeMap_.find(ipPrefix) != routeMap_.end())
{
SWSS_LOG_WARN("VNET route %s exists", ipPrefix.to_string().c_str());
return true;
}

bool is_subnet = (!nh.ips.getSize() || nh.ips.contains("0.0.0.0")) ? true : false;

if (is_subnet && (!gPortsOrch->getPort(nh.ifname, port) || (port.m_rif_id == SAI_NULL_OBJECT_ID)))
Expand Down

0 comments on commit d74c2d7

Please sign in to comment.