diff options
author | Florian Obser <florian@cvs.openbsd.org> | 2014-04-18 17:00:08 +0000 |
---|---|---|
committer | Florian Obser <florian@cvs.openbsd.org> | 2014-04-18 17:00:08 +0000 |
commit | 4ee87eb3d3fe435f04eff67b7664611f84d569d6 (patch) | |
tree | d315a13ed9d6504de0145029a330464e52711231 /usr.sbin/traceroute | |
parent | 1b76495aae071786a3babc01afc038e82e895668 (diff) |
sync to traceroute6: use getnameinfo for destination ip
OK benno@
Diffstat (limited to 'usr.sbin/traceroute')
-rw-r--r-- | usr.sbin/traceroute/traceroute.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/usr.sbin/traceroute/traceroute.c b/usr.sbin/traceroute/traceroute.c index 650059ea6cb..6bb761b4e00 100644 --- a/usr.sbin/traceroute/traceroute.c +++ b/usr.sbin/traceroute/traceroute.c @@ -1,4 +1,4 @@ -/* $OpenBSD: traceroute.c,v 1.107 2014/04/18 16:58:02 florian Exp $ */ +/* $OpenBSD: traceroute.c,v 1.108 2014/04/18 17:00:07 florian Exp $ */ /* $NetBSD: traceroute.c,v 1.10 1995/05/21 15:50:45 mycroft Exp $ */ /*- @@ -647,8 +647,10 @@ main(int argc, char *argv[]) err(1, "getsockname"); srcport = ntohs(from.sin_port); - fprintf(stderr, "traceroute to %s (%s)", hostname, - inet_ntoa(to.sin_addr)); + if (getnameinfo((struct sockaddr *)&to, to.sin_len, hbuf, + sizeof(hbuf), NULL, 0, NI_NUMERICHOST)) + strlcpy(hbuf, "(invalid)", sizeof(hbuf)); + fprintf(stderr, "%s to %s (%s)", __progname, hostname, hbuf); if (source) fprintf(stderr, " from %s", source); fprintf(stderr, ", %u hops max, %d byte packets\n", max_ttl, datalen); |