summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2002-08-27 00:39:37 +0000
committerJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2002-08-27 00:39:37 +0000
commite1d2ee583f49b4d56294278c3ce196a3336a2f0c (patch)
tree6770b96aed8ad0a6d8884452bd2a035775c92c26
parent1e294e3024c9781b0fdf3ac7f30c1ad80ca97087 (diff)
warn if multiple addresses are returned from DNS (traceroute(8) should do it too)
sync w/kame
-rw-r--r--usr.sbin/traceroute6/traceroute6.c11
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;