From patchwork Tue Oct 27 21:50:57 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David J Wilder X-Patchwork-Id: 56189 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n9RLpEFR027949 for ; Tue, 27 Oct 2009 21:51:14 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755835AbZJ0VvI (ORCPT ); Tue, 27 Oct 2009 17:51:08 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756726AbZJ0VvI (ORCPT ); Tue, 27 Oct 2009 17:51:08 -0400 Received: from e39.co.us.ibm.com ([32.97.110.160]:60551 "EHLO e39.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755835AbZJ0VvG (ORCPT ); Tue, 27 Oct 2009 17:51:06 -0400 Received: from d03relay03.boulder.ibm.com (d03relay03.boulder.ibm.com [9.17.195.228]) by e39.co.us.ibm.com (8.14.3/8.13.1) with ESMTP id n9RLjBIv004336 for ; Tue, 27 Oct 2009 15:45:11 -0600 Received: from d03av02.boulder.ibm.com (d03av02.boulder.ibm.com [9.17.195.168]) by d03relay03.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id n9RLoxlT167100 for ; Tue, 27 Oct 2009 15:51:04 -0600 Received: from d03av02.boulder.ibm.com (loopback [127.0.0.1]) by d03av02.boulder.ibm.com (8.14.3/8.13.1/NCO v10.0 AVout) with ESMTP id n9RLnX84023465 for ; Tue, 27 Oct 2009 15:49:34 -0600 Received: from [9.65.50.222] (sig-9-65-50-222.mts.ibm.com [9.65.50.222]) by d03av02.boulder.ibm.com (8.14.3/8.13.1/NCO v10.0 AVin) with ESMTP id n9RLnW7Z023454; Tue, 27 Oct 2009 15:49:32 -0600 Subject: re: [PATCH] librdmacm/cmatose: add support for ipv6 From: "David J. Wilder" To: Sean Hefty Cc: Jason Gunthorpe , rdreier@cisco.com, linux-rdma , pradeep@us.ibm.com, ewg@lists.openfabrics.org In-Reply-To: References: <1255992430.12075.7.camel@wilder.ibm.com> <20091019234329.GC9643@obsidianresearch.com> <676AB781CD644CC28E1AD4951EA4EEF8@amr.corp.intel.com> <20091020003344.GA14520@obsidianresearch.com> <1256164230.12075.31.camel@wilder.ibm.com> <20091021230845.GR14520@obsidianresearch.com> <1256245942.12075.46.camel@wilder.ibm.com> <660D538F30E647F3AE1E5E6C1ACBE882@amr.corp.intel.com> <1256667738.16192.1.camel@wilder.ibm.com> Date: Tue, 27 Oct 2009 14:50:57 -0700 Message-Id: <1256680257.12957.14.camel@wilder.ibm.com> Mime-Version: 1.0 X-Mailer: Evolution 2.12.3 (2.12.3-8.el5_2.2) Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c index bd07803..3442256 100644 --- a/drivers/infiniband/core/addr.c +++ b/drivers/infiniband/core/addr.c @@ -278,6 +278,21 @@ static int addr6_resolve_remote(struct sockaddr_in6 *src_in, fl.nl_u.ip6_u.daddr = dst_in->sin6_addr; fl.nl_u.ip6_u.saddr = src_in->sin6_addr; + if (ipv6_addr_type(&src_in->sin6_addr) & IPV6_ADDR_LINKLOCAL) { + if (!src_in->sin6_scope_id) + return -EINVAL; + fl.oif = src_in->sin6_scope_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; + } + dst = ip6_route_output(&init_net, NULL, &fl); if (!dst) return ret; @@ -390,14 +405,16 @@ static int addr_resolve_local(struct sockaddr *src_in, case AF_INET6: { struct in6_addr *a; + int found = 0; for_each_netdev(&init_net, dev) if (ipv6_chk_addr(&init_net, &((struct sockaddr_in6 *) dst_in)->sin6_addr, - dev, 1)) + dev, 1)) { + found = 1; break; - - if (!dev) + } + if (!found) return -EADDRNOTAVAIL; a = &((struct sockaddr_in6 *) src_in)->sin6_addr; @@ -406,6 +423,8 @@ static int addr_resolve_local(struct sockaddr *src_in, src_in->sa_family = dst_in->sa_family; ((struct sockaddr_in6 *) src_in)->sin6_addr = ((struct sockaddr_in6 *) dst_in)->sin6_addr; + ((struct sockaddr_in6 *) src_in)->sin6_scope_id = + ((struct sockaddr_in6 *) dst_in)->sin6_scope_id; ret = rdma_copy_addr(addr, dev, dev->dev_addr); } else if (ipv6_addr_loopback(a)) { ret = rdma_translate_ip(dst_in, addr);