mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-04-07 06:44:53 +00:00
RDMA/cma: Handle global/non-linklocal IPv6 addresses in cma_check_linklocal()
If addr is not a linklocal address, the code incorrectly fails to return and ends up assigning the scope ID to the scope id of the address, which is wrong. Fix by checking if it's a link local address first, and immediately return 0 if not. Signed-off-by: Somnath Kotur <somnath.kotur@emulex.com> Signed-off-by: Roland Dreier <roland@purestorage.com>
This commit is contained in:
parent
7e22e91102
commit
5462eddd7a
1 changed files with 5 additions and 2 deletions
|
@ -2480,8 +2480,11 @@ static int cma_check_linklocal(struct rdma_dev_addr *dev_addr,
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
sin6 = (struct sockaddr_in6 *) addr;
|
sin6 = (struct sockaddr_in6 *) addr;
|
||||||
if ((ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LINKLOCAL) &&
|
|
||||||
!sin6->sin6_scope_id)
|
if (!(ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LINKLOCAL))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (!sin6->sin6_scope_id)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
dev_addr->bound_dev_if = sin6->sin6_scope_id;
|
dev_addr->bound_dev_if = sin6->sin6_scope_id;
|
||||||
|
|
Loading…
Add table
Reference in a new issue