From 9b4d578f4118ef85ddb1afc5d01ddbcec7e3cce1 Mon Sep 17 00:00:00 2001 From: Renato Westphal Date: Mon, 18 May 2020 23:16:25 -0300 Subject: [PATCH] zebra: skip link-local routes when iterating over the RIB using the NB The motivation for this change is that IPv6 link-local routes don't conform to the zebra YANG module since they all have the same prefix (fe80::/64), but zebra's YANG module require each route to have an unique prefix (the key of the "rib" list). This violation can cause problems when iterating over the RIB asynchronously, so skip those routes. At the end of the day nobody cares about link-local routes anyway :) Signed-off-by: Renato Westphal --- zebra/zebra_nb_state.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/zebra/zebra_nb_state.c b/zebra/zebra_nb_state.c index a09ac85682..e1c06819fa 100644 --- a/zebra/zebra_nb_state.c +++ b/zebra/zebra_nb_state.c @@ -228,6 +228,11 @@ lib_vrf_zebra_ribs_rib_route_get_next(struct nb_cb_get_next_args *args) else rn = srcdest_route_next((struct route_node *)rn); + /* Skip link-local routes. */ + if (rn && rn->p.family == AF_INET6 + && IN6_IS_ADDR_LINKLOCAL(&rn->p.u.prefix6)) + return NULL; + return rn; } -- 2.39.5