[PATCH] make getaddrinfo hint AI_ADDRCONFIG work

Carmelo AMOROSO carmelo.amoroso at st.com
Thu Feb 21 16:23:50 UTC 2008

Ricard Wanderlof wrote:
> On Thu, 21 Feb 2008, sjhill at real.realitydiluted.com wrote:
>>> The problem turned out to be in getaddrinfo(). When hints.ai_flags has
>>> the AI_ADDRCONFIG bit set in a call to getaddrinfo, IPv4 and IPv6
>>> addresses should only be returned if the system as at least one address
>>> of the appropriate type configured. However, this turned out not to be
>>> the case, and both types of addresses were returned in any case, causing
>>> IPv6 DNS traffic even if no interface had an IPv6 address configured.
>>> The following patch fixes the problem, while still touching the existing
>>> code as little as possible. It has been tested and works and I would like
>>> to commit it, but comments would be valued.
>> How does glibc handle this?
> The latest (2.7) glibc (which is much newer than what uClibc is based on) 
> has a similar way of introducing additional checks in various parts of the 
> code. However, it relies on getifaddrs() to determine the existance of an 
> interface instead of checking the /proc filesystem.
> Which as you are implying might be a better way to do it.
> /Ricard
Hi All,
please note that we cannot takes code from glibc 2.7 due to licensing 
glibc 2.7 moved to GPL v3 !!! be careful.

> --
> Ricard Wolf Wanderlöf                           ricardw(at)axis.com
> Axis Communications AB, Lund, Sweden            www.axis.com
> Phone +46 46 272 2016                           Fax +46 46 13 61 30
> _______________________________________________
> uClibc mailing list
> uClibc at uclibc.org
> http://busybox.net/cgi-bin/mailman/listinfo/uclibc

More information about the uClibc mailing list