From owner-freebsd-net@FreeBSD.ORG Mon Oct 13 07:30:53 2003 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id AB65A16A4B3 for ; Mon, 13 Oct 2003 07:30:53 -0700 (PDT) Received: from thoth.sbs.de (thoth.sbs.de [192.35.17.2]) by mx1.FreeBSD.org (Postfix) with ESMTP id EC00C43F85 for ; Mon, 13 Oct 2003 07:30:51 -0700 (PDT) (envelope-from andre.albsmeier@siemens.com) Received: from mail3.siemens.de (mail3.siemens.de [139.25.208.14]) by thoth.sbs.de (8.11.7/8.11.7) with ESMTP id h9DEUi726610; Mon, 13 Oct 2003 16:30:44 +0200 (MEST) Received: from mars.cert.siemens.de (ust.mchp.siemens.de [139.23.201.17]) by mail3.siemens.de (8.11.7/8.11.7) with ESMTP id h9DEUdT11158; Mon, 13 Oct 2003 16:30:39 +0200 (MEST) Received: from curry.mchp.siemens.de (curry.mchp.siemens.de [139.25.42.7]) mail/cert.mc.pre,v 1.51 2003/10/08 13:21:15 ust Exp $) with ESMTP id h9DEUYPj076348; Mon, 13 Oct 2003 16:30:35 +0200 (CEST) Received: (from localhost) by curry.mchp.siemens.de (8.12.9p2/8.12.9) id h9DEUYaG020431; Date: Mon, 13 Oct 2003 16:30:32 +0200 From: Andre Albsmeier To: KIMURA Yasuhiro Message-ID: <20031013143032.GA24640@curry.mchp.siemens.de> References: <20031012.064710.49662944.yasu@utahime.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20031012.064710.49662944.yasu@utahime.org> X-Echelon: 727, jihad, Undercover, NCSA, CIA X-Advice: Drop that crappy M$-Outlook, I'm tired of your viruses! User-Agent: Mutt/1.5.4i cc: freebsd-net@freebsd.org Subject: Re: DNS lookup failure by host or dig X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Oct 2003 14:30:53 -0000 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