From b59d987ada1e20a8e035b8e34db7692ef3ab11cb Mon Sep 17 00:00:00 2001 From: Anish Narsian Date: Fri, 14 Nov 2025 03:14:32 +0000 Subject: [PATCH 1/2] Prevent route deletion in default vrf upon creating tunnel route in non default vnet --- orchagent/vnetorch.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/orchagent/vnetorch.cpp b/orchagent/vnetorch.cpp index 57fd236b08..7bc7deb086 100644 --- a/orchagent/vnetorch.cpp +++ b/orchagent/vnetorch.cpp @@ -1192,7 +1192,7 @@ bool VNetRouteOrch::doRouteTask(const string& vnet, IpPrefix& ipP prefixToRemove = adv_prefix; } auto prefixSubnet = prefixToRemove.getSubnet(); - if(gRouteOrch && gRouteOrch->isRouteExists(prefixSubnet)) + if(gRouteOrch && gRouteOrch->isRouteExists(vr_id, prefixSubnet)) { if (!gRouteOrch->removeRoutePrefix(prefixSubnet)) { @@ -2501,7 +2501,9 @@ void VNetRouteOrch::updateVnetTunnel(const BfdUpdate& update) ipPrefixsubnet = adv_prefix.getSubnet(); } } - if(gRouteOrch && gRouteOrch->isRouteExists(ipPrefixsubnet)) + + sai_object_id_t vr_id = vrf_obj->getVRidIngress(); + if(gRouteOrch && gRouteOrch->isRouteExists(vr_id, ipPrefixsubnet)) { if (!gRouteOrch->removeRoutePrefix(ipPrefixsubnet)) { @@ -2749,7 +2751,7 @@ void VNetRouteOrch::updateVnetTunnelCustomMonitor(const MonitorUpdate& update) } } auto prefixsubnet = prefixToUse.getSubnet(); - if (gRouteOrch && gRouteOrch->isRouteExists(prefixsubnet)) + if (gRouteOrch && gRouteOrch->isRouteExists(vr_id, prefixsubnet)) { if (!gRouteOrch->removeRoutePrefix(prefixsubnet)) { From 40a74b250f6cc73bd0e81abf965ff6c1416e60e7 Mon Sep 17 00:00:00 2001 From: anish-n Date: Mon, 17 Nov 2025 00:24:11 +0000 Subject: [PATCH 2/2] Add routeorch change --- orchagent/routeorch.cpp | 4 +--- orchagent/routeorch.h | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/orchagent/routeorch.cpp b/orchagent/routeorch.cpp index 58b8eb995e..9b642b316d 100644 --- a/orchagent/routeorch.cpp +++ b/orchagent/routeorch.cpp @@ -2964,12 +2964,10 @@ bool RouteOrch::removeRoutePost(const RouteBulkContext& ctx) return true; } -bool RouteOrch::isRouteExists(const IpPrefix& prefix) +bool RouteOrch::isRouteExists(sai_object_id_t vrf_id, const IpPrefix& prefix) { SWSS_LOG_ENTER(); - sai_object_id_t& vrf_id = gVirtualRouterId; - sai_route_entry_t route_entry; route_entry.vr_id = vrf_id; route_entry.switch_id = gSwitchId; diff --git a/orchagent/routeorch.h b/orchagent/routeorch.h index a903dc42e0..54ddaf2b00 100644 --- a/orchagent/routeorch.h +++ b/orchagent/routeorch.h @@ -253,7 +253,7 @@ class RouteOrch : public ZmqOrch, public Subject const NextHopGroupKey getSyncdRouteNhgKey(sai_object_id_t vrf_id, const IpPrefix& ipPrefix); bool createFineGrainedNextHopGroup(sai_object_id_t &next_hop_group_id, vector &nhg_attrs); bool removeFineGrainedNextHopGroup(sai_object_id_t &next_hop_group_id); - bool isRouteExists(const IpPrefix& prefix); + bool isRouteExists(sai_object_id_t vrf_id, const IpPrefix& prefix); bool removeRoutePrefix(const IpPrefix& prefix); void addLinkLocalRouteToMe(sai_object_id_t vrf_id, IpPrefix linklocal_prefix);