diff options
author | claudio <claudio@openbsd.org> | 2019-02-27 04:34:21 +0000 |
---|---|---|
committer | claudio <claudio@openbsd.org> | 2019-02-27 04:34:21 +0000 |
commit | a6311673ce4df2391a23b5d98c5b5cb60de2e54b (patch) | |
tree | 1e740c1e2dba67b41ccb9480de9fd18885300350 /usr.sbin/bgpctl | |
parent | Convert the remote and local addresses in struct peer to be bgpd_addrs (diff) | |
download | wireguard-openbsd-a6311673ce4df2391a23b5d98c5b5cb60de2e54b.tar.xz wireguard-openbsd-a6311673ce4df2391a23b5d98c5b5cb60de2e54b.zip |
Adjust to the last bgpd change. sa2addr gets an extra agrument and
local and remote address in struct peer changed to bgpd_addrs.
OK benno@
Diffstat (limited to 'usr.sbin/bgpctl')
-rw-r--r-- | usr.sbin/bgpctl/bgpctl.c | 29 | ||||
-rw-r--r-- | usr.sbin/bgpctl/parser.c | 4 |
2 files changed, 9 insertions, 24 deletions
diff --git a/usr.sbin/bgpctl/bgpctl.c b/usr.sbin/bgpctl/bgpctl.c index ffd2562542e..ae5dab9c620 100644 --- a/usr.sbin/bgpctl/bgpctl.c +++ b/usr.sbin/bgpctl/bgpctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bgpctl.c,v 1.233 2019/02/25 11:51:58 claudio Exp $ */ +/* $OpenBSD: bgpctl.c,v 1.234 2019/02/27 04:34:21 claudio Exp $ */ /* * Copyright (c) 2003 Henning Brauer <henning@openbsd.org> @@ -28,7 +28,6 @@ #include <errno.h> #include <fcntl.h> #include <math.h> -#include <netdb.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -657,7 +656,7 @@ show_neighbor_msg(struct imsg *imsg, enum neighbor_views nv) struct peer *p; struct ctl_timer *t; struct in_addr ina; - char buf[NI_MAXHOST], pbuf[NI_MAXSERV], *s; + char *s; int hascapamp = 0; u_int8_t i; @@ -759,25 +758,11 @@ show_neighbor_msg(struct imsg *imsg, enum neighbor_views nv) if (errstr) printf(" Last error: %s\n\n", errstr); } else { - if (getnameinfo((struct sockaddr *)&p->sa_local, - (socklen_t)p->sa_local.ss_len, - buf, sizeof(buf), pbuf, sizeof(pbuf), - NI_NUMERICHOST | NI_NUMERICSERV)) { - strlcpy(buf, "(unknown)", sizeof(buf)); - strlcpy(pbuf, "", sizeof(pbuf)); - } - printf(" Local host: %20s, Local port: %5s\n", buf, - pbuf); - - if (getnameinfo((struct sockaddr *)&p->sa_remote, - (socklen_t)p->sa_remote.ss_len, - buf, sizeof(buf), pbuf, sizeof(pbuf), - NI_NUMERICHOST | NI_NUMERICSERV)) { - strlcpy(buf, "(unknown)", sizeof(buf)); - strlcpy(pbuf, "", sizeof(pbuf)); - } - printf(" Remote host: %20s, Remote port: %5s\n", buf, - pbuf); + printf(" Local host: %20s, Local port: %5u\n", + log_addr(&p->local), p->local_port); + + printf(" Remote host: %20s, Remote port: %5u\n", + log_addr(&p->remote), p->remote_port); printf("\n"); } break; diff --git a/usr.sbin/bgpctl/parser.c b/usr.sbin/bgpctl/parser.c index cd873dfcc3e..db7903c80de 100644 --- a/usr.sbin/bgpctl/parser.c +++ b/usr.sbin/bgpctl/parser.c @@ -1,4 +1,4 @@ -/* $OpenBSD: parser.c,v 1.91 2019/02/18 21:10:25 claudio Exp $ */ +/* $OpenBSD: parser.c,v 1.92 2019/02/27 04:34:21 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -944,7 +944,7 @@ parse_addr(const char *word, struct bgpd_addr *addr) hints.ai_socktype = SOCK_DGRAM; /*dummy*/ hints.ai_flags = AI_NUMERICHOST; if (getaddrinfo(word, "0", &hints, &r) == 0) { - sa2addr(r->ai_addr, addr); + sa2addr(r->ai_addr, addr, NULL); freeaddrinfo(r); return (1); } |