On 2014/04/23 08:09, Simon Perreault wrote:
> +                             else if (ifa->ifa_addr->sa_family == PF_INET6 &&

so... family is ipv6

> +                                 !IN6_IS_ADDR_LOOPBACK(
> +                                 &((struct sockaddr_in6 *)ifa->ifa_addr)
> +                                 ->sin6_addr) &&

AND it's not a loopback address

> +                                 !((ifa->ifa_flags & IFF_LOOPBACK) &&
> +                                 IN6_IS_ADDR_LINKLOCAL(
> +                                 &((struct sockaddr_in6 *)ifa->ifa_addr)
> +                                 ->sin6_addr)))

AND NOT (loopback interface AND link-local address)

But the intention seems to be "if you have a usable v6 address
that stands a chance of being routable" - so shouldn't this last bit
be "AND NOT loopback interface AND NOT link-local address"?

!(ifa->ifa_flags & IFF_LOOPBACK) && !(IN6_IS_ADDR_LINKLOCAL(
    &((struct sockaddr_in6 *)ifa->ifa_addr)))

Otherwise AI_ADDRCONFIG will still allow v6 addresses if you have a
default OpenBSD configuration i.e. the automatically configured
link-local address on an ethernet interface even if you've done nothing
to try and make them work.

I suspect it may not be quite RFC compliant, but I think actual usability
trumps RFC compliance here.

Reply via email to