diff options
author | 2002-08-27 00:39:36 +0000 | |
---|---|---|
committer | 2002-08-27 00:39:36 +0000 | |
commit | feff4b0869378c1e8e24dcb87289a12a6fcaa49c (patch) | |
tree | e28c64f57c07005e3cc07adc8c79aab896cf6010 | |
parent | must yyrestart after longjmp; moritz@jodeit.org (diff) | |
download | wireguard-openbsd-feff4b0869378c1e8e24dcb87289a12a6fcaa49c.tar.xz wireguard-openbsd-feff4b0869378c1e8e24dcb87289a12a6fcaa49c.zip |
warn if multiple addresses are returned from DNS (traceroute(8) should do it too)
sync w/kame
-rw-r--r-- | usr.sbin/traceroute6/traceroute6.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/usr.sbin/traceroute6/traceroute6.c b/usr.sbin/traceroute6/traceroute6.c index d70a7e09304..deac9ce3449 100644 --- a/usr.sbin/traceroute6/traceroute6.c +++ b/usr.sbin/traceroute6/traceroute6.c @@ -1,5 +1,5 @@ -/* $OpenBSD: traceroute6.c,v 1.26 2002/08/08 23:53:21 stevesk Exp $ */ -/* $KAME: traceroute6.c,v 1.50 2002/05/26 13:12:07 itojun Exp $ */ +/* $OpenBSD: traceroute6.c,v 1.27 2002/08/27 00:39:36 itojun Exp $ */ +/* $KAME: traceroute6.c,v 1.58 2002/08/27 00:33:39 itojun Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -575,6 +575,13 @@ main(argc, argv) fprintf(stderr, "traceroute6: not enough core\n"); exit(1); } + if (res->ai_next) { + if (getnameinfo(res->ai_addr, res->ai_addrlen, hbuf, + sizeof(hbuf), NULL, 0, NI_NUMERICHOST) != 0) + strlcpy(hbuf, "?", sizeof(hbuf)); + fprintf(stderr, "traceroute6: Warning: %s has multiple " + "addresses; using %s\n", hostname, hbuf); + } if (*++argv) { ep = NULL; |