"bgpctl XX nei" functions can now take "group XX" - when used as
"show nei group XX terse" you can't tell which entry relates to each
neighbour.

OK to add the address to the end of the line where it's reasonably
out of the way of existing parsers?

Index: bgpctl.c
===================================================================
RCS file: /cvs/src/usr.sbin/bgpctl/bgpctl.c,v
retrieving revision 1.243
diff -u -p -r1.243 bgpctl.c
--- bgpctl.c    5 Aug 2019 12:51:32 -0000       1.243
+++ bgpctl.c    23 Sep 2019 21:42:52 -0000
@@ -601,12 +601,26 @@ int
 show_neighbor_terse(struct imsg *imsg)
 {
        struct peer             *p;
+       char                    *s;
 
        switch (imsg->hdr.type) {
        case IMSG_CTL_SHOW_NEIGHBOR:
                p = imsg->data;
+               if ((p->conf.remote_addr.aid == AID_INET &&
+                   p->conf.remote_masklen != 32) ||
+                   (p->conf.remote_addr.aid == AID_INET6 &&
+                   p->conf.remote_masklen != 128)) {
+                       if (asprintf(&s, "%s/%u",
+                           log_addr(&p->conf.remote_addr),
+                           p->conf.remote_masklen) == -1)
+                               err(1, NULL);
+               } else
+                       if ((s = strdup(log_addr(&p->conf.remote_addr))) ==
+                           NULL)
+                               err(1, "strdup");
+
                printf("%llu %llu %llu %llu %llu %llu %llu "
-                   "%llu %llu %llu %u %u %llu %llu %llu %llu\n",
+                   "%llu %llu %llu %u %u %llu %llu %llu %llu %s\n",
                    p->stats.msg_sent_open, p->stats.msg_rcvd_open,
                    p->stats.msg_sent_notification,
                    p->stats.msg_rcvd_notification,
@@ -616,7 +630,7 @@ show_neighbor_terse(struct imsg *imsg)
                    p->stats.prefix_cnt, p->conf.max_prefix,
                    p->stats.prefix_sent_update, p->stats.prefix_rcvd_update,
                    p->stats.prefix_sent_withdraw,
-                   p->stats.prefix_rcvd_withdraw);
+                   p->stats.prefix_rcvd_withdraw, s);
                break;
        case IMSG_CTL_END:
                return (1);
Index: bgpctl.8
===================================================================
RCS file: /cvs/src/usr.sbin/bgpctl/bgpctl.8,v
retrieving revision 1.89
diff -u -p -r1.89 bgpctl.8
--- bgpctl.8    28 Jun 2019 12:12:06 -0000      1.89
+++ bgpctl.8    23 Sep 2019 21:47:58 -0000
@@ -289,7 +289,8 @@ Show statistics in an easily parseable t
 The printed numbers are the sent and received open, sent and received
 notifications, sent and received updates, sent and received keepalives, and
 sent and received route refresh messages plus the current and maximum
-prefix count, the number of sent and received updates, and withdraws.
+prefix count, the number of sent and received updates, sent and
+received withdraws, and finally the neighbor's address.
 .It Cm timers
 Show the BGP timers.
 .El


Reply via email to