[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#435646: AI_ADDRCONFIG



This is an informational mail that I hope helps some people since
this problem had been bothering me for a long time and I just
solved it for myself.  Bug#435646 shows up high (#1) in certain
Google search results and I believe the submitter of merged
Bug#470289 had the same issue as me.

Since glibc v2.3.3, getaddrinfo() has included a feature to
disable AAAA requests if there are no interfaces with IPv6
addresses; the feature is turned on by a flag called
AI_ADDRCONFIG.

The patch in Bug#435646 that was installed and then reverted was
about changing the behavior of AI_ADDRCONFIG so that it only
includes *globally-scoped* addresses in this check.  (Some people
do talk to localhost via IPv6 so this patch doesn't work.)

When IPv6 is disabled in the kernel via "alias net-pf-10 off",
there are no IPv6 addresses *period*, so the original unpatched
getaddrinfo() should already work.

Having not fully understood the issue before, I lamented the
rejection of the patch, thinking this was about disabling AAAA
even if there are no IPv6 addresses period --- because various
apps *do* make AAAA requests with IPv6 completely disabled in the
kernel!  But as it turns out, the regular feature has already
existed since glibc 2.3.3.

Here's the answer: users of getaddrinfo() aren't using the
feature!  It's only enabled by default if hints=NULL, otherwise
you have to enable it explicitly with hints->flags =
AI_ADDRCONFIG.  Each application that uses getaddrinfo() needs to
pass in the AI_ADDRCONFIG flag, and programmers may not know about
it.

I think getaddrinfo() should read from gai.conf to allow this to
enabled system-wide.  Until then, I've written a kludge that can
be installed in LD_PRELOAD or /etc/ld.so.preload to force on this
flag (and an alternate kludge to just always turn off AAAA
queries).

http://git.cubewano.org/git/gai-no6




Reply to: