From 6b193087ca10e128614ea5dacc72c4462e6db0ce Mon Sep 17 00:00:00 2001 From: Mark Stapp Date: Fri, 8 May 2020 16:22:54 -0400 Subject: [PATCH] staticd,zebra: use ALLOW_RECURSION for static routes Remove a special-case clause for static routes - it was the same as the clause for other recursive routes. Have staticd just tell zebra that recursion is allowed. Update topotest that was aware of this 'internal' flag. Signed-off-by: Mark Stapp --- staticd/static_zebra.c | 1 + .../r1/v4_route_1_static_override.json | 2 +- zebra/zebra_nhg.c | 27 ------------------- 3 files changed, 2 insertions(+), 28 deletions(-) diff --git a/staticd/static_zebra.c b/staticd/static_zebra.c index 5cadf34365..c42f632ffb 100644 --- a/staticd/static_zebra.c +++ b/staticd/static_zebra.c @@ -363,6 +363,7 @@ extern void static_zebra_route_add(struct route_node *rn, memcpy(&api.src_prefix, src_pp, sizeof(api.src_prefix)); } SET_FLAG(api.flags, ZEBRA_FLAG_RR_USE_DISTANCE); + SET_FLAG(api.flags, ZEBRA_FLAG_ALLOW_RECURSION); SET_FLAG(api.message, ZAPI_MESSAGE_NEXTHOP); if (si_changed->distance) { SET_FLAG(api.message, ZAPI_MESSAGE_DISTANCE); diff --git a/tests/topotests/zebra_rib/r1/v4_route_1_static_override.json b/tests/topotests/zebra_rib/r1/v4_route_1_static_override.json index aa9522aff6..22e199f9aa 100644 --- a/tests/topotests/zebra_rib/r1/v4_route_1_static_override.json +++ b/tests/topotests/zebra_rib/r1/v4_route_1_static_override.json @@ -10,7 +10,7 @@ "installed":true, "table":254, "internalStatus":16, - "internalFlags":72, + "internalFlags":73, "internalNextHopNum":1, "internalNextHopActiveNum":1, "nexthops":[ diff --git a/zebra/zebra_nhg.c b/zebra/zebra_nhg.c index 02ba69bd4d..ce5e6a54d7 100644 --- a/zebra/zebra_nhg.c +++ b/zebra/zebra_nhg.c @@ -1953,33 +1953,6 @@ static int nexthop_active(afi_t afi, struct route_entry *re, __func__); return resolved; - } else if (re->type == ZEBRA_ROUTE_STATIC) { - resolved = 0; - for (ALL_NEXTHOPS(match->nhe->nhg, newhop)) { - if (!CHECK_FLAG(match->status, - ROUTE_ENTRY_INSTALLED)) - continue; - if (!nexthop_valid_resolve(nexthop, newhop)) - continue; - - if (IS_ZEBRA_DEBUG_RIB_DETAILED) - zlog_debug("%s: STATIC match %p (%u), newhop %pNHv", - __func__, match, - match->nhe->id, newhop); - - SET_FLAG(nexthop->flags, - NEXTHOP_FLAG_RECURSIVE); - nexthop_set_resolved(afi, newhop, nexthop); - resolved = 1; - } - if (resolved) - re->nexthop_mtu = match->mtu; - - if (!resolved && IS_ZEBRA_DEBUG_RIB_DETAILED) - zlog_debug( - " %s: Static route unable to resolve", - __func__); - return resolved; } else { if (IS_ZEBRA_DEBUG_RIB_DETAILED) { zlog_debug( -- 2.39.5