On Sat, 27.04.13 09:39, Petter Reinholdtsen (p...@hungry.com) wrote:

> [Joachim Breitner]
> > it was reported that libnss-myhostname may report an IPv6 address
> > for the local hostname that is not pingable, as it is a link scoped
> > address, and it was suggested that it not do that. Do you agree and
> > can you fix it?
> 
> Here is a simple patch to make sure link local addresses are no longer
> returned by libnss-myhostname.

We currently filter addresses of HOST and NOWHERE scope, but local
addresses should generally be fine.

> The alternative would be to return addresses with %interface appended,
> but I did not investigate how to do that.

This is done by filling in the scopeid field, which we do.

See

http://cgit.freedesktop.org/systemd/systemd/tree/src/nss-myhostname/nss-myhostname.c#n180

> +bool is_ipv6_link_local(unsigned short family, void *address) {
> +        char str_buffer[INET6_ADDRSTRLEN];
> +        if (AF_INET6 != family)
> +                return false;

Yoda style comparisons are not acceptable in systemd's sources. 

> +
> +        if (NULL == inet_ntop(AF_INET6, address, str_buffer, 
> INET6_ADDRSTRLEN))
> +                return false;
> +
> +        if (0 == strncmp("fe", str_buffer, 2)) {
> +                char c = str_buffer[2];
> +                if (c == '8' || c == '9' || c == 'a' || c == 'b')
> +                        return true;
> +                }
> +        return false;

If you want to filtzer local scoped addresses, then use the scope field
supplied by the kernel, nothing else. You shouldn't duplicate the scope
logic of the kernel by looking at the addersses themsleves...

But anyway, AFAICS we already do the right thing here anyway, and local
addresses should be unproblematic.

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


-- 
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