svn commit: r330584 - head/sys/ofed/drivers/infiniband/core

Hans Petter Selasky hselasky at FreeBSD.org
Wed Mar 7 13:28:13 UTC 2018


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;
 }


More information about the svn-src-all mailing list