Skip to content

Commit

Permalink
zebra: fix update nexthop-group fib flag value
Browse files Browse the repository at this point in the history
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
>       }
>     ]
>   }
> }

expected:

> 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
>       }
>     ]
>   }
> }
>

Fix this by refreshing the fib flag value of its nexthops,
when the dataplane result indicate the nexthop-group is
installed.

Link: FRRouting#16332

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
  • Loading branch information
pguibert6WIND committed Jul 5, 2024
1 parent 47934a9 commit 12185c9
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions zebra/zebra_nhg.c
Original file line number Diff line number Diff line change
Expand Up @@ -3169,6 +3169,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);
Expand Down Expand Up @@ -3206,6 +3207,17 @@ void zebra_nhg_dplane_result(struct zebra_dplane_ctx *ctx)
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))
zsend_nhg_notify(nhe->type, nhe->zapi_instance,
Expand Down

0 comments on commit 12185c9

Please sign in to comment.