On Tue, May 07, 2013 at 04:25:40PM +0200, Petter Reinholdtsen wrote:
> I do not know IPv6 addressing or the glibc internals well enough to
> form an opinion on this, but I do not understand your argument.  ping6
> and libc can know from the values in the IPv6 address if it is a
> link-local address or not, and if it is a link-local address, it need
> the scope.  Why isn't that enough to implement handling of this issue
> in ping6 and libc?

Because unless you explicitly specify a scope ID, the kernel and libc
cannot infer them. This is why you need to specify the scope ID when
pinging a link-local address.

> Using that information, ping6 can know that fe80::21f:3bff:fe26:abcd
> is not going to work, while fe80::21f:3bff:fe26:abcd%eth0 have a fair
> chance of working.  Why can't getaddrinfo()?

What should getaddrinfo know? The scope ID is the interface identifier.
getaddrinfo() can't infer what interface you want the address scoped to.
You may not be asking about a local interface, or you may have the same
link-local address on multiple interfaces.

> > The fact that "ping6 $(getent hosts $(hostname)|awk '{print $1}')"
> > breaks when libnss-myhostname is installed further suggests that
> > it's doign something wrong.
> 
> Or perhaps libc is doing something wrong.  I noticed on FreeBSD,
> ifconfig returned addresses with the %if ending for link local
> addresses, while on linux ifconfig do not.  This seem like a bug or
> misfeature on Linux to me, that the addresses shown by ifconfig can
> not be pinged.  Perhaps it is caused by some underlying problem in
> libc, also affecting ping6?

No. ifconfig on freebsd is being helpful by appending the scope ID to
the link-local address when it presents it to you, but that doesn't in
any way imply that the Linux ifconfig is buggy for not doing this. The
scope-ID is returned to you in the Linux ifconfig output: It is the
interface name.

Keep in mind, though, that the scope ID is only meaningful on the local
host, because that's the only place where that interface configuration
is present. E.g. I've got a host here that has link-local address
fe80::224:8cff:fe66:7a3. If I want to ping that link-local address from
my laptop, via the laptop's wifi interface, I need to specify the
address and scope ID as fe80::224:8cff:fe66:7a3%wlan0. However, on the
host with that address, the scoped address would be
fe80::224:8cff:fe66:7a3%eth0. If I log in to my router and want to ping
that address, I need to scope it with fe80::224:8cff:fe66:7a3%br-lan.
Scope ID is purely a local thing, and is not going to be meaningful
anywhere else on the network, except coincidentally.

noah

Attachment: signature.asc
Description: Digital signature

Reply via email to