Daven

David Stevens wrote:
> Brian,
> 
> OK, I see what you're trying to fix now.
> 
> I think the scope_id checks are not quite right-- they
> should be something like this:
> 
> if (addr_type&IPV6_ADDR_LINKLOCAL) {
>         if (addr_len >= sizeof(struct sockaddr_in6)) {
>                 if (sk->sk_bound_dev_if && usin->sin6_scope_id &&
>                     sk->sk_bound_dev_if != usin->sin6_scope_id) {
>                         err = -EINVAL;
>                         goto out;
>                 }
>                 if (usin->sin6_scope_id)
>                         sk->sk_bound_dev_if = usin->sin6_scope_id;
>                 if (!sk->sk_bound_dev_if &&
>                      (addr_type & IPV6_ADDR_MULTICAST))
>                         fl.oif = np->mcast_oif;
>         }
> 
>         /* connect to the link-local addres requires an interface */
>         if (!sk->sk_bound_dev_if) {
>                 err = -EINVAL;
>                 goto out;
>         }
> }

But this still requires either a SO_BINDTODEVICE or sin6_scope_id.  This
means the an application can call BINDTODEVICE(eth0), MULTICAST_IF(eth1)
issue a connect on a UDP socket an succeed?  Seems wrong to me.

Can you check section 6.7 of RFC 3542.

Thanks
-vlad

> 
>         That is (in English):
> 
>         If I did an SO_BINDTODEVICE and specified sin6_scope_id,
> then they better agree.
>         If I specified sin6_scope_id without SO_BINDTODEVICE, set
> the device to that.
>         If I get this far without a device and it's multicast, use 
> mcast_oif
>         If I get all through that and don't have a device, EINVAL.
> 
>         Does that work for you?
> 
>                                         +-DLS
> 
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to [EMAIL PROTECTED]
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to