diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2004-01-11 01:05:17 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2004-01-11 01:05:17 +0000 |
commit | 0481fa450146250191a980ac1b919baf24c0b7da (patch) | |
tree | ea275c62df52a6d30fe5fe95639f0438ac6c0c12 /usr.sbin | |
parent | 15a14d5e3d65715ed4798d75ece609b99152a527 (diff) |
print local/remote IP/port with the detailed neighbor view
ok claudio@
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/bgpctl/bgpctl.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/usr.sbin/bgpctl/bgpctl.c b/usr.sbin/bgpctl/bgpctl.c index 1c40f0a3e50..c5c2815d5db 100644 --- a/usr.sbin/bgpctl/bgpctl.c +++ b/usr.sbin/bgpctl/bgpctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bgpctl.c,v 1.24 2004/01/10 21:04:37 henning Exp $ */ +/* $OpenBSD: bgpctl.c,v 1.25 2004/01/11 01:05:16 henning Exp $ */ /* * Copyright (c) 2003 Henning Brauer <henning@openbsd.org> @@ -340,6 +340,7 @@ int show_neighbor_msg(struct imsg *imsg, enum neighbor_views nv) { struct peer *p; + struct sockaddr_in *sa_in; switch (imsg->hdr.type) { case IMSG_CTL_SHOW_NEIGHBOR: @@ -370,6 +371,19 @@ show_neighbor_msg(struct imsg *imsg, enum neighbor_views nv) break; } printf("\n"); + if (p->sa_local.ss_family == AF_INET) { + sa_in = (struct sockaddr_in *)&p->sa_local; + printf(" Local host: %20s, Local port: %5u\n", + log_ntoa(sa_in->sin_addr.s_addr), + ntohs(sa_in->sin_port)); + } + if (p->sa_remote.ss_family == AF_INET) { + sa_in = (struct sockaddr_in *)&p->sa_remote; + printf(" Foreign host: %20s, Foreign port: %5u\n", + log_ntoa(sa_in->sin_addr.s_addr), + ntohs(sa_in->sin_port)); + } + printf("\n"); break; case IMSG_CTL_END: return (1); |