From ab5990d8b9756d880f7e3f21772362d9c161b3e0 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Fri, 5 Oct 2018 09:28:41 -0400 Subject: [PATCH] zebra: Add counting to nexthop register/unregister events Add a bit of code to note how many register/unregister nht events we have had. Signed-off-by: Donald Sharp --- zebra/zapi_msg.c | 4 ++++ zebra/zserv.c | 4 ++++ zebra/zserv.h | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/zebra/zapi_msg.c b/zebra/zapi_msg.c index 7ea0a4d47d..42b0a81510 100644 --- a/zebra/zapi_msg.c +++ b/zebra/zapi_msg.c @@ -1056,6 +1056,7 @@ static void zread_rnh_register(ZAPI_HANDLER_ARGS) STREAM_GETC(s, p.prefixlen); l += 4; if (p.family == AF_INET) { + client->v4_nh_watch_add_cnt++; if (p.prefixlen > IPV4_MAX_BITLEN) { zlog_debug( "%s: Specified prefix hdr->length %d is too large for a v4 address", @@ -1065,6 +1066,7 @@ static void zread_rnh_register(ZAPI_HANDLER_ARGS) STREAM_GET(&p.u.prefix4.s_addr, s, IPV4_MAX_BYTELEN); l += IPV4_MAX_BYTELEN; } else if (p.family == AF_INET6) { + client->v6_nh_watch_add_cnt++; if (p.prefixlen > IPV6_MAX_BITLEN) { zlog_debug( "%s: Specified prefix hdr->length %d is to large for a v6 address", @@ -1139,6 +1141,7 @@ static void zread_rnh_unregister(ZAPI_HANDLER_ARGS) STREAM_GETC(s, p.prefixlen); l += 4; if (p.family == AF_INET) { + client->v4_nh_watch_rem_cnt++; if (p.prefixlen > IPV4_MAX_BITLEN) { zlog_debug( "%s: Specified prefix hdr->length %d is to large for a v4 address", @@ -1148,6 +1151,7 @@ static void zread_rnh_unregister(ZAPI_HANDLER_ARGS) STREAM_GET(&p.u.prefix4.s_addr, s, IPV4_MAX_BYTELEN); l += IPV4_MAX_BYTELEN; } else if (p.family == AF_INET6) { + client->v6_nh_watch_rem_cnt++; if (p.prefixlen > IPV6_MAX_BITLEN) { zlog_debug( "%s: Specified prefix hdr->length %d is to large for a v6 address", diff --git a/zebra/zserv.c b/zebra/zserv.c index 8cc462577a..3c3bf4077b 100644 --- a/zebra/zserv.c +++ b/zebra/zserv.c @@ -940,6 +940,10 @@ static void zebra_show_client_detail(struct vty *vty, struct zserv *client) client->ifdel_cnt); vty_out(vty, "BFD peer %-12d%-12d%-12d\n", client->bfd_peer_add_cnt, client->bfd_peer_upd8_cnt, client->bfd_peer_del_cnt); + vty_out(vty, "NHT v4 %-12d%-12d%-12d\n", + client->v4_nh_watch_add_cnt, 0, client->v4_nh_watch_rem_cnt); + vty_out(vty, "NHT v6 %-12d%-12d%-12d\n", + client->v6_nh_watch_add_cnt, 0, client->v6_nh_watch_rem_cnt); vty_out(vty, "Interface Up Notifications: %d\n", client->ifup_cnt); vty_out(vty, "Interface Down Notifications: %d\n", client->ifdown_cnt); vty_out(vty, "VNI add notifications: %d\n", client->vniadd_cnt); diff --git a/zebra/zserv.h b/zebra/zserv.h index 987c67635d..f21ea17fe8 100644 --- a/zebra/zserv.h +++ b/zebra/zserv.h @@ -133,6 +133,10 @@ struct zserv { uint32_t macipdel_cnt; uint32_t prefixadd_cnt; uint32_t prefixdel_cnt; + uint32_t v4_nh_watch_add_cnt; + uint32_t v4_nh_watch_rem_cnt; + uint32_t v6_nh_watch_add_cnt; + uint32_t v6_nh_watch_rem_cnt; time_t nh_reg_time; time_t nh_dereg_time; -- 2.39.5