]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
pullup:
authorAndreas Gustafsson <source@isc.org>
Sun, 25 Feb 2001 01:31:03 +0000 (01:31 +0000)
committerAndreas Gustafsson <source@isc.org>
Sun, 25 Feb 2001 01:31:03 +0000 (01:31 +0000)
 753.   [bug]           dig, host, and nslookup would fail to contact a
                        remote server if getaddrinfo() returned an IPv6
                        address on a system that doesn't support IPv6.
                        [RT #917]

CHANGES
bin/dig/dighost.c

diff --git a/CHANGES b/CHANGES
index a9c7b664febaf9eb86cb0b18965b603012581f64..f55d6f5c2848b36e8f2e986d60ac83a761889329 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -5,6 +5,11 @@
                        cause the server to retry the transmission
                        indefinitely. [RT #902]
 
+ 753.  [bug]           dig, host, and nslookup would fail to contact a
+                       remote server if getaddrinfo() returned an IPv6
+                       address on a system that doesn't support IPv6.
+                       [RT #917]
+
  750.  [bug]           A query should not match a DNAME whose trust level
                        is pending.  [RT #916]
 
index 2f7e8547e625a40557907e6d5a2f68a187ae97fb..0e87c77733d7ee6339c926a937c8e573a3aaae77 100644 (file)
@@ -15,7 +15,7 @@
  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: dighost.c,v 1.174.2.5 2001/02/07 19:26:20 gson Exp $ */
+/* $Id: dighost.c,v 1.174.2.6 2001/02/25 01:31:03 gson Exp $ */
 
 /*
  * Notice to programmers:  Do not use this code as an example of how to
@@ -2622,7 +2622,7 @@ get_address(char *host, in_port_t port, isc_sockaddr_t *sockaddr) {
        struct in_addr in4;
        struct in6_addr in6;
 #ifdef USE_GETADDRINFO
-       struct addrinfo *res = NULL;
+       struct addrinfo *res = NULL, hints;
        int result;
 #else
        struct hostent *he;
@@ -2640,9 +2640,16 @@ get_address(char *host, in_port_t port, isc_sockaddr_t *sockaddr) {
                isc_sockaddr_fromin(sockaddr, &in4, port);
        else {
 #ifdef USE_GETADDRINFO
+               memset(&hints, 0, sizeof(hints));
+               if (!have_ipv6)
+                       hints.ai_family = PF_INET;
+               else if (!have_ipv4)
+                       hints.ai_family = PF_INET6;
+               else
+                       hints.ai_family = PF_UNSPEC;
                debug ("before getaddrinfo()");
                is_blocking = ISC_TRUE;
-               result = getaddrinfo(host, NULL, NULL, &res);
+               result = getaddrinfo(host, NULL, &hints, &res);
                is_blocking = ISC_FALSE;
                if (result != 0) {
                        fatal("Couldn't find server '%s': %s",