diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2005-06-04 23:38:08 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2005-06-04 23:38:08 +0000 |
commit | e0e8d6d7fb32f72e1561708d40cec3f6acd5d316 (patch) | |
tree | 59297c8170f771ed27149a6324c18019cf33e4ab /usr.sbin/bgpctl/bgpctl.c | |
parent | 3a3fb80f9fe2becda0ff8feaec9da5c2b0c4ccc5 (diff) |
do not print the tcp connection details when the session is IDLE, we
have no connection in that case
Diffstat (limited to 'usr.sbin/bgpctl/bgpctl.c')
-rw-r--r-- | usr.sbin/bgpctl/bgpctl.c | 40 |
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); |