From c5020ee287957a20458a79e4b39e74999144eed6 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Wed, 30 Sep 2020 17:26:02 -0400 Subject: [PATCH] zebra: Prevent uninstall attempts when new entry is not happy In rib_process_update_fib, the function is sent two route entries the old ( previously installed ) and new ( the one to install ) When the function detects that the new is unusable because the number of nexthops that are usable for that route is 0, then we uninstall the old route. The problem here is that we should not attempt to uninstall any route that is not owned by FRR. Modify the code to not attempt this behavior Signed-off-by: Donald Sharp --- zebra/zebra_rib.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index ff30de18a3..4fa62151fc 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -898,11 +898,22 @@ static void rib_process_update_fib(struct zebra_vrf *zvrf, zebra_route_string(new->type)); } - /* If labeled-unicast route, uninstall transit LSP. */ - if (zebra_rib_labeled_unicast(old)) - zebra_mpls_lsp_uninstall(zvrf, rn, old); + /* + * When we have gotten to this point + * the new route entry has no nexthops + * that are usable and as such we need + * to remove the old route, but only + * if we were the one who installed + * the old route + */ + if (!RIB_SYSTEM_ROUTE(old)) { + /* If labeled-unicast route, uninstall transit + * LSP. */ + if (zebra_rib_labeled_unicast(old)) + zebra_mpls_lsp_uninstall(zvrf, rn, old); - rib_uninstall_kernel(rn, old); + rib_uninstall_kernel(rn, old); + } } } else { /* -- 2.39.5