From owner-svn-src-stable@freebsd.org Fri Mar 30 18:38:44 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3A4D5F55809; Fri, 30 Mar 2018 18:38:44 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DFF3C761A6; Fri, 30 Mar 2018 18:38:43 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DADE64B2C; Fri, 30 Mar 2018 18:38:43 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2UIchHG077731; Fri, 30 Mar 2018 18:38:43 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2UIchvi077730; Fri, 30 Mar 2018 18:38:43 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201803301838.w2UIchvi077730@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 30 Mar 2018 18:38:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331786 - stable/11/sys/ofed/drivers/infiniband/core X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/ofed/drivers/infiniband/core X-SVN-Commit-Revision: 331786 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Mar 2018 18:38:44 -0000 Author: hselasky Date: Fri Mar 30 18:38:43 2018 New Revision: 331786 URL: https://svnweb.freebsd.org/changeset/base/331786 Log: MFC r330580: Make sure the IPv6 scope ID gets properly masked in ibcore. When exchanging CM messages the IPv6 scope ID should be ignored for link local addresses when doing comparisons. Make sure the scope ID is always set to zero for link local addresses. Sponsored by: Mellanox Technologies Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_cma.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_cma.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/ib_cma.c Fri Mar 30 18:37:51 2018 (r331785) +++ stable/11/sys/ofed/drivers/infiniband/core/ib_cma.c Fri Mar 30 18:38:43 2018 (r331786) @@ -1116,6 +1116,17 @@ static void cma_save_ip4_info(struct sockaddr_in *src_ } } +static void cma_ip6_clear_scope_id(struct in6_addr *addr) +{ + /* make sure link local scope ID gets zeroed */ + if (IN6_IS_SCOPE_LINKLOCAL(addr) || + IN6_IS_ADDR_MC_INTFACELOCAL(addr)) { + /* use byte-access to be alignment safe */ + addr->s6_addr[2] = 0; + addr->s6_addr[3] = 0; + } +} + static void cma_save_ip6_info(struct sockaddr_in6 *src_addr, struct sockaddr_in6 *dst_addr, struct cma_hdr *hdr, @@ -1128,6 +1139,7 @@ static void cma_save_ip6_info(struct sockaddr_in6 *src .sin6_addr = hdr->dst_addr.ip6, .sin6_port = local_port, }; + cma_ip6_clear_scope_id(&src_addr->sin6_addr); } if (dst_addr) { @@ -1137,6 +1149,7 @@ static void cma_save_ip6_info(struct sockaddr_in6 *src .sin6_addr = hdr->src_addr.ip6, .sin6_port = hdr->port, }; + cma_ip6_clear_scope_id(&dst_addr->sin6_addr); } } @@ -1395,6 +1408,7 @@ static bool cma_match_private_data(struct rdma_id_priv ip6_addr = ((struct sockaddr_in6 *)addr)->sin6_addr; if (cma_get_ip_ver(hdr) != 6) return false; + cma_ip6_clear_scope_id(&ip6_addr); if (!cma_any_addr(addr) && memcmp(&hdr->dst_addr.ip6, &ip6_addr, sizeof(ip6_addr))) return false; @@ -3242,6 +3256,8 @@ static int cma_format_hdr(void *hdr, struct rdma_id_pr cma_hdr->src_addr.ip6 = src6->sin6_addr; cma_hdr->dst_addr.ip6 = dst6->sin6_addr; cma_hdr->port = src6->sin6_port; + cma_ip6_clear_scope_id(&cma_hdr->src_addr.ip6); + cma_ip6_clear_scope_id(&cma_hdr->dst_addr.ip6); } return 0; }