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

Jason Gunthorpe jgunthorpe at obsidianresearch.com
Mon Oct 19 17:33:44 PDT 2009


On Mon, Oct 19, 2009 at 04:47:59PM -0700, Sean Hefty wrote:
> >@@ -393,7 +393,7 @@ static int addr_resolve_local(struct sockaddr *src_in,
> >
> >                for_each_netdev(&init_net, dev)
> >                        if (ipv6_chk_addr(&init_net,
> >-                                         &((struct sockaddr_in6 *) addr)-
> >>sin6_addr,
> >+                                         &((struct sockaddr_in6 *) dst_in)-
> >>sin6_addr,
> >                                          dev, 1))
> >                                break;
> >
> >I can believe it fixes the case you describe (ie loopback) but
> >matching the *dest* IP against the local interface's IP list cannot
> >possibly be right.
> 
> The intent is to see if the destination address is local.  A source
> address may not be given.

Well, that makes more sense, but it still pretty strange to match the
IP list like that, the proper thing is to query RT6_TABLE_LOCAL, like
the IPv4 case does.

Anyhow, couldn't the whole addr_resolve_local routine be replaced with
something like this in addr_resolve_remote:
 if (rt->idev == init_net->loopback_dev)
    rdma_translate_ip(rt->rt_src, dev_addr, NULL);

for IPv4 and similar for IPv6?

That does query the proper RT_TABLEs to determine if the IP is local
and then we get the searching and ip_dev_find only for the case where
the address is definitely looped back. Much closer to how the IP stack
works normally.

Jason



More information about the ewg mailing list