From patchwork Wed Oct 14 16:23: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: 53745 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 n9EGaSen012620 for ; Wed, 14 Oct 2009 16:36:28 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933402AbZJNQYr (ORCPT ); Wed, 14 Oct 2009 12:24:47 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S934872AbZJNQYr (ORCPT ); Wed, 14 Oct 2009 12:24:47 -0400 Received: from e3.ny.us.ibm.com ([32.97.182.143]:51791 "EHLO e3.ny.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933402AbZJNQYp (ORCPT ); Wed, 14 Oct 2009 12:24:45 -0400 Received: from d01relay04.pok.ibm.com (d01relay04.pok.ibm.com [9.56.227.236]) by e3.ny.us.ibm.com (8.14.3/8.13.1) with ESMTP id n9EGGL1h008278 for ; Wed, 14 Oct 2009 12:16:21 -0400 Received: from d01av04.pok.ibm.com (d01av04.pok.ibm.com [9.56.224.64]) by d01relay04.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id n9EGO9Jm257162 for ; Wed, 14 Oct 2009 12:24:09 -0400 Received: from d01av04.pok.ibm.com (loopback [127.0.0.1]) by d01av04.pok.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id n9EGO0BY010991 for ; Wed, 14 Oct 2009 12:24:09 -0400 Received: from [9.76.198.161] (sig-9-76-198-161.mts.ibm.com [9.76.198.161]) by d01av04.pok.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id n9EGNw1l010770; Wed, 14 Oct 2009 12:23:58 -0400 Subject: Re: [PATCH] link-local address fix for rdma_resolve_addr From: "David J. Wilder" To: sean.hefty@intel.com, jgunthorpe@obsidianresearch.com Cc: ewg@lists.openfabrics.org, linux-rdma , pradeep@us.ibm.com, wilder@us.ibm.com In-Reply-To: <20091013231234.GK5191@obsidianresearch.com> References: <1255471781.14513.7.camel@wilder.ibm.com> <20091013231234.GK5191@obsidianresearch.com> Date: Wed, 14 Oct 2009 09:23:57 -0700 Message-Id: <1255537437.14513.28.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 --- drivers/infiniband/core/addr.c.1759 2009-10-13 15:57:48.000000000 -0500 +++ drivers/infiniband/core/addr.c 2009-10-14 10:47:56.000000000 -0500 @@ -278,6 +278,21 @@ static int addr6_resolve_remote(struct s fl.nl_u.ip6_u.daddr = dst_in->sin6_addr; fl.nl_u.ip6_u.saddr = src_in->sin6_addr; + if (ipv6_addr_type(&dst_in->sin6_addr) & IPV6_ADDR_LINKLOCAL){ + // Link-local address require an interface to be specified. + if (!(dst_in->sin6_scope_id||src_in->sin6_scope_id)) + return -EINVAL; + + // If src and dst interfaces are supplied they must match. + if ( (dst_in->sin6_scope_id && src_in->sin6_scope_id) && + (src_in->sin6_scope_id != dst_in->sin6_scope_id) ) + return -EINVAL; + if ( dst_in->sin6_scope_id ) + fl.oif = dst_in->sin6_scope_id; + else + fl.oif = src_in->sin6_scope_id; + } + dst = ip6_route_output(&init_net, NULL, &fl); if (!dst) return ret;