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
This commit is contained in:
Hans Petter Selasky 2017-10-10 12:36:41 +00:00
parent 3cd4c11ab2
commit aacb037742
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=324492

View File

@ -157,6 +157,12 @@ static inline int rdma_ip2gid(struct sockaddr *addr, union ib_gid *gid)
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;