From 4f917c4148140a38085ac602a263de92145b07e4 Mon Sep 17 00:00:00 2001 From: Yaroslav Kholod Date: Wed, 18 Dec 2024 15:30:48 +0200 Subject: [PATCH] zebra: update kernel routes with interface check --- zebra/zebra_nhg.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/zebra/zebra_nhg.c b/zebra/zebra_nhg.c index 1519246c179e..005d5d3d2a09 100644 --- a/zebra/zebra_nhg.c +++ b/zebra/zebra_nhg.c @@ -2645,10 +2645,12 @@ static unsigned nexthop_active_check(struct route_node *rn, */ if (re->type == ZEBRA_ROUTE_KERNEL || re->type == ZEBRA_ROUTE_SYSTEM) { struct interface *ifp; + int connected_if_count = 0; ifp = if_lookup_by_index(nexthop->ifindex, nexthop->vrf_id); + connected_if_count = connected_count_by_family(ifp->connected, AF_INET) + connected_count_by_family(ifp->connected, AF_INET6); - if (ifp && ifp->vrf->vrf_id == vrf_id && if_is_up(ifp)) { + if (ifp && ifp->vrf->vrf_id == vrf_id && if_is_up(ifp) && connected_if_count) { SET_FLAG(nexthop->flags, NEXTHOP_FLAG_ACTIVE); goto skip_check; }