summaryrefslogtreecommitdiffstats
path: root/lib/libc/net/getaddrinfo.c
diff options
context:
space:
mode:
authorume <ume@FreeBSD.org>2005-01-27 08:03:46 +0000
committerume <ume@FreeBSD.org>2005-01-27 08:03:46 +0000
commit9958feca82f15583e0acf128dca02d928c8b8dee (patch)
treed891a9b88c014c4d1021628fff9455e2da93786f /lib/libc/net/getaddrinfo.c
parentbf144c55eafcdb7849bbaab349e3734166d083a7 (diff)
downloadFreeBSD-src-9958feca82f15583e0acf128dca02d928c8b8dee.zip
FreeBSD-src-9958feca82f15583e0acf128dca02d928c8b8dee.tar.gz
query A RR before AAAA RR.
MFC after: 1 week
Diffstat (limited to 'lib/libc/net/getaddrinfo.c')
-rw-r--r--lib/libc/net/getaddrinfo.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/libc/net/getaddrinfo.c b/lib/libc/net/getaddrinfo.c
index 9c4948e..87f96c2 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)
OpenPOWER on IntegriCloud