From 4d57481211ffd8cdd06bddb2a46501c4de831621 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Mon, 10 Apr 2023 13:59:48 -0400 Subject: [PATCH] bgpd: Do not allow l3vni changes when shutting down When a `no router bgp XXX` is issued and the bgp instance is in the process of shutting down, do not allow a l3vni change coming up from zebra to do anything. We can just safely ignore it at this point in time. Signed-off-by: Donald Sharp (cherry picked from commit 5a7c43c77ed27522e1e655795d5451c888abb10e) --- bgpd/bgp_evpn.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c index 9c6624e27f..16b7dc3f4e 100644 --- a/bgpd/bgp_evpn.c +++ b/bgpd/bgp_evpn.c @@ -5564,6 +5564,14 @@ int bgp_evpn_local_l3vni_add(vni_t l3vni, vrf_id_t vrf_id, l3vni); return -1; } + + if (CHECK_FLAG(bgp_evpn->flags, BGP_FLAG_DELETE_IN_PROGRESS)) { + flog_err(EC_BGP_NO_DFLT, + "Cannot process L3VNI %u ADD - EVPN BGP instance is shutting down", + l3vni); + return -1; + } + as = bgp_evpn->as; /* if the BGP vrf instance doesn't exist - create one */ @@ -5703,6 +5711,13 @@ int bgp_evpn_local_l3vni_del(vni_t l3vni, vrf_id_t vrf_id) return -1; } + if (CHECK_FLAG(bgp_evpn->flags, BGP_FLAG_DELETE_IN_PROGRESS)) { + flog_err(EC_BGP_NO_DFLT, + "Cannot process L3VNI %u ADD - EVPN BGP instance is shutting down", + l3vni); + return -1; + } + /* Remove remote routes from BGT VRF even if BGP_VRF_AUTO is configured, * bgp_delete would not remove/decrement bgp_path_info of the ip_prefix * routes. This will uninstalling the routes from zebra and decremnt the -- 2.39.5