Re: apt: always does AAAA queries first
On Sat, Nov 08, 2008 at 06:01:25PM +0100, Bernhard R. Link wrote:
> package: apt
> version: 0.7.16
> tags: patch
> severity: important
>
> When using a nameserver from some standard German t-online DSL-router
> (so I guess it might effect a larger number of people) the missing
> capabilities of that thing (it does not answer to AAAA queries at all),
> unveil a bug in apt's methods:
>
> Name resolving always sends out AAAA queries first and only after
> timeout sends A queries, even if no ipv6 is available at all.
>
> The attached patch makes it use the default flags as described in
> RFC 2553.
>
AI_DEFAULT is not needed when AI_NUMERICHOST or AI_PASSIVE is used as
no name resolving is done. Also AI_DEFAULT corresponds to (AI_V4MAPPED
| AI_ADDRCONFIG), while we probably only want AI_ADDRCONFIG here.
Please find an updated patch below.
--- a/methods/connect.cc
+++ b/methods/connect.cc
@@ -158,6 +158,7 @@
struct addrinfo Hints;
memset(&Hints,0,sizeof(Hints));
Hints.ai_socktype = SOCK_STREAM;
+ Hints.ai_flags = AI_ADDRCONFIG;
Hints.ai_protocol = 0;
// if we couldn't resolve the host before, we don't try now
--
Aurelien Jarno GPG: 1024D/F1BCDB73
aurelien@aurel32.net http://www.aurel32.net
Reply to: