diff options
| author | Donald Sharp <sharpd@nvidia.com> | 2021-01-27 08:21:14 -0500 |
|---|---|---|
| committer | Donald Sharp <sharpd@nvidia.com> | 2021-02-04 08:35:14 -0500 |
| commit | 99a30b4760d12e7491842f64b8ae13ba692d50f5 (patch) | |
| tree | 8c4b2c80bcc72f621a1e73d9bb57ff55a8de7d11 /zebra/zserv.c | |
| parent | 98e3dfaee09ceca7eb00b3d7a3122c8dd43fc6f7 (diff) | |
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>
Diffstat (limited to 'zebra/zserv.c')
| -rw-r--r-- | zebra/zserv.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/zebra/zserv.c b/zebra/zserv.c index 484d94fac8..6c5eebe6fe 100644 --- a/zebra/zserv.c +++ b/zebra/zserv.c @@ -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), |
