summaryrefslogtreecommitdiffstats
path: root/usr.sbin/bgpctl
diff options
context:
space:
mode:
authorclaudio <claudio@openbsd.org>2020-01-24 05:46:00 +0000
committerclaudio <claudio@openbsd.org>2020-01-24 05:46:00 +0000
commita93f6d859e845c69aa5602785315d95e2827440f (patch)
tree0f9ef1330db51142edd1bde4203fe1655f0e4238 /usr.sbin/bgpctl
parentImplement 'max-prefix NUM out' to limit the number of announced prefixes. (diff)
downloadwireguard-openbsd-a93f6d859e845c69aa5602785315d95e2827440f.tar.xz
wireguard-openbsd-a93f6d859e845c69aa5602785315d95e2827440f.zip
Extend 'bgpctl show neighbor' to include the received and sent prefix
count. Also show the max-prefix out limit if one is set. OK job@
Diffstat (limited to 'usr.sbin/bgpctl')
-rw-r--r--usr.sbin/bgpctl/bgpctl.c4
-rw-r--r--usr.sbin/bgpctl/output.c12
2 files changed, 13 insertions, 3 deletions
diff --git a/usr.sbin/bgpctl/bgpctl.c b/usr.sbin/bgpctl/bgpctl.c
index c5e3d1754b1..cb6b57fce7f 100644
--- a/usr.sbin/bgpctl/bgpctl.c
+++ b/usr.sbin/bgpctl/bgpctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bgpctl.c,v 1.257 2020/01/21 11:14:26 claudio Exp $ */
+/* $OpenBSD: bgpctl.c,v 1.258 2020/01/24 05:46:00 claudio Exp $ */
/*
* Copyright (c) 2003 Henning Brauer <henning@openbsd.org>
@@ -584,6 +584,8 @@ print_neighbor_msgstats(struct peer *p)
p->stats.msg_rcvd_rrefresh);
printf(" Update statistics:\n");
printf(" %-15s %-10s %-10s\n", "", "Sent", "Received");
+ printf(" %-15s %10u %10u\n", "Prefixes",
+ p->stats.prefix_out_cnt, p->stats.prefix_cnt);
printf(" %-15s %10llu %10llu\n", "Updates",
p->stats.prefix_sent_update, p->stats.prefix_rcvd_update);
printf(" %-15s %10llu %10llu\n", "Withdraws",
diff --git a/usr.sbin/bgpctl/output.c b/usr.sbin/bgpctl/output.c
index 89aede2ded8..d41c19aaacd 100644
--- a/usr.sbin/bgpctl/output.c
+++ b/usr.sbin/bgpctl/output.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: output.c,v 1.4 2020/01/21 11:16:35 claudio Exp $ */
+/* $OpenBSD: output.c,v 1.5 2020/01/24 05:46:00 claudio Exp $ */
/*
* Copyright (c) 2003 Henning Brauer <henning@openbsd.org>
@@ -166,8 +166,16 @@ show_neighbor_full(struct peer *p, struct parse_result *res)
if (p->conf.max_prefix_restart)
printf(" (restart %u)",
p->conf.max_prefix_restart);
- printf("\n");
}
+ if (p->conf.max_out_prefix) {
+ printf(" Max-prefix out: %u", p->conf.max_out_prefix);
+ if (p->conf.max_out_prefix_restart)
+ printf(" (restart %u)",
+ p->conf.max_out_prefix_restart);
+ }
+ if (p->conf.max_prefix || p->conf.max_out_prefix)
+ printf("\n");
+
printf(" BGP version 4, remote router-id %s",
inet_ntoa(ina));
printf("%s\n", print_auth_method(p->auth.method));