From d74c2d73ae1458bb1a98502f962598664fa15c47 Mon Sep 17 00:00:00 2001 From: Volodymyr Samotiy Date: Thu, 23 Apr 2020 20:42:25 +0300 Subject: [PATCH] [vnet] Verify if BITMAP route exists before creating new one to avoid dublication (#1272) Signed-off-by: Volodymyr Samotiy --- orchagent/vnetorch.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/orchagent/vnetorch.cpp b/orchagent/vnetorch.cpp index 9155d3169396..d45c44f315a5 100644 --- a/orchagent/vnetorch.cpp +++ b/orchagent/vnetorch.cpp @@ -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(); for (auto peer : peer_list) { @@ -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)))