Skip to content

Commit 38c0d16

Browse files
Volodymyr Samotiyabdosi
authored andcommitted
[vnet] Verify if BITMAP route exists before creating new one to avoid dublication (sonic-net#1272)
Signed-off-by: Volodymyr Samotiy <volodymyrs@mellanox.com>
1 parent b949bf7 commit 38c0d16

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

orchagent/vnetorch.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -795,6 +795,12 @@ bool VNetBitmapObject::addTunnelRoute(IpPrefix& ipPrefix, tunnelEndpoint& endp)
795795
sai_ip_address_t underlayAddr;
796796
copy(underlayAddr, endp.ip);
797797

798+
if (tunnelRouteMap_.find(ipPrefix) != tunnelRouteMap_.end())
799+
{
800+
SWSS_LOG_WARN("VNET tunnel route %s exists", ipPrefix.to_string().c_str());
801+
return true;
802+
}
803+
798804
VNetOrch* vnet_orch = gDirectory.get<VNetOrch*>();
799805
for (auto peer : peer_list)
800806
{
@@ -1097,6 +1103,12 @@ bool VNetBitmapObject::addRoute(IpPrefix& ipPrefix, nextHop& nh)
10971103
Port port;
10981104
RouteInfo routeInfo;
10991105

1106+
if (routeMap_.find(ipPrefix) != routeMap_.end())
1107+
{
1108+
SWSS_LOG_WARN("VNET route %s exists", ipPrefix.to_string().c_str());
1109+
return true;
1110+
}
1111+
11001112
bool is_subnet = (!nh.ips.getSize() || nh.ips.contains("0.0.0.0")) ? true : false;
11011113

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

0 commit comments

Comments
 (0)