DNS lookup failure by host or dig

Andre Albsmeier andre.albsmeier at siemens.com
Mon Oct 13 07:30:53 PDT 2003


On Sun, 12-Oct-2003 at 06:47:10 +0900, KIMURA Yasuhiro wrote:
> I found DNS lookup by host or dig fails if (1) kernel is built without
> "options INET6" and (2) DNS server has both v4 and v6 address.
> 
> % host -t ns kame.net
> kame.net name server orange.kame.net
> kame.net name server ns1.itojun.org
> % host orange.kame.net
> orange.kame.net has address 203.178.141.194
> orange.kame.net has address 2001:200:0:8002:203:47ff:fea5:3085
> % host orange.kame.net orange.kame.net
> Using domain server:
> Name: orange.kame.net
> Addresses: 2001:200:0:8002:203:47ff:fea5:3085 203.178.141.194
> 
> Host not found, try again.
> % dig @orange.kame.net orange.kame.net
> 
> ; <<>> DiG 8.3 <<>> @orange.kame.net orange.kame.net 
> ; (2 servers found)
> ;; res options: init recurs defnam dnsrch
> ;; res_nsend to server orange.kame.net  2001:200:0:8002:203:47ff:fea5:3085: Protocol not supported
> % 
> 
> This happens on both 4.8R and 5.1R. What's wrong with this failure?
> Bug of FreeBSD or any configuration error of my machines?

This has bugged me as well a couple of times. I assume it comes
from the fact that host and dig use the code in contrib/bind.
This code doesn't have the necessary "#ifdef INET6" in it.
I fixed it here with the patch below but this is bad since:

- it patches contrib stuff
- I assume this is the wrong way to do it
- it is ugly

But it works :-)

--- contrib/bind/lib/irs/getaddrinfo.c.ORI	Tue Aug 26 09:31:19 2003
+++ contrib/bind/lib/irs/getaddrinfo.c	Tue Aug 26 09:32:25 2003
@@ -339,6 +339,7 @@
 		case PF_UNSPEC:
 		case PF_INET:
 		case PF_INET6:
+((struct addrinfo*)hints)->ai_family = PF_INET;
 			break;
 		default:
 			ERR(EAI_FAMILY);


	-Andre


More information about the freebsd-net mailing list