diff options
| author | Philippe Guibert <philippe.guibert@6wind.com> | 2023-11-23 17:18:23 +0100 |
|---|---|---|
| committer | Philippe Guibert <philippe.guibert@6wind.com> | 2023-11-30 14:25:00 +0100 |
| commit | d41b425ab3384f80b338a8ec3b407a277a8646e0 (patch) | |
| tree | 5e2538e4226bc292f85eebecc17d61a0b4dcd2bb /zebra/zapi_msg.c | |
| parent | 427d3f81f4a8c040b52ecb2e1d7ba4224b2d069c (diff) | |
zebra: add client counter for nhg operations
Add three counters that account for the nhg operations
that are using the zebra API with the NHG_ADD and NHG_DEL
commands.
> # show zebra client
> [..]
> Type Add Update Del
> ==================================================
> IPv4 100 0 0
> IPv6 0 0 0
> Redist:v4 0 0 0
> Redist:v6 0 0 0
> NHG 1 1 1
> VRF 3 0 0
> [..]
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Diffstat (limited to 'zebra/zapi_msg.c')
| -rw-r--r-- | zebra/zapi_msg.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/zebra/zapi_msg.c b/zebra/zapi_msg.c index 98268dafa6..f7293d8f0f 100644 --- a/zebra/zapi_msg.c +++ b/zebra/zapi_msg.c @@ -1973,6 +1973,8 @@ static void zread_nhg_del(ZAPI_HANDLER_ARGS) zsend_nhg_notify(api_nhg.proto, client->instance, client->session_id, api_nhg.id, ZAPI_NHG_REMOVE_FAIL); + /* Stats */ + client->nhg_del_cnt++; } static void zread_nhg_add(ZAPI_HANDLER_ARGS) @@ -1981,7 +1983,7 @@ static void zread_nhg_add(ZAPI_HANDLER_ARGS) struct zapi_nhg api_nhg = {}; struct nexthop_group *nhg = NULL; struct nhg_backup_info *bnhg = NULL; - struct nhg_hash_entry *nhe; + struct nhg_hash_entry *nhe, *nhe_tmp; s = msg; if (zapi_nhg_decode(s, hdr->command, &api_nhg) < 0) { @@ -2039,6 +2041,12 @@ static void zread_nhg_add(ZAPI_HANDLER_ARGS) nexthop_group_delete(&nhg); zebra_nhg_backup_free(&bnhg); + /* Stats */ + nhe_tmp = zebra_nhg_lookup_id(api_nhg.id); + if (nhe_tmp) + client->nhg_upd8_cnt++; + else + client->nhg_add_cnt++; } static void zread_route_add(ZAPI_HANDLER_ARGS) |
