From a11742dc53e31d1379cb4f7b9b7b750614e30928 Mon Sep 17 00:00:00 2001 From: Louis Scalbert Date: Fri, 1 Apr 2022 13:27:06 +0200 Subject: [PATCH] isisd: allow nexthop lookup on interface only Allow the nexthoplookup function to return the first nexthop found on ifindex interface if the IP is unspecified. Signed-off-by: Louis Scalbert --- isisd/isis_route.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/isisd/isis_route.c b/isisd/isis_route.c index a91ce7eeac..0e7947dd46 100644 --- a/isisd/isis_route.c +++ b/isisd/isis_route.c @@ -91,11 +91,17 @@ static struct isis_nexthop *nexthoplookup(struct list *nexthops, int family, struct isis_nexthop *nh; for (ALL_LIST_ELEMENTS_RO(nexthops, node, nh)) { - if (nh->family != family) - continue; if (nh->ifindex != ifindex) continue; + /* if the IP is unspecified, return the first nexthop found on + * the interface */ + if (!ip) + return nh; + + if (nh->family != family) + continue; + switch (family) { case AF_INET: if (IPV4_ADDR_CMP(&nh->ip.ipv4, &ip->ipv4)) -- 2.39.5