From 92f8f0c6f3464a08057488b9186119400def7267 Mon Sep 17 00:00:00 2001 From: Philippe Guibert Date: Tue, 2 Jul 2024 16:10:15 +0200 Subject: [PATCH] zebra: fix update protocol nexthop-group fib flag value A nexthop-group does not display the 'fib' flag value of its nexthops. > nexthop-group A > nexthop 192.168.1.55 loop1 > exit observed: > ubuntu2204# show nexthop-group rib 181818168 json > { > "181818168":{ > "type":"sharp", > "refCount":1, > "uptime":"00:00:17", > "vrf":"default", > "valid":true, > "installed":true, > "depends":[ > 528 > ], > "nexthops":[ > { > "flags":1, > "ip":"192.168.1.55", > "afi":"ipv4", > "interfaceIndex":3, > "interfaceName":"loop1", > "vrf":"default", > "active":true, > "weight":1 > } > ] > } > } The FIB flag is used to inform the user that a given nexthop is installed in the system, which is the case when using iproute2: > # ip nexthop show id 181818168 > id 181818168 group 15 proto 194 > # ip nexthop show id 15 > id 15 via 192.168.1.55 dev loop1 scope link proto 194 Fix this by refreshing the FIB flag value of its nexthops, when the dataplane result indicate the nexthop-group is installed. > ubuntu2204# show nexthop-group rib 181818168 json > { > "181818168":{ > "type":"sharp", > "refCount":1, > "uptime":"00:00:25", > "vrf":"default", > "valid":true, > "installed":true, > "depends":[ > 574 > ], > "nexthops":[ > { > "flags":3, > "fib":true, > "ip":"192.168.1.55", > "afi":"ipv4", > "interfaceIndex":3, > "interfaceName":"loop1", > "vrf":"default", > "active":true, > "weight":1 > } > ] > } > } > Link: https://github.com/FRRouting/frr/pull/16332 Signed-off-by: Philippe Guibert --- zebra/zebra_nhg.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/zebra/zebra_nhg.c b/zebra/zebra_nhg.c index 6a42ea5ac16f..99225219c7c0 100644 --- a/zebra/zebra_nhg.c +++ b/zebra/zebra_nhg.c @@ -3251,6 +3251,7 @@ void zebra_nhg_dplane_result(struct zebra_dplane_ctx *ctx) enum zebra_dplane_result status; uint32_t id = 0; struct nhg_hash_entry *nhe = NULL; + struct nexthop *nhop; op = dplane_ctx_get_op(ctx); status = dplane_ctx_get_status(ctx); @@ -3287,6 +3288,14 @@ void zebra_nhg_dplane_result(struct zebra_dplane_ctx *ctx) case ZEBRA_DPLANE_REQUEST_SUCCESS: SET_FLAG(nhe->flags, NEXTHOP_GROUP_INSTALLED); zebra_nhg_handle_install(nhe, true); + /* update FIB flag of nexthop-group */ + for (ALL_NEXTHOPS(nhe->nhg, nhop)) { + if (!CHECK_FLAG(nhop->flags, NEXTHOP_FLAG_ACTIVE)) + continue; + if (CHECK_FLAG(nhop->flags, NEXTHOP_FLAG_RECURSIVE)) + continue; + SET_FLAG(nhop->flags, NEXTHOP_FLAG_FIB); + } /* If daemon nhg, send it an update */ if (PROTO_OWNED(nhe))