From nobody@FreeBSD.org  Sun Nov  9 16:13:44 2008
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D5D36106564A
	for <freebsd-gnats-submit@FreeBSD.org>; Sun,  9 Nov 2008 16:13:44 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id C1E078FC0A
	for <freebsd-gnats-submit@FreeBSD.org>; Sun,  9 Nov 2008 16:13:44 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.3/8.14.3) with ESMTP id mA9GDiKx026489
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 9 Nov 2008 16:13:44 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.3/8.14.3/Submit) id mA9GDiMk026488;
	Sun, 9 Nov 2008 16:13:44 GMT
	(envelope-from nobody)
Message-Id: <200811091613.mA9GDiMk026488@www.freebsd.org>
Date: Sun, 9 Nov 2008 16:13:44 GMT
From: "Matt D. Harris" <mdh_lists@yahoo.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: host(1) does not work properly with the -6 option
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         128727
>Category:       bin
>Synopsis:       host(1) does not work properly with the -6 option
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Nov 09 16:20:08 UTC 2008
>Closed-Date:    
>Last-Modified:  Wed Nov 12 18:55:12 UTC 2008
>Originator:     Matt D. Harris
>Release:        RELENG_7_0
>Organization:
>Environment:
FreeBSD rapier.mydomain 7.0-RELEASE-p5 FreeBSD 7.0-RELEASE-p5 #0: Thu Nov  6 14:39:04 PST 2008     root@rapier.mydomain:/usr/src/sys/i386/compile/RAPIER  i386

>Description:
Howdy folks,
I'm having a little trouble understanding a problem that the `host` command in RELENG_7_0 (very recent) is having.  This is by and large my first time working with IPv6, which I've been meaning to learn for some time.  First off, I've got my zone file configured to return a AAAA record for x1.mydomain and named isn't complaining.  However, when I run `host -6 x1.mydomain`, host returns the following output:

(root@rapier) [/etc/namedb]: host -6 x1.mydomain
/usr/src/lib/bind/isc/../../../contrib/bind9/lib/isc/unix/socket.c:1179: internal_send: ::ffff:127.0.0.1#53: Invalid argument
/usr/src/lib/bind/isc/../../../contrib/bind9/lib/isc/unix/socket.c:1179: internal_send: ::ffff:IP.IP.IP.8#53: Invalid argument
/usr/src/lib/bind/isc/../../../contrib/bind9/lib/isc/unix/socket.c:1179: internal_send: ::ffff:127.0.0.1#53: Invalid argument
/usr/src/lib/bind/isc/../../../contrib/bind9/lib/isc/unix/socket.c:1179: internal_send: ::ffff:IP.IP.IP.8#53: Invalid argument
;; connection timed out; no servers could be reached

IP.IP.IP.8 is my ISP's DNS server, and is a third option just in case the localhost DNS server crashes or goes batty while I'm out drinking or somesuch.  Here's my resolv.conf, which shows ::1 listed as the second nameserver entry - however, it seems host -6 never even tries it. 

domain          mydomain
search          mydomain
nameserver      127.0.0.1
nameserver      ::1
nameserver      IP.IP.IP.8

The DNS server running on localhost is authoritative for mydomain.  I can ping it via localhost using both v4 and v6, and I can also ping the external v4 and v6 addresses just fine remotely.  

Worth noting is that host without the -6 option resolves the v6 addresses just fine, however it seems like it should work properly with the -6 option as well.  It is likely doing so via the IPv4 nameserver address, since that is the first nameserver specified in resolv.conf.  I had considered that perhaps IPv6 hosts needed a different type of specification in resolv.conf, however IPv6 is not mentioned at all in the resolv.conf(5) man page.  

Based on responses on the -questions mailing list, it seems that the -6 option should cause the host(1) command to only make queries via IPv6, and hence the ::1 line in resolv.conf should be the only one utilized.  

As I said, I'm new to IPv6, but this behavior seems to be counterintuitive.  Am I just doing it wrong?  

>How-To-Repeat:
Use the host(1) command with the -6 option to look up an IPv6 AAAA record or an ip6.arpa PTR record.  

>Fix:


>Release-Note:
>Audit-Trail:

From: Garrett Cooper <yanefbsd@gmail.com>
To: Matt D. Harris <mdh_lists@yahoo.com>
Cc: bug-followup@FreeBSD.org
Subject: Re: bin/128727: host(1) does not work properly with the -6 option
Date: Sun, 9 Nov 2008 09:08:32 -0800

 1. Do you have IPv6 enabled in the kernel?
 2. What does your /etc/hosts file say?
 3. Can you actually resolve the `mydomain' domain?
 
 -Garrett

From: mdh <mdh_lists@yahoo.com>
To: bug-followup@freebsd.org
Cc:  
Subject: Re: bin/128727: host(1) does not work properly with the -6 option
Date: Sun, 9 Nov 2008 09:16:02 -0800 (PST)

 > 1. Do you have IPv6 enabled in the kernel?
 
 Yes, IPv6 is working on the system.  I can ping6 its ::1 locally, as well as its external v6 interface from a v6-connected remote host over the internet. 
 
 > 2. What does your /etc/hosts file say?
 
 It has a localhost entry for 127.0.0.1 and a localhost entry for ::1
 
 > 3. Can you actually resolve the `mydomain' domain?
 
 I've simply put that in as a placeholder for the actual domain.  Resolution works fine.  I can even resolve the A and AAAA records in the domain via the host command when *not* using the -6 option (ie host(1) asks the nameserver on the 127.0.0.1 interface).  What I was trying to do was force host(1) to query the nameserver on ::1 to ensure that BIND was properly answering queries on its IPv6 addresses. 
 
 Thanks, Matt

From: Bruce Cran <bruce@cran.org.uk>
To: "Matt D. Harris" <mdh_lists@yahoo.com>
Cc: freebsd-gnats-submit@FreeBSD.org
Subject: Re: bin/128727: host(1) does not work properly with the -6 option
Date: Sun, 9 Nov 2008 14:06:36 -0800

 An explanation has been given on
 freebsd-stable@ - see
 http://lists.freebsd.org/pipermail/freebsd-stable/2008-November/046467.html
 
 -- 
 Bruce Cran

Date: Sun, 9 Nov 2008 14:36:47 -0800 (PST)
From: mdh <mdh_lists@yahoo.com>
Reply-To: mdh_lists@yahoo.com
Subject: Re: bin/128727: host(1) does not work properly with the -6 option

 Yeah, the behavior still seems counterintuitive though.  The -4 and -6
 options are virtually useless (I can't think of any reason one would ever
 use them, as they are now).  Perhaps this should be taken to ISC, though,
 since it's their tool.  

 Thanks, Matt
>Unformatted:
