Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 7 Mar 2018 13:28:12 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r330584 - head/sys/ofed/drivers/infiniband/core
Message-ID:  <201803071328.w27DSC0P012788@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Wed Mar  7 13:28:12 2018
New Revision: 330584
URL: https://svnweb.freebsd.org/changeset/base/330584

Log:
  Recover IPv6 scope ID for multicast link-local addresses as well as
  unicast link-local addresses.
  
  MFC after:	1 week
  Sponsored by:	Mellanox Technologies

Modified:
  head/sys/ofed/drivers/infiniband/core/ib_cma.c

Modified: head/sys/ofed/drivers/infiniband/core/ib_cma.c
==============================================================================
--- head/sys/ofed/drivers/infiniband/core/ib_cma.c	Wed Mar  7 13:25:40 2018	(r330583)
+++ head/sys/ofed/drivers/infiniband/core/ib_cma.c	Wed Mar  7 13:28:12 2018	(r330584)
@@ -2785,7 +2785,8 @@ static int cma_bind_addr(struct rdma_cm_id *id, struct
 			struct sockaddr_in6 *src_addr6 = (struct sockaddr_in6 *) src_addr;
 			struct sockaddr_in6 *dst_addr6 = (struct sockaddr_in6 *) dst_addr;
 			src_addr6->sin6_scope_id = dst_addr6->sin6_scope_id;
-			if (IN6_IS_SCOPE_LINKLOCAL(&dst_addr6->sin6_addr))
+			if (IN6_IS_SCOPE_LINKLOCAL(&dst_addr6->sin6_addr) ||
+			    IN6_IS_ADDR_MC_INTFACELOCAL(&dst_addr6->sin6_addr))
 				id->route.addr.dev_addr.bound_dev_if = dst_addr6->sin6_scope_id;
 		} else if (dst_addr->sa_family == AF_IB) {
 			((struct sockaddr_ib *) src_addr)->sib_pkey =
@@ -3119,13 +3120,13 @@ static int cma_check_linklocal(struct rdma_dev_addr *d
 
 	sin6 = *(struct sockaddr_in6 *)addr;
 
-	if (!(IN6_IS_SCOPE_LINKLOCAL(&sin6.sin6_addr)))
-		return 0;
-
-	if (sa6_recoverscope(&sin6) || sin6.sin6_scope_id == 0)
-		return -EINVAL;
-
-	dev_addr->bound_dev_if = sin6.sin6_scope_id;
+	if (IN6_IS_SCOPE_LINKLOCAL(&sin6.sin6_addr) ||
+	    IN6_IS_ADDR_MC_INTFACELOCAL(&sin6.sin6_addr)) {
+		/* check if IPv6 scope ID is set */
+		if (sa6_recoverscope(&sin6) || sin6.sin6_scope_id == 0)
+			return -EINVAL;
+		dev_addr->bound_dev_if = sin6.sin6_scope_id;
+	}
 #endif
 	return 0;
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201803071328.w27DSC0P012788>