struct bmp_bgp *bmpbgp;
struct bmp_targets *bt;
struct bmp_listener *bl;
+ struct bmp_active *ba;
struct bmp *bmp;
struct ttable *tt;
char buf[SU_ADDRSTRLEN];
+ char uptime[BGP_UPTIME_LEN];
+ char *out;
frr_each(bmp_bgph, &bmp_bgph, bmpbgp) {
vty_out(vty, "BMP state for BGP %s:\n\n",
sockunion2str(&bl->addr, buf,
SU_ADDRSTRLEN), bl->port);
+ vty_out(vty, "\n Outbound connections:\n");
+ tt = ttable_new(&ttable_styles[TTSTYLE_BLANK]);
+ ttable_add_row(tt, "remote|state||timer");
+ ttable_rowseps(tt, 0, BOTTOM, true, '-');
+ frr_each (bmp_actives, &bt->actives, ba) {
+ const char *state_str = "?";
+
+ if (ba->bmp) {
+ peer_uptime(ba->bmp->t_up.tv_sec,
+ uptime, sizeof(uptime),
+ false, NULL);
+ ttable_add_row(tt, "%s:%d|Up|%s|%s",
+ ba->hostname, ba->port,
+ ba->bmp->remote, uptime);
+ continue;
+ }
+
+ uptime[0] = '\0';
+
+ if (ba->t_timer) {
+ long trem = thread_timer_remain_second(
+ ba->t_timer);
+
+ peer_uptime(monotime(NULL) - trem,
+ uptime, sizeof(uptime),
+ false, NULL);
+ state_str = "RetryWait";
+ } else if (ba->t_read) {
+ state_str = "Connecting";
+ } else if (ba->resq.callback) {
+ state_str = "Resolving";
+ }
+
+ ttable_add_row(tt, "%s:%d|%s|%s|%s",
+ ba->hostname, ba->port,
+ state_str,
+ ba->last_err ? ba->last_err : "",
+ uptime);
+ continue;
+ }
+ out = ttable_dump(tt, "\n");
+ vty_out(vty, "%s", out);
+ XFREE(MTYPE_TMP, out);
+ ttable_del(tt);
+
vty_out(vty, "\n %zu connected clients:\n",
bmp_session_count(&bt->sessions));
tt = ttable_new(&ttable_styles[TTSTYLE_BLANK]);
frr_each (bmp_session, &bt->sessions, bmp) {
uint64_t total;
- char uptime[BGP_UPTIME_LEN];
size_t q, kq;
pullwr_stats(bmp->pullwr, &total, &q, &kq);
bmp->cnt_mirror_overruns,
total, q, kq);
}
- char *out = ttable_dump(tt, "\n");
+ out = ttable_dump(tt, "\n");
vty_out(vty, "%s", out);
XFREE(MTYPE_TMP, out);
ttable_del(tt);