zebra: Display instance id as part of show zebra client summ

When displaying `show zebra client summ` when we have instances
running, display the instance number as well.

New Output:

sharpd@eva ~/frr7 (instance_data)> vtysh -c "show zebra client summ"
Name      Connect Time    Last Read  Last Write  IPv4 Routes       IPv6 Routes
--------------------------------------------------------------------------------
ospf[1]       00:00:02     00:00:02    00:00:02       0/0              0/0
ospf[5]       00:00:02     00:00:02    00:00:02       0/0              0/0
sharp         00:00:02     00:00:02    00:00:02       0/0              0/0
static        00:00:02     00:00:02    00:00:02       0/0              0/0
Routes column shows (added+updated)/deleted

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This commit is contained in:
Donald Sharp 2021-01-27 08:21:14 -05:00
parent 98e3dfaee0
commit 99a30b4760

View File

@ -55,6 +55,7 @@
#include "lib/frr_pthread.h" /* for frr_pthread_new, frr_pthread_stop... */
#include "lib/frratomic.h" /* for atomic_load_explicit, atomic_stor... */
#include "lib/lib_errors.h" /* for generic ferr ids */
#include "lib/printfrr.h" /* for string functions */
#include "zebra/debug.h" /* for various debugging macros */
#include "zebra/rib.h" /* for rib_score_proto */
@ -1186,6 +1187,7 @@ static void zebra_show_stale_client_detail(struct vty *vty,
static void zebra_show_client_brief(struct vty *vty, struct zserv *client)
{
char client_string[80];
char cbuf[ZEBRA_TIME_BUF], rbuf[ZEBRA_TIME_BUF];
char wbuf[ZEBRA_TIME_BUF];
time_t connect_time, last_read_time, last_write_time;
@ -1197,8 +1199,15 @@ static void zebra_show_client_brief(struct vty *vty, struct zserv *client)
last_write_time = (time_t)atomic_load_explicit(&client->last_write_time,
memory_order_relaxed);
vty_out(vty, "%-10s%12s %12s%12s%8d/%-8d%8d/%-8d\n",
zebra_route_string(client->proto),
if (client->instance || client->session_id)
snprintfrr(client_string, sizeof(client_string), "%s[%u:%u]",
zebra_route_string(client->proto), client->instance,
client->session_id);
else
snprintfrr(client_string, sizeof(client_string), "%s",
zebra_route_string(client->proto));
vty_out(vty, "%-10s%12s %12s%12s%8d/%-8d%8d/%-8d\n", client_string,
zserv_time_buf(&connect_time, cbuf, ZEBRA_TIME_BUF),
zserv_time_buf(&last_read_time, rbuf, ZEBRA_TIME_BUF),
zserv_time_buf(&last_write_time, wbuf, ZEBRA_TIME_BUF),