all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: Mark H Weaver <mhw@netris.org>
Cc: guix-devel@gnu.org
Subject: Re: Neon and reverse address lookup
Date: Sun, 19 Jan 2014 16:40:43 +0100	[thread overview]
Message-ID: <87iotgkmis.fsf@gnu.org> (raw)
In-Reply-To: <87ob39osyh.fsf@netris.org> (Mark H. Weaver's message of "Sat, 18 Jan 2014 16:55:50 -0500")

Mark H Weaver <mhw@netris.org> skribis:

> ludo@gnu.org (Ludovic Courtès) writes:
>
>> So /etc/hosts is not enough for reverse lookups to work.
>>
>> With nscd turned off, I tried this:
>>
>>   guile -c '(pk (gethostbyaddr (inet-pton AF_INET "127.0.0.1")))'
>>
>> If nsswitch.conf is removed, then that resolves to “localhost” (instead
>> of the actual host name.)
>
> As John said, it should resolve to "localhost".  It certainly should
> _not_ resolve to the actual host name.

Right, but my /etc/hosts has “localhost” plus another name for 127.0.0.1.

>> If, in addition, resolv.conf is removed, then that fails as seen above.
>>
>> With nsswitch.conf alone, it resolves correctly (Mark was right.)
>> And this works with only “hosts: files” in nsswitch.conf.
>
> When you say "it resolves correctly", which name does it resolve to?

Whatever /etc/hosts suggests.

>> It’s surprising that there’s this discrepancy between how NSS works for
>> getaddrinfo and for gethostbyaddr.  At any rate, we may be able to solve
>> this at the libc level.
>
> Solve what?  What are you thinking of changing in libc?

The issue is that the default config for the ‘hosts’ database when
resolv.conf is missing is (see nss/hosts-lookup.c):

  dns [!UNAVAIL=return] files

When doing a host name lookup, ‘dns’ is unavailable, so we go on with
‘files’ and /etc/hosts is honored as expected.

However, when doing a reverse lookup, the DNS resolver
(__libc_res_nquery) returns ‘notfound’, and so ‘gethostbyaddr’ returns
immediately.

Changing the ‘hosts’ config to “dns files” solves this particular.

I’ll ask for advice on libc-help.

Thanks,
Ludo’.

  reply	other threads:[~2014-01-19 15:45 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-18 12:48 Neon and reverse address lookup Andreas Enge
2014-01-18 14:17 ` John Darrington
2014-01-18 14:43   ` Mark H Weaver
2014-01-18 14:41 ` Mark H Weaver
2014-01-18 16:45   ` Andreas Enge
2014-01-18 16:48     ` John Darrington
2014-01-18 20:59       ` Ludovic Courtès
2014-01-18 20:09   ` Ludovic Courtès
2014-01-18 21:32 ` Ludovic Courtès
2014-01-18 21:49   ` John Darrington
2014-01-18 21:55   ` Mark H Weaver
2014-01-19 15:40     ` Ludovic Courtès [this message]
2014-02-05 17:30       ` Andreas Enge
2014-02-05 20:07         ` Ludovic Courtès

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=87iotgkmis.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=guix-devel@gnu.org \
    --cc=mhw@netris.org \
    /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 external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.