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:
hselasky 2017-10-10 12:36:41 +00:00
parent 5819ce8c32
commit 15d7b05109

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;