On Sun, May 05, 2013 at 07:59:02PM +0200, Petter Reinholdtsen wrote:
> 
> [Joachim Breitner]
> > But it seems that the scope id is not really passed all the way down to
> > the user. Using the attached test code, I get:
> > $ ./test kirk
> > Scope id returned for ./test: 0
> > 
> > So is this a bug in the libc?
> 
> Could be.  What do you believe 'getent hosts $(hostname)' should print
> if glibc did the right thing?  Should the following work on a machine
> with link local IPv6 addresses?
> 
>   ping6 $(getent hosts $(hostname)|awk '{print $1}')
> 
> This fail when libnss-myhostname is enabled.  It work without
> libnss-myhostname enabled, because getent return ::1.

This doesn't sound like a bug in libc or in ping6. getaddrinfo() will
return a scope ID if you've explicitly provided one in the hints you've
provided. For example, notice the different behavior when running
Joachim's test.c program with a scoped address as opposed to a
non-scoped address (e.g. fe80::21f:3bff:fe26:abcd%eth0 vs
fe80::21f:3bff:fe26:abcd). getaddrinfo() has no way of knowing that the
input address is related in any way to a particular interface, so it
isn't going to assume that it's a link-local scope (or any other scope)
of address, and is going to leave sin6_scope_id undefined. If you
specify a link ID, then it knows to treat the address as link-local.

libnss-myhostname is, IMO, doing the wrong thing by returning link-local
addresses. All the other addresses that it returns, including the
fallback ::1 or 127.0.1.1, are routable from localhost. Link-local
addresses by themselves are not, and more closely resemble MAC addresses
than any sort of address you'll run a server on.

Or, to put this another way (referring to the original use case that
lead to this ticket), if you want to use a nagios check to see if your
server is reachable, the link-local address is not what you want. Your
server will not be listening on link-local addresses, your clients won't
use their link-local addresses when communicating with the server, and
even if they they wanted to, they would then have to start worrying
about interface IDs and address scopes themselves.

The fact that "ping6 $(getent hosts $(hostname)|awk '{print $1}')"
breaks when libnss-myhostname is installed further suggests that it's
doign something wrong.

libnss-myhostname should either filter link-local address itself, or
provide a mechanism for clients to do so.

noah


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to