summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2009-12-08 14:04:55 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2009-12-08 14:04:55 +0000
commit8944a1bba9e9bfde2e4aeb8c6529ce3daeb6d96f (patch)
tree79b796f2e3416e86bb1d59ec18f79f2c8102029c /usr.sbin
parent3035ded84a27dbb93640b134ee299e40bdfab886 (diff)
Big AID change part 2 bgpctl part. Cope with the changes in bgpd, more to
follow. OK henning
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/bgpctl/bgpctl.c47
1 files changed, 18 insertions, 29 deletions
diff --git a/usr.sbin/bgpctl/bgpctl.c b/usr.sbin/bgpctl/bgpctl.c
index 3ea8db69475..f7ea7050bc9 100644
--- a/usr.sbin/bgpctl/bgpctl.c
+++ b/usr.sbin/bgpctl/bgpctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bgpctl.c,v 1.150 2009/12/01 14:29:40 claudio Exp $ */
+/* $OpenBSD: bgpctl.c,v 1.151 2009/12/08 14:04:54 claudio Exp $ */
/*
* Copyright (c) 2003 Henning Brauer <henning@openbsd.org>
@@ -50,7 +50,6 @@ int show_summary_msg(struct imsg *, int);
int show_summary_terse_msg(struct imsg *, int);
int show_neighbor_terse(struct imsg *);
int show_neighbor_msg(struct imsg *, enum neighbor_views);
-void print_neighbor_capa_mp_safi(u_int8_t);
void print_neighbor_msgstats(struct peer *);
void print_timer(const char *, time_t);
static char *fmt_timeframe(time_t t);
@@ -532,6 +531,8 @@ show_neighbor_msg(struct imsg *imsg, enum neighbor_views nv)
struct ctl_timer *t;
struct in_addr ina;
char buf[NI_MAXHOST], pbuf[NI_MAXSERV], *s;
+ int comma, hascapamp = 0;
+ u_int8_t i;
switch (imsg->hdr.type) {
case IMSG_CTL_SHOW_NEIGHBOR:
@@ -578,18 +579,23 @@ show_neighbor_msg(struct imsg *imsg, enum neighbor_views nv)
printf(" Last read %s, holdtime %us, keepalive interval %us\n",
fmt_timeframe(p->stats.last_read),
p->holdtime, p->holdtime/3);
- if (p->capa.peer.mp_v4 || p->capa.peer.mp_v6 ||
- p->capa.peer.refresh || p->capa.peer.restart ||
- p->capa.peer.as4byte) {
+ for (i = 0; i < AID_MAX; i++)
+ if (p->capa.peer.mp[i])
+ hascapamp = 1;
+ if (hascapamp || p->capa.peer.refresh ||
+ p->capa.peer.restart || p->capa.peer.as4byte) {
printf(" Neighbor capabilities:\n");
- if (p->capa.peer.mp_v4) {
- printf(" Multiprotocol extensions: IPv4");
- print_neighbor_capa_mp_safi(p->capa.peer.mp_v4);
- }
- if (p->capa.peer.mp_v6) {
- printf(" Multiprotocol extensions: IPv6");
- print_neighbor_capa_mp_safi(p->capa.peer.mp_v6);
+ if (hascapamp)
+ printf(" Multiprotocol extensions: ");
+ for (i = 0, comma = 0; i < AID_MAX; i++) {
+ if (p->capa.peer.mp[i]) {
+ printf("%s%s", comma ? ", " : "",
+ aid2str(i));
+ comma = 1;
+ }
}
+ if (hascapamp)
+ printf("\n");
if (p->capa.peer.refresh)
printf(" Route Refresh\n");
if (p->capa.peer.restart)
@@ -648,23 +654,6 @@ show_neighbor_msg(struct imsg *imsg, enum neighbor_views nv)
}
void
-print_neighbor_capa_mp_safi(u_int8_t safi)
-{
- switch (safi) {
- case SAFI_UNICAST:
- printf(" Unicast");
- break;
- case SAFI_MULTICAST:
- printf(" Multicast");
- break;
- default:
- printf(" unknown (%u)", safi);
- break;
- }
- printf("\n");
-}
-
-void
print_neighbor_msgstats(struct peer *p)
{
printf(" Message statistics:\n");