Re: [PATCH] link-local address fix for rdma_resolve_addr

David J. Wilder
2009-10-14T17:30:05Z

On Wed, 2009-10-14 at 11:01 -0600, Jason Gunthorpe wrote:
> On Wed, Oct 14, 2009 at 09:23:57AM -0700, David J. Wilder wrote:
>
> > This new patch should closely emulate tcp_ipv6.c. when both source and
> > destination scope_ids are given with link-local address.
>
> Maybe like this:
>
> fl.oif = 0;
>
> if (ipv6_addr_type(&src_in->sin6_addr) & IPV6_ADDR_LINKLOCAL) {
> if (!src_in->sin6_scope_id)
> return -EINVAL;
> fl.oif = src_in->sin6scope_id;
> }
> if (ipv6_addr_type(&dst_in->sin6_addr) & IPV6_ADDR_LINKLOCAL){
> if (dst_in.sin6_scope_id) {
> if (fl.oif && fl.oif != dst_in.sin6_scope_id)
> return -EINVAL;
> fl.oif = dst_in.sin6_scope_id;
> }
> if (!fl.oif)
> return -EINVAL;
> }
>
>
> src and dest have to be tested seperately, the TCPv6 versions don't
> require them to be both link local.
>
> Don't forget to run checkpatch ;)

This looks good. Once concern, it may be obtuse, but if both the src and
dst are link-local addresses should only one need to be scoped? This
patch will required the src to always be scoped when using link local.

Dave...