dig -6 causes bind9 error

Hajimu UMEMOTO ume at FreeBSD.org
Tue May 26 18:47:02 UTC 2009


Hi,

>>>>> On Tue, 26 May 2009 11:20:08 -0700
>>>>> Doug Barton <dougb at FreeBSD.org> said:

dougb> Given that you appear to only have an IPv4 server in your
dougb> /etc/resolv.conf file, why would you expect that to work? The -4 and
dougb> -6 flags are only relevant when you are using a name server hostname
dougb> that has both A and AAAA records.

I don't think that `dig -6' should work without an IPv6 server in
resolv.conf.

dougb> That said, I agree that the error message is less than graceful,
dougb> although dig is apparently trying to be helpful in converting what
dougb> you've given it into the best IPv6 format it can think of to try and
dougb> do what you told it to do.

It seems to me that dig(8) tries to use an IPv4-mapped IPv6 address
when only IPv4 server is listed in resolv.conf.
I confirmed that allowing use of an IPv4-mapped IPv6 address makes
dig(8) work against an IPv4 server, with the following patch:

Index: contrib/bind9/lib/isc/unix/socket.c
diff -u -p contrib/bind9/lib/isc/unix/socket.c.orig contrib/bind9/lib/isc/unix/socket.c
--- contrib/bind9/lib/isc/unix/socket.c.orig	2009-01-10 12:00:21.000000000 +0900
+++ contrib/bind9/lib/isc/unix/socket.c	2009-05-27 03:28:13.634476856 +0900
@@ -2108,6 +2108,8 @@ opensocket(isc_socketmgr_t *manager, isc
 	}
 #endif /* defined(USE_CMSG) || defined(SO_RCVBUF) */
 
+	isc_socket_ipv6only(sock, 0);
+
 	return (ISC_R_SUCCESS);
 }
 

But, I'm skeptical about allowing use of an IPv4-mapped IPv6 address,
here.  I'm not sure why libisc tries to use an IPv4-mapped IPv6
address in this case.

Sincerely,

--
Hajimu UMEMOTO @ Internet Mutual Aid Society Yokohama, Japan
ume at mahoroba.org  ume@{,jp.}FreeBSD.org
http://www.imasy.org/~ume/


More information about the freebsd-current mailing list