From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/4518 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: domain name resolution issues Date: Sun, 26 Jan 2014 20:05:29 -0500 Message-ID: <20140127010529.GK24286@brightrain.aerifal.cx> References: <20140123165356.GN1685@port70.net> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1390784736 20025 80.91.229.3 (27 Jan 2014 01:05:36 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 27 Jan 2014 01:05:36 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-4522-gllmg-musl=m.gmane.org@lists.openwall.com Mon Jan 27 02:05:44 2014 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1W7ae0-0003qk-80 for gllmg-musl@plane.gmane.org; Mon, 27 Jan 2014 02:05:44 +0100 Original-Received: (qmail 24262 invoked by uid 550); 27 Jan 2014 01:05:42 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 24254 invoked from network); 27 Jan 2014 01:05:42 -0000 Content-Disposition: inline In-Reply-To: <20140123165356.GN1685@port70.net> User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:4518 Archived-At: 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