mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-11-01 17:08:10 +00:00
nfs: fix bug about IPv6 address scope checking
The result from ipv6_addr_scope() always not be a single SCOPE, so we can't use equal to compare the result with IPV6_ADDR_SCOPE_LINKLOCAL at nfs_sockaddr_match_ipaddr6. This patch fixs the problem, and lets checking address before scope_id. Signed-off-by: Mi Jinlong <mijinlong@cn.fujitsu.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
This commit is contained in:
parent
3236c3e1ad
commit
b9dd3abbbc
1 changed files with 4 additions and 3 deletions
|
@ -336,11 +336,12 @@ static int nfs_sockaddr_match_ipaddr6(const struct sockaddr *sa1,
|
|||
const struct sockaddr_in6 *sin1 = (const struct sockaddr_in6 *)sa1;
|
||||
const struct sockaddr_in6 *sin2 = (const struct sockaddr_in6 *)sa2;
|
||||
|
||||
if (ipv6_addr_scope(&sin1->sin6_addr) == IPV6_ADDR_SCOPE_LINKLOCAL &&
|
||||
sin1->sin6_scope_id != sin2->sin6_scope_id)
|
||||
if (!ipv6_addr_equal(&sin1->sin6_addr, &sin2->sin6_addr))
|
||||
return 0;
|
||||
else if (ipv6_addr_type(&sin1->sin6_addr) & IPV6_ADDR_LINKLOCAL)
|
||||
return sin1->sin6_scope_id == sin2->sin6_scope_id;
|
||||
|
||||
return ipv6_addr_equal(&sin1->sin6_addr, &sin2->sin6_addr);
|
||||
return 1;
|
||||
}
|
||||
#else /* !defined(CONFIG_IPV6) && !defined(CONFIG_IPV6_MODULE) */
|
||||
static int nfs_sockaddr_match_ipaddr6(const struct sockaddr *sa1,
|
||||
|
|
Loading…
Reference in a new issue