[systemd-devel] nss-myhostname: why don't loopback interfaces appear?

Lennart Poettering lennart at poettering.net
Wed Jun 10 16:38:10 PDT 2015


On Wed, 10.06.15 11:17, Simon McVittie (simon.mcvittie at collabora.co.uk) wrote:

> On 10/06/15 03:18, Daurnimator wrote:
> > example use case, I'm testing a client/server protocol:
> >   - the server is running locally; and because it shouldn't be exposed
> > to the internet, it is bound to localhost.
> >   - I start the client and tell it to connect to $HOSTNAME
> 
> Why wouldn't you tell the client to connect to localhost instead?
> 
> (Relatedly, on my development laptop I have dnsmasq set up to resolve
> [anything].localhost to 127.0.0.1, which means I can even use name-based
> virtual hosting in local testing - maybe it would be worthwhile for
> systemd-resolved and/or nss-myhostname to behave similarly?)

This is actually already what happens.

Here's the call that checks whether a hostname should be considered
equivalent to "localhost":

https://github.com/systemd/systemd/blob/master/src/shared/hostname-util.c#L129

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list