Bug 128727 - host(1) does not work properly with the -6 option
Summary: host(1) does not work properly with the -6 option
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: Unspecified
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-11-09 16:20 UTC by Matt D. Harris
Modified: 2018-01-03 05:16 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matt D. Harris 2008-11-09 16:20:08 UTC
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.
Comment 1 Garrett Cooper 2008-11-09 17:08:32 UTC
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
Comment 2 Matt D. Harris 2008-11-09 17:16:02 UTC
> 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
Comment 3 Rebecca Cran freebsd_committer freebsd_triage 2008-11-09 22:06:36 UTC
An explanation has been given on
freebsd-stable@ - see
http://lists.freebsd.org/pipermail/freebsd-stable/2008-November/046467.html

-- 
Bruce Cran
Comment 4 Matt D. Harris 2008-11-09 22:36:47 UTC
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
Comment 5 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 08:00:53 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped