diff options
author | Hajimu UMEMOTO <ume@FreeBSD.org> | 2005-01-27 08:03:46 +0000 |
---|---|---|
committer | Hajimu UMEMOTO <ume@FreeBSD.org> | 2005-01-27 08:03:46 +0000 |
commit | d0d6a2c7ccec60618059cce4a01f4d41d78c732c (patch) | |
tree | d891a9b88c014c4d1021628fff9455e2da93786f /lib/libc/net | |
parent | b3efc9018f21be13b87e23b7de5bc181c61baa7a (diff) | |
download | src-d0d6a2c7ccec60618059cce4a01f4d41d78c732c.tar.gz src-d0d6a2c7ccec60618059cce4a01f4d41d78c732c.zip |
query A RR before AAAA RR.
MFC after: 1 week
Notes
Notes:
svn path=/head/; revision=140896
Diffstat (limited to 'lib/libc/net')
-rw-r--r-- | lib/libc/net/getaddrinfo.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/libc/net/getaddrinfo.c b/lib/libc/net/getaddrinfo.c index 9c4948e7fc7f..87f96c207f28 100644 --- a/lib/libc/net/getaddrinfo.c +++ b/lib/libc/net/getaddrinfo.c @@ -1970,16 +1970,15 @@ _dns_getaddrinfo(rv, cb_data, ap) switch (pai->ai_family) { case AF_UNSPEC: - /* prefer IPv6 */ q.name = hostname; q.qclass = C_IN; - q.qtype = T_AAAA; + q.qtype = T_A; q.answer = buf->buf; q.anslen = sizeof(buf->buf); q.next = &q2; q2.name = hostname; q2.qclass = C_IN; - q2.qtype = T_A; + q2.qtype = T_AAAA; q2.answer = buf2->buf; q2.anslen = sizeof(buf2->buf); break; @@ -2007,17 +2006,18 @@ _dns_getaddrinfo(rv, cb_data, ap) free(buf2); return NS_NOTFOUND; } - ai = getanswer(buf, q.n, q.name, q.qtype, pai); - if (ai) { - cur->ai_next = ai; - while (cur && cur->ai_next) - cur = cur->ai_next; - } + /* prefer IPv6 */ if (q.next) { ai = getanswer(buf2, q2.n, q2.name, q2.qtype, pai); - if (ai) + if (ai) { cur->ai_next = ai; + while (cur && cur->ai_next) + cur = cur->ai_next; + } } + ai = getanswer(buf, q.n, q.name, q.qtype, pai); + if (ai) + cur->ai_next = ai; free(buf); free(buf2); if (sentinel.ai_next == NULL) |