From f9a9d424f9fbc319ab84de529770f93bc0586680 Mon Sep 17 00:00:00 2001 From: Rajasekar Raja Date: Tue, 16 Jul 2024 23:34:15 -0700 Subject: [PATCH 1/3] bgpd: backpressure - fix ret value evpn_route_select_install The return value of evpn_route_select_install is ignored in all cases except during vni route table install/uninstall and based on the returned value, an error is logged. Fixing this. Ticket :#3992392 Signed-off-by: Rajasekar Raja --- bgpd/bgp_evpn.c | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c index 0485bbac6464..e660ca5c1644 100644 --- a/bgpd/bgp_evpn.c +++ b/bgpd/bgp_evpn.c @@ -1487,11 +1487,12 @@ int evpn_route_select_install(struct bgp *bgp, struct bgpevpn *vpn, && !bgp_addpath_is_addpath_used(&bgp->tx_addpath, afi, safi)) { if (bgp_zebra_has_route_changed(old_select)) { if (CHECK_FLAG(bgp->flags, BGP_FLAG_DELETE_IN_PROGRESS)) - evpn_zebra_install(bgp, vpn, - (const struct prefix_evpn *) - bgp_dest_get_prefix( - dest), - old_select); + ret = evpn_zebra_install(bgp, vpn, + (const struct prefix_evpn + *) + bgp_dest_get_prefix( + dest), + old_select); else bgp_zebra_route_install(dest, old_select, bgp, true, vpn, false); @@ -1529,10 +1530,11 @@ int evpn_route_select_install(struct bgp *bgp, struct bgpevpn *vpn, && (new_select->sub_type == BGP_ROUTE_IMPORTED || bgp_evpn_attr_is_sync(new_select->attr))) { if (CHECK_FLAG(bgp->flags, BGP_FLAG_DELETE_IN_PROGRESS)) - evpn_zebra_install(bgp, vpn, - (const struct prefix_evpn *) - bgp_dest_get_prefix(dest), - new_select); + ret = evpn_zebra_install(bgp, vpn, + (const struct prefix_evpn *) + bgp_dest_get_prefix( + dest), + new_select); else bgp_zebra_route_install(dest, new_select, bgp, true, vpn, false); @@ -1556,11 +1558,12 @@ int evpn_route_select_install(struct bgp *bgp, struct bgpevpn *vpn, old_select->sub_type == BGP_ROUTE_IMPORTED) { if (CHECK_FLAG(bgp->flags, BGP_FLAG_DELETE_IN_PROGRESS) || CHECK_FLAG(bgp->flags, BGP_FLAG_VNI_DOWN)) - evpn_zebra_uninstall(bgp, vpn, - (const struct prefix_evpn *) - bgp_dest_get_prefix( - dest), - old_select, false); + ret = evpn_zebra_uninstall(bgp, vpn, + (const struct prefix_evpn + *) + bgp_dest_get_prefix( + dest), + old_select, false); else bgp_zebra_route_install(dest, old_select, bgp, false, vpn, false); From d4e8279adcafc61b1015b4c380ac12c316fc42bd Mon Sep 17 00:00:00 2001 From: Rajasekar Raja Date: Thu, 18 Jul 2024 22:23:23 -0700 Subject: [PATCH 2/3] bgpd: backpressure - log error for evpn when route install to zebra fails. log error for evpn in case route install to zebra fails. Ticket :#3992392 Signed-off-by: Rajasekar Raja --- bgpd/bgp_zebra.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c index 6f8f4610ca9a..c4a55348eaf7 100644 --- a/bgpd/bgp_zebra.c +++ b/bgpd/bgp_zebra.c @@ -1789,6 +1789,7 @@ static void bgp_handle_route_announcements_to_zebra(struct event *e) struct bgp_table *table = NULL; enum zclient_send_status status = ZCLIENT_SEND_SUCCESS; bool install; + const struct prefix_evpn *evp = NULL; while (count < ZEBRA_ANNOUNCEMENTS_LIMIT) { dest = zebra_announce_pop(&bm->zebra_announce_head); @@ -1798,8 +1799,11 @@ static void bgp_handle_route_announcements_to_zebra(struct event *e) table = bgp_dest_table(dest); install = CHECK_FLAG(dest->flags, BGP_NODE_SCHEDULE_FOR_INSTALL); - if (table->afi == AFI_L2VPN && table->safi == SAFI_EVPN) + if (table->afi == AFI_L2VPN && table->safi == SAFI_EVPN) { is_evpn = true; + evp = (const struct prefix_evpn *)bgp_dest_get_prefix( + dest); + } if (BGP_DEBUG(zebra, ZEBRA)) zlog_debug("BGP %s route %pBD(%s) with dest %p and flags 0x%x to zebra", @@ -1836,6 +1840,17 @@ static void bgp_handle_route_announcements_to_zebra(struct event *e) UNSET_FLAG(dest->flags, BGP_NODE_SCHEDULE_FOR_DELETE); } + if (is_evpn && status == ZCLIENT_SEND_FAILURE) + flog_err(EC_BGP_EVPN_FAIL, + "%s (%u): Failed to %s EVPN %pFX %s route in VNI %u", + vrf_id_to_name(table->bgp->vrf_id), + table->bgp->vrf_id, + install ? "install" : "uninstall", evp, + evp->prefix.route_type == BGP_EVPN_MAC_IP_ROUTE + ? "MACIP" + : "IMET", + dest->za_vpn->vni); + bgp_path_info_unlock(dest->za_bgp_pi); dest->za_bgp_pi = NULL; dest->za_vpn = NULL; From 36a70b5d203da6c4581cb1d4e071dc8cc58d744f Mon Sep 17 00:00:00 2001 From: Chirag Shah Date: Mon, 17 Jun 2024 13:58:03 -0700 Subject: [PATCH 3/3] bgpd: backpressure - fix evpn route sync to zebra In scaled EVPN + ipv4/ipv6 uni route sync to zebra, some of the ipv4/ipv6 routes skipped reinstallation due to incorrect local variable's stale value. Once the local variable value reset in each loop iteration all skipped routes synced to zebra properly. Ticket: #3948828 Signed-off-by: Rajasekar Raja Signed-off-by: Chirag Shah --- bgpd/bgp_zebra.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c index c4a55348eaf7..5bb177b2f795 100644 --- a/bgpd/bgp_zebra.c +++ b/bgpd/bgp_zebra.c @@ -1792,6 +1792,8 @@ static void bgp_handle_route_announcements_to_zebra(struct event *e) const struct prefix_evpn *evp = NULL; while (count < ZEBRA_ANNOUNCEMENTS_LIMIT) { + is_evpn = false; + dest = zebra_announce_pop(&bm->zebra_announce_head); if (!dest)