On Wed, 03.06.15 16:31, Daurnimator (q...@daurnimator.com) wrote: > On 3 June 2015 at 16:01, Lennart Poettering <lenn...@poettering.net> wrote: > > On Wed, 03.06.15 15:40, Daurnimator (q...@daurnimator.com) wrote: > > > >> I was playing around with nss, and found that my loopback interface ip > >> doesn't appear from nss-myhostname. > >> Rather, my other ones do. > >> Furthermore, unless I request IPv4, link-local IPv6 addresses are > >> returned. Is this expected? > > > > We order the returned addresses by scope. Global addresses are > > placed first, local ones last. > > Then why are link local IPv6 addresses returned first? > > If this was the case, I would expect to see: > > 192.168.2.229 > 192.168.2.21 > fe80::aed1:b8ff:fec0:d113 > fe80::9eeb:e8ff:fe1b:f42d > 127.0.0.1 > ::1
Currently the first ordering key is the address family (ipv4 before ipv6), the second ordering key is the scope (global before link-local). Are you suggesting we should turn this around, and sort by scope first, and by address family then? I might be open to such a change. > > We return addresses on the loopback device only when there's no other > > address known. > > What's the rationale for this? (i.e. why not always just include > 127.0.0.1 and ::1 last?) Because they are an implementation detail I think. If something wants to know the local IP address, then returning that information is really useless... 127.0.0.x is really an address we should never present to the user ever, unless there#s no better way... I mean, I am pretty sure I could explain a non-technical person off the streat what an IP address is, but I am pretty sure I'd had quite some trouble explaining what the purpose of 127.0.0.1 is on top of that... Lennart -- Lennart Poettering, Red Hat _______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel