summaryrefslogtreecommitdiffstats
path: root/usr.sbin/bgpctl
diff options
context:
space:
mode:
authorsthen <sthen@openbsd.org>2019-09-24 14:46:09 +0000
committersthen <sthen@openbsd.org>2019-09-24 14:46:09 +0000
commitc492bc4cccc5ee733bc2d978f34d47adb5c4dab1 (patch)
tree566e96d16753fa88dd53246c29dbcf9891689c9b /usr.sbin/bgpctl
parentMention 88E1545. (diff)
downloadwireguard-openbsd-c492bc4cccc5ee733bc2d978f34d47adb5c4dab1.tar.xz
wireguard-openbsd-c492bc4cccc5ee733bc2d978f34d47adb5c4dab1.zip
add the neighbour's address, to disambiguate peers in the output from
"bgpctl sh nei group XX terse". feedback benno@ ok claudio@
Diffstat (limited to 'usr.sbin/bgpctl')
-rw-r--r--usr.sbin/bgpctl/bgpctl.87
-rw-r--r--usr.sbin/bgpctl/bgpctl.c21
2 files changed, 22 insertions, 6 deletions
diff --git a/usr.sbin/bgpctl/bgpctl.8 b/usr.sbin/bgpctl/bgpctl.8
index 70e5010c977..31568d811ec 100644
--- a/usr.sbin/bgpctl/bgpctl.8
+++ b/usr.sbin/bgpctl/bgpctl.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: bgpctl.8,v 1.89 2019/06/28 12:12:06 claudio Exp $
+.\" $OpenBSD: bgpctl.8,v 1.90 2019/09/24 14:46:09 sthen Exp $
.\"
.\" Copyright (c) 2003 Henning Brauer <henning@openbsd.org>
.\"
@@ -14,7 +14,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: June 28 2019 $
+.Dd $Mdocdate: September 24 2019 $
.Dt BGPCTL 8
.Os
.Sh NAME
@@ -289,7 +289,8 @@ Show statistics in an easily parseable terse format.
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
diff --git a/usr.sbin/bgpctl/bgpctl.c b/usr.sbin/bgpctl/bgpctl.c
index c30a64f8f57..d5734addedf 100644
--- a/usr.sbin/bgpctl/bgpctl.c
+++ b/usr.sbin/bgpctl/bgpctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bgpctl.c,v 1.243 2019/08/05 12:51:32 claudio Exp $ */
+/* $OpenBSD: bgpctl.c,v 1.244 2019/09/24 14:46:09 sthen Exp $ */
/*
* Copyright (c) 2003 Henning Brauer <henning@openbsd.org>
@@ -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,8 @@ 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);
+ free(s);
break;
case IMSG_CTL_END:
return (1);