Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 Oct 2017 12:36:41 +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: r324492 - head/sys/ofed/include/rdma
Message-ID:  <201710101236.v9ACafPP073202@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Tue Oct 10 12:36:41 2017
New Revision: 324492
URL: https://svnweb.freebsd.org/changeset/base/324492

Log:
  Make sure the IPv6 scope ID gets zeroed inside the GID. Else searching for a
  valid GID entry based on IPv6 addresses can fail.
  
  Sponsored by:	Mellanox Technologies
  MFC after:	1 week

Modified:
  head/sys/ofed/include/rdma/ib_addr.h

Modified: head/sys/ofed/include/rdma/ib_addr.h
==============================================================================
--- head/sys/ofed/include/rdma/ib_addr.h	Tue Oct 10 12:24:52 2017	(r324491)
+++ head/sys/ofed/include/rdma/ib_addr.h	Tue Oct 10 12:36:41 2017	(r324492)
@@ -157,6 +157,12 @@ static inline int rdma_ip2gid(struct sockaddr *addr, u
 	case AF_INET6:
 		memcpy(gid->raw, &((struct sockaddr_in6 *)addr)->sin6_addr,
 				   16);
+		/* make sure scope ID gets zeroed inside GID */
+		if (IN6_IS_SCOPE_LINKLOCAL((struct in6_addr *)gid->raw) ||
+		    IN6_IS_ADDR_MC_INTFACELOCAL((struct in6_addr *)gid->raw)) {
+			gid->raw[2] = 0;
+			gid->raw[3] = 0;
+		}
 		break;
 	default:
 		return -EINVAL;



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