diff options
author | Nathaniel White <nate@natexornate.com> | 2017-03-03 15:57:47 -0700 |
---|---|---|
committer | Pavel Šimerda <pavlix@pavlix.net> | 2017-04-15 01:41:45 +0200 |
commit | 1ef0e4c86d358c8e217b90686394196412e184d2 (patch) | |
tree | 7dca37ece04f12c46e79441775b34a245cc48b1d | |
parent | ba91549593e4aa3a7a71539b0eb6bdba6b08e861 (diff) | |
download | iputils-1ef0e4c86d358c8e217b90686394196412e184d2.tar.gz |
traceroute6: Fix traceroute to IPv6 address
Tracing to an IPv6 address was broken in 40fd68a784 when fixing tracing
to a hostname. It correctly moved the assignment to after the memcpy
into 'to', but that code path is only executed when tracing to a
hostname. The fix just moves the assignment to after the code paths for
filling out 'to' for both IPv6 addresses and hostnames.
-rw-r--r-- | traceroute6.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/traceroute6.c b/traceroute6.c index fd8851f..c496e11 100644 --- a/traceroute6.c +++ b/traceroute6.c @@ -467,7 +467,6 @@ int main(int argc, char *argv[]) } memcpy(to, result->ai_addr, sizeof *to); - to->sin6_port = htons(port); resolved_hostname = strdup(result->ai_canonname); if (resolved_hostname == NULL) { (void)fprintf(stderr, @@ -477,6 +476,9 @@ int main(int argc, char *argv[]) hostname = resolved_hostname; freeaddrinfo(result); } + + to->sin6_port = htons(port); + firsthop = *to; if (*++argv) { datalen = atoi(*argv); |