Skip to content

Commit d74c2d7

Browse files
author
Volodymyr Samotiy
authored
[vnet] Verify if BITMAP route exists before creating new one to avoid dublication (#1272)
Signed-off-by: Volodymyr Samotiy <[email protected]>
1 parent e3f2b29 commit d74c2d7

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

orchagent/vnetorch.cpp

+12
Original file line numberDiff line numberDiff line change
@@ -791,6 +791,12 @@ bool VNetBitmapObject::addTunnelRoute(IpPrefix& ipPrefix, tunnelEndpoint& endp)
791791
sai_ip_address_t underlayAddr;
792792
copy(underlayAddr, endp.ip);
793793

794+
if (tunnelRouteMap_.find(ipPrefix) != tunnelRouteMap_.end())
795+
{
796+
SWSS_LOG_WARN("VNET tunnel route %s exists", ipPrefix.to_string().c_str());
797+
return true;
798+
}
799+
794800
VNetOrch* vnet_orch = gDirectory.get<VNetOrch*>();
795801
for (auto peer : peer_list)
796802
{
@@ -1093,6 +1099,12 @@ bool VNetBitmapObject::addRoute(IpPrefix& ipPrefix, nextHop& nh)
10931099
Port port;
10941100
RouteInfo routeInfo;
10951101

1102+
if (routeMap_.find(ipPrefix) != routeMap_.end())
1103+
{
1104+
SWSS_LOG_WARN("VNET route %s exists", ipPrefix.to_string().c_str());
1105+
return true;
1106+
}
1107+
10961108
bool is_subnet = (!nh.ips.getSize() || nh.ips.contains("0.0.0.0")) ? true : false;
10971109

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

0 commit comments

Comments
 (0)