summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhenning <henning@openbsd.org>2005-06-04 23:38:07 +0000
committerhenning <henning@openbsd.org>2005-06-04 23:38:07 +0000
commitedd4f6ed06062f59d5533a8cdac2a11f3bbae3c4 (patch)
tree40bc287084859a71ae18d9e9d905c1e86e569528
parentwhen the max-prefix limit was exceeded generate a STOP event; we do not (diff)
downloadwireguard-openbsd-edd4f6ed06062f59d5533a8cdac2a11f3bbae3c4.tar.xz
wireguard-openbsd-edd4f6ed06062f59d5533a8cdac2a11f3bbae3c4.zip
do not print the tcp connection details when the session is IDLE, we
have no connection in that case
-rw-r--r--usr.sbin/bgpctl/bgpctl.c40
1 files changed, 22 insertions, 18 deletions
diff --git a/usr.sbin/bgpctl/bgpctl.c b/usr.sbin/bgpctl/bgpctl.c
index 4f772ee29cf..83b8927ec5f 100644
--- a/usr.sbin/bgpctl/bgpctl.c
+++ b/usr.sbin/bgpctl/bgpctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bgpctl.c,v 1.80 2005/05/27 17:10:29 claudio Exp $ */
+/* $OpenBSD: bgpctl.c,v 1.81 2005/06/04 23:38:07 henning Exp $ */
/*
* Copyright (c) 2003 Henning Brauer <henning@openbsd.org>
@@ -460,24 +460,28 @@ show_neighbor_msg(struct imsg *imsg, enum neighbor_views nv)
break;
}
printf("\n");
- 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));
+ if (p->state != STATE_IDLE) {
+ 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("\n");
}
- printf(" Remote host: %20s, Remote port: %5s\n", buf, pbuf);
- printf("\n");
break;
case IMSG_CTL_END:
return (1);