Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Sun, 26 Jan 2014 20:05:29 -0500
From: Rich Felker <>
Subject: Re: domain name resolution issues

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 ( eventhough /etc/hosts says
>  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.


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.