mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@aerifal.cx>
To: musl@lists.openwall.com
Subject: Re: domain name resolution issues
Date: Sun, 26 Jan 2014 20:05:29 -0500	[thread overview]
Message-ID: <20140127010529.GK24286@brightrain.aerifal.cx> (raw)
In-Reply-To: <20140123165356.GN1685@port70.net>

On Thu, Jan 23, 2014 at 05:53:56PM +0100, Szabolcs Nagy wrote:
> getaddrinfo fails to parse /etc/hosts entries if they are
> whitespace prefixed (not sure if that's legit, but glibc
> can parse it)
> 
> and only the first match is returned, eg.
> 
> 	getaddrinfo("localhost", 0, 0, &ai);
> 
> only gives one result (127.0.0.1) eventhough /etc/hosts says
> 
> 	127.0.0.1  localhost
> 	::1        localhost ip6-localhost ip6-loopback

Are you sure that this isn't just it short-circuiting out after
finding the first result?

> then if i do a name lookup on the returned address with
> 
> 	getnameinfo(ai->ai_addr, ai->ai_addrlen, host, sizeof host, serv, sizeof serv, 0);
> 
> it seems to do a complete dns query to the nameserver,
> i wonder if it might worth to do a local /etc/hosts
> search first

It doesn't even do the /etc/hosts search at all for reverse lookups,
as far as I remember.

> (i see now that the test system should run in a sandboxed
> environment otherwise such interfaces are not possible to
> test)

Yes, this is part of why I'd like a way to override resolv.conf and
hosts on a per-user basis...

Anyway, all of these are semi-known issues I want to address in the
resolver overhaul after 1.0. Perhaps we should put the resolver
overhaul at high priority and do it in the 1.0.x series, before
starting 1.1.x, rather than in the 1.1.x series. Or, we could do it
early in 1.1.x with the intent of backporting it to 1.0.x.

Rich


      reply	other threads:[~2014-01-27  1:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-23 16:53 Szabolcs Nagy
2014-01-27  1:05 ` 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=20140127010529.GK24286@brightrain.aerifal.cx \
    --to=dalias@aerifal.cx \
    --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).