[hipl-dev] Re: Address order

  • From: Robert Moskowitz <rgm@xxxxxxxxxxxxxxx>
  • To: hipl-dev@xxxxxxxxxxxxx
  • Date: Wed, 23 Apr 2014 16:09:02 -0400


On 04/18/2014 04:05 PM, Juhani Toivonen wrote:
Hi,

On 17.04.2014, at 18:33, Robert Moskowitz <rgm@xxxxxxxxxxxxxxx> wrote:

So either BIND is sending v4 before v6 (I would have to bring up wireshark to 
test), or Fedora resolver (or host command) is doing the priority ordering.
Just a wild guess: BIND might iterate through the record types in alphabetical 
order while constructing the response. A comes before AAAA.

No. I have dug into this both on the BIND list and the Fedora list. Here is what I have learned.

From BIND:

/  Does bind order address class on queries?  That is does it, say, group
/>/  IPv4 addresses then IPv6?
/
If the query is for A records the response will contain only IPv4
addresses, if the query is for AAAA records it will be IPv6. Only if the
client performs an ANY query will the response contain both. ANY records
are not generally used by applications, because they only return what's
in the resolver's cache, which may not be all the records associated
with the name; ANY queries are usually only useful when querying
authoritative servers (unless what you're trying to find out is what's
currently in the resolver's cache).


And from Fedora:

To get multiple types, you
have to send multiple queries (ANY is special).  The "host" command-line
tool does not duplicate the way an application does lookups.  "host"
(per the man page) specifically by default looks up A, AAAA, and MX, in
that order.

Applications on the other hand use a few different library calls to
convert names to addresses, most commonly gethostbyname() (old,
IPv4-only) or getaddrinfo() (new, can handle multiple address families).
For modern applications that use getaddrinfo(), the default is to follow
the ordering rules defined in RFC 3484 that (in general) put IPv6
addresses ahead of IPv4 addresses.

You can control some of the ordering with /etc/gai.conf; see "man
gai.conf" for more info.


So.....

It SHOULD be up to the app to do the 'right thing' if it supports IPv6 and IPv4. We should at least be selecting IPv6 over IPv4. So how does, say Telnet work?


Other related posts: