From 1cd8bd054c6eafdcda1f5b1626f89622d170f536 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Thu, 5 Jan 2023 14:23:51 -0500 Subject: [PATCH] zebra: Fix distance being set incorrectly on kernel offload update When we are notified about the kernel about a route being offloaded or not correctly set the distance. Ticket: CM-33097 Signed-off-by: Donald Sharp --- zebra/zebra_rib.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index 9551f26d80..03f2591cfe 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -2711,10 +2711,6 @@ static void process_subq_early_route_add(struct zebra_early_route *ere) if (ere->src_p_provided) apply_mask_ipv6(&ere->src_p); - /* Set default distance by route type. */ - if (re->distance == 0) - re->distance = route_distance(re->type); - /* Lookup route node.*/ rn = srcdest_rnode_get(table, &ere->p, ere->src_p_provided ? &ere->src_p : NULL); @@ -2761,6 +2757,14 @@ static void process_subq_early_route_add(struct zebra_early_route *ere) } } + /* Set default distance by route type. */ + if (re->distance == 0) { + if (same && !zebra_router_notify_on_ack()) + re->distance = same->distance; + else + re->distance = route_distance(re->type); + } + /* If this route is kernel/connected route, notify the dataplane. */ if (RIB_SYSTEM_ROUTE(re)) { /* Notify dataplane */