Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20160603160840.GO10893@brightrain.aerifal.cx>
Date: Fri, 3 Jun 2016 12:08:41 -0400
From: Rich Felker <dalias@...c.org>
To: musl@...ts.openwall.com
Subject: Re: getaddrinfo, ip address sort order?

On Fri, Jun 03, 2016 at 11:21:42AM -0400, John Mudd wrote:
> I read that getaddrinfo() returns addresses sorted based on RFC 3484. I'm
> using the attached program to test it and I'm not sure if they are sorted.
> 
> I looked at the musl getaddrinfo.c here:
> https://github.com/idunham/musl/blob/master/src/network/getaddrinfo.c
> 
> I don't see an obvious sort in the code. Is it there?

The relevant code is in src/network/lookup_name.c. The reason it's
there is so that it also applies to the legacy host lookup functions.

It does not cover 100% of RFC 3484 but should do everything that
actually matters/makes sense. Let us know if you run into problems.
One known semi-bug is that it uses v4-mapped addresses with AF_INET6
to do the reachability probes for v4 addresses, which may fail on
systems with IPv6 completely removed, in which case the code will fail
to distinguish that v4 addresses are routable but v6 ones aren't (both
may appear non-routable). I plan to go back and fix the code to use
AF_INET sockets for probing v4 reachability.

Rich

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.