On Mon, Oct 24, 2016 at 02:06:43PM +0000, Florian Obser wrote:
> Note that we can remove all the checks since in6_pcbaddrisavail() does
> all of this for us.

I support using in6_pcbaddrisavail() for raw sockets.  Code reuse
is good.

> -             if (ifa && ifatoia6(ifa)->ia6_flags &
> -                 (IN6_IFF_ANYCAST|IN6_IFF_TENTATIVE|IN6_IFF_DUPLICATED|
> -                  IN6_IFF_DETACHED|IN6_IFF_DEPRECATED)) {
> -                     error = EADDRNOTAVAIL;

The IN6_IFF_DEPRECATED is missing in in6_pcbaddrisavail().  There
is a long comment why binding to a deprecated address is necessary.
I think the change in behavior is ok, raw bind and udp/tcp bind
become compatible.

> +             if ((error = in6_pcbaddrisavail(in6p, addr, 0, p)))
>                       break;

You should set addr->sin6_port to 0 before calling in6_pcbaddrisavail().
The user might run into the in_pcblookup_local() lookup which makes
no sense for raw ip.

Otherwise OK bluhm@

Reply via email to