svn commit: r325941 - stable/11/sys/ofed/drivers/infiniband/core
Hans Petter Selasky
hselasky at FreeBSD.org
Fri Nov 17 15:45:37 UTC 2017
Author: hselasky
Date: Fri Nov 17 15:45:35 2017
New Revision: 325941
URL: https://svnweb.freebsd.org/changeset/base/325941
Log:
MFC r325615:
Make sure the IPv6 scope ID gets zeroed when exchanging CMA messages in ibcore.
Else the IPv6 address matching might fail. This change adds support for both
embedded and non-embedded IPv6 scope IDs when passing a IPv6 link-local socket
address to RDMA. Prior to this change only global IPv6 addresses would work
with RDMA.
Sponsored by: Mellanox Technologies
Modified:
stable/11/sys/ofed/drivers/infiniband/core/cma.c
Directory Properties:
stable/11/ (props changed)
Modified: stable/11/sys/ofed/drivers/infiniband/core/cma.c
==============================================================================
--- stable/11/sys/ofed/drivers/infiniband/core/cma.c Fri Nov 17 15:43:29 2017 (r325940)
+++ stable/11/sys/ofed/drivers/infiniband/core/cma.c Fri Nov 17 15:45:35 2017 (r325941)
@@ -911,6 +911,17 @@ static int cma_get_net_info(void *hdr, enum rdma_port_
return 0;
}
+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_net_info(struct rdma_addr *addr,
struct rdma_addr *listen_addr,
u8 ip_ver, __be16 port,
@@ -942,6 +953,7 @@ static void cma_save_net_info(struct rdma_addr *addr,
ip6->sin6_port = listen6->sin6_port;
ip6->sin6_len = sizeof(struct sockaddr_in6);
ip6->sin6_scope_id = listen6->sin6_scope_id;
+ cma_ip6_clear_scope_id(&ip6->sin6_addr);
ip6 = (struct sockaddr_in6 *) &addr->dst_addr;
ip6->sin6_family = listen6->sin6_family;
@@ -949,6 +961,7 @@ static void cma_save_net_info(struct rdma_addr *addr,
ip6->sin6_port = port;
ip6->sin6_len = sizeof(struct sockaddr_in6);
ip6->sin6_scope_id = listen6->sin6_scope_id;
+ cma_ip6_clear_scope_id(&ip6->sin6_addr);
break;
default:
break;
@@ -1512,6 +1525,7 @@ static void cma_set_compare_data(enum rdma_port_space
break;
case AF_INET6:
ip6_addr = ((struct sockaddr_in6 *) addr)->sin6_addr;
+ cma_ip6_clear_scope_id(&ip6_addr);
if (ps == RDMA_PS_SDP) {
sdp_set_ip_ver(sdp_data, 6);
sdp_set_ip_ver(sdp_mask, 0xF);
@@ -2817,6 +2831,8 @@ static int cma_format_hdr(void *hdr, enum rdma_port_sp
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);
break;
}
}
More information about the svn-src-stable-11
mailing list