Skip to content

Commit

Permalink
zebra: add route nhg specific counter
Browse files Browse the repository at this point in the history
Routes with a specific NHG need to be accounted separately.

Signed-off-by: Philippe Guibert <[email protected]>
  • Loading branch information
pguibert6WIND committed May 27, 2024
1 parent ebdbb0e commit b124415
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
7 changes: 6 additions & 1 deletion zebra/zapi_msg.c
Original file line number Diff line number Diff line change
Expand Up @@ -2162,7 +2162,12 @@ static void zread_route_add(ZAPI_HANDLER_ARGS)
* if this is a new/unknown nhe, a new copy will be allocated
* and stored.
*/
if (!re->nhe_id) {
if (re->nhe_id) {
if (api->prefix.family == AF_INET)
client->v4_route_nhg_add_cnt++;
else
client->v6_route_nhg_add_cnt++;
} else {
zebra_nhe_init(&nhe, afi, ng->nexthop);
nhe.nhg.nexthop = ng->nexthop;
nhe.backup_info = bnhg;
Expand Down
4 changes: 4 additions & 0 deletions zebra/zserv.c
Original file line number Diff line number Diff line change
Expand Up @@ -1092,6 +1092,10 @@ static void zebra_show_client_detail(struct vty *vty, struct zserv *client)
client->v4_route_upd8_cnt, client->v4_route_del_cnt);
vty_out(vty, "IPv6 %-12u%-12u%-12u\n", client->v6_route_add_cnt,
client->v6_route_upd8_cnt, client->v6_route_del_cnt);
vty_out(vty, "IPv4 NHG %-12u%-12u%-12u\n",
client->v4_route_nhg_add_cnt, 0, 0);
vty_out(vty, "IPv6 NHG %-12u%-12u%-12u\n",
client->v6_route_nhg_add_cnt, 0, 0);
vty_out(vty, "Redist:v4 %-12u%-12u%-12u\n", client->redist_v4_add_cnt,
0, client->redist_v4_del_cnt);
vty_out(vty, "Redist:v6 %-12u%-12u%-12u\n", client->redist_v6_add_cnt,
Expand Down
2 changes: 2 additions & 0 deletions zebra/zserv.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ struct zserv {
uint32_t redist_v4_del_cnt;
uint32_t redist_v6_add_cnt;
uint32_t redist_v6_del_cnt;
uint32_t v4_route_nhg_add_cnt;
uint32_t v6_route_nhg_add_cnt;
uint32_t v4_route_add_cnt;
uint32_t v4_route_upd8_cnt;
uint32_t v4_route_del_cnt;
Expand Down

0 comments on commit b124415

Please sign in to comment.