mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@libc.org>
To: musl@lists.openwall.com
Subject: Re: getaddrinfo, ip address sort order?
Date: Fri, 3 Jun 2016 12:08:41 -0400	[thread overview]
Message-ID: <20160603160840.GO10893@brightrain.aerifal.cx> (raw)
In-Reply-To: <CAGDMk9Ht0Jb4UkpxzKrvo5cNMJViY_4a20+G3oEXD9im03PH7w@mail.gmail.com>

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


      parent reply	other threads:[~2016-06-03 16:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-03 15:21 John Mudd
2016-06-03 15:25 ` John Mudd
2016-06-03 16:08 ` Rich Felker [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160603160840.GO10893@brightrain.aerifal.cx \
    --to=dalias@libc.org \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).