Query A records before AAAA records in getaddrinfo() when AF_UNSPEC
authorHiroki Sato <hrs@dragonflybsd.org>
Wed, 2 Feb 2005 15:10:55 +0000 (15:10 +0000)
committerHiroki Sato <hrs@dragonflybsd.org>
Wed, 2 Feb 2005 15:10:55 +0000 (15:10 +0000)
commit2b79103708732f52879ffa07d0a895a43bbaddb0
tree9a9652ce8c833414404a69f8c7bef67c6aee1da3
parent9655b9c315a8ba9adc7054de66b587e9463ace20
Query A records before AAAA records in getaddrinfo() when AF_UNSPEC
is specified.  Some broken DNS servers return NXDOMAIN against
non-existent AAAA queries, even when it should return NOERROR
with empty return records.  This is a problem for an IPv4/IPv6 dual
stack node since the NXDOMAIN returned by the first query of
an AAAA record makes it give up querying the A record.  Also, this
behavior has been recognized as a potential denial-of-service attack.

Note that although the query order has been changed, the result
linked-list of (struct addrinfo) set by getaddrinfo() is still
in order of AF_INET6 -> AF_INET.

Reference: http://www.kb.cert.org/vuls/id/714121
lib/libc/net/getaddrinfo.c