NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: lib/42405: libc: getaddrinfo() should perform T_A lookups before T_AAAA lookups
The following reply was made to PR lib/42405; it has been noted by GNATS.
From: "Greg A. Woods" <woods%planix.ca@localhost>
To: NetBSD GNATS <gnats-bugs%NetBSD.org@localhost>
Cc: lib-bug-people%netbsd.org@localhost,
NetBSD GNATS Administrator <gnats-admin%NetBSD.org@localhost>,
cswiger%mac.com@localhost
Subject: Re: lib/42405: libc: getaddrinfo() should perform T_A lookups before
T_AAAA lookups
Date: Fri, 04 Dec 2009 16:47:39 -0500
--pgp-sign-Multipart_Fri_Dec__4_16:47:39_2009-1
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: quoted-printable
At Fri, 4 Dec 2009 14:15:05 +0000 (UTC), Martin Husemann <martin@duskware.=
de> wrote:
Subject: Re: lib/42405: libc: getaddrinfo() should perform T_A lookups befo=
re T_AAAA lookups
>=20
> The following reply was made to PR lib/42405; it has been noted by GNATS.
>=20
> From: Martin Husemann <martin%duskware.de@localhost>
> To: gnats-bugs%NetBSD.org@localhost
> Cc:=20
> Subject: Re: lib/42405: libc: getaddrinfo() should perform T_A lookups be=
fore T_AAAA lookups
> Date: Fri, 4 Dec 2009 15:13:28 +0100
>=20
> On Thu, Dec 03, 2009 at 11:00:15PM +0000, Matthias Scheler wrote:
> > The behaviour should not be hard-coded, it should be configurable.
> =20
> I agree.
> The behaviour might have been a good idea in 2005, but now we either sho=
uld
> stick with our current behaviour or make it /etc/resolv.conf configurabl=
e.
FYI, /etc/resolv.conf already includes an option which can be enabled to
encourage IPv6 DNS lookups ("options inet6" which turns on RES_USE_INET6)
Also, if !defined(INET6) then it should _NEVER_ "prefer" IPv6 lookups.
Half the rest of getaddrinfo.c respects INET6, so I don't know why it
didn't go all the way.
I think this change fixes the second complaint:
Index: getaddrinfo.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvs/master/m-NetBSD/main/src/lib/libc/net/getaddrinfo.c,v
retrieving revision 1.87.2.1
diff -u -u -r1.87.2.1 getaddrinfo.c
--- getaddrinfo.c 31 Jan 2009 21:43:33 -0000 1.87.2.1
+++ getaddrinfo.c 4 Dec 2009 21:43:11 -0000
@@ -1293,6 +1293,7 @@
=20
switch (pai->ai_family) {
case AF_UNSPEC:
+#ifdef INET6
/* prefer IPv6 */
q.name =3D name;
q.qclass =3D C_IN;
@@ -1306,6 +1307,9 @@
q2.answer =3D buf2->buf;
q2.anslen =3D sizeof(buf2->buf);
break;
+#else
+ /* FALLTHROUGH */
+#endif
case AF_INET:
q.name =3D name;
q.qclass =3D C_IN;
@@ -1346,6 +1350,7 @@
cur =3D cur->ai_next;
}
if (q.next) {
+ /* xxx this looks bogus -- it could/should de-reference q.next
to find q=
2! */
ai =3D getanswer(buf2, q2.n, q2.name, q2.qtype, pai);
if (ai)
cur->ai_next =3D ai;
--=20
Greg A. Woods
Planix, Inc.
<woods%planix.com@localhost> +1 416 218 0099
http://www.planix.com/
--pgp-sign-Multipart_Fri_Dec__4_16:47:39_2009-1
Content-Type: application/pgp-signature
Content-Transfer-Encoding: 7bit
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (NetBSD)
iD8DBQBLGYN7Zn1xt3i/9H8RAr+/AJ0TQagqkRU4pk8ZQf6tSI1irR2UIQCgtCMy
u9sOToJysQBmA4Zb+NFaYpw=
=zpit
-----END PGP SIGNATURE-----
--pgp-sign-Multipart_Fri_Dec__4_16:47:39_2009-1--
Home |
Main Index |
Thread Index |
Old Index