host(1) problem with -6 option

Matthew Seaman m.seaman at infracaninophile.co.uk
Sun Nov 9 03:00:33 PST 2008


mdh wrote:
> 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 at 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

It's the way resolv.conf works.  Consider this --

happy-idiot-talk:~:% cat /etc/resolv.conf 
domain  infracaninophile.co.uk
nameserver      ::1
nameserver      127.0.0.1

Which is all fine and dandy when told to use IPv6:

happy-idiot-talk:~:% host -6 h-i-t.infracaninophile.co.uk
h-i-t.infracaninophile.co.uk is an alias for happy-idiot-talk.infracaninophile.co.uk.
happy-idiot-talk.infracaninophile.co.uk has address 81.187.76.162
happy-idiot-talk.infracaninophile.co.uk has IPv6 address 2001:8b0:151:1:240:5ff:fea5:8db7
happy-idiot-talk.infracaninophile.co.uk mail is handled by 10 smtp.infracaninophile.co.uk.

but goes tits-up when told to use IPv4:

happy-idiot-talk:~:% host -4 h-i-t.infracaninophile.co.uk
host: couldn't get address for '::1': address family not supported

nameserver entries in resolv.conf are tried in the order given.  Using
the -4 or -6 switches to host(1) forces it to try each of the listed
nameserver addresses by the stated protocol.  It makes no sense at all 
to try and access an IPv6 address using IPv4 transport, and trying the 
converse: an IPv4 address via IPv6, will either fail or try and use 
IPv4-mapped addresses.  You might think that the '-4' and '-6' flags
to host(1) are pretty much useless in that case, but they work fine 
when you also tell host(1) the domain name of a nameserver to use[*]:

happy-idiot-talk:~:% host -4 h-i-t.infracaninophile.co.uk localhost 
Using domain server:
Name: localhost
Address: 127.0.0.1#53
Aliases: 

h-i-t.infracaninophile.co.uk is an alias for happy-idiot-talk.infracaninophile.co.uk.
happy-idiot-talk.infracaninophile.co.uk has address 81.187.76.162
happy-idiot-talk.infracaninophile.co.uk has IPv6 address 2001:8b0:151:1:240:5ff:fea5:8db7
happy-idiot-talk.infracaninophile.co.uk mail is handled by 10 smtp.infracaninophile.co.uk.


happy-idiot-talk:~:% host -6 h-i-t.infracaninophile.co.uk localhost
Using domain server:
Name: localhost
Address: ::1#53
Aliases: 

h-i-t.infracaninophile.co.uk is an alias for happy-idiot-talk.infracaninophile.co.uk.
happy-idiot-talk.infracaninophile.co.uk has address 81.187.76.162
happy-idiot-talk.infracaninophile.co.uk has IPv6 address 2001:8b0:151:1:240:5ff:fea5:8db7
happy-idiot-talk.infracaninophile.co.uk mail is handled by 10 smtp.infracaninophile.co.uk.


Arguably it is a bug for host(1) to give up on the first entry in
/etc/resolv.conf when told to use a conflicting address type. 
However, that should be reported to ISC rather than the FreeBSD 
project.  When allowed to determine the transport type automatically
everything works as expected.

	Cheers,

	Matthew

[*] but only if the domain name of the nameserver you want to query
can be resolved by means that don't  fall foul of the same IPv4 vs
IPv6 problem.  Which boils down to using  other than the DNS --  eg. 
/etc/hosts -- to find the nameserver address.

-- 
Dr Matthew J Seaman MA, D.Phil.                   7 Priory Courtyard
                                                  Flat 3
PGP: http://www.infracaninophile.co.uk/pgpkey     Ramsgate
                                                  Kent, CT11 9PW

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 258 bytes
Desc: OpenPGP digital signature
Url : http://lists.freebsd.org/pipermail/freebsd-stable/attachments/20081109/c82da5e2/signature.pgp


More information about the freebsd-stable mailing list