aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/client.c
diff options
context:
space:
mode:
authorMi Jinlong <mijinlong@cn.fujitsu.com>2011-10-12 03:09:34 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2011-10-18 12:08:10 -0400
commitb9dd3abbbc708da5e3c53424a5b2c66ab580f97e (patch)
treef24b18e9651fd93aaf871c3de99a8903a6c36826 /fs/nfs/client.c
parent3236c3e1adc0c7ec83eaff1de2d06746b7c5bb28 (diff)
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>
Diffstat (limited to 'fs/nfs/client.c')
-rw-r--r--fs/nfs/client.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index 5833fbbf59b0..b4e41dd4d0f6 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -336,11 +336,12 @@ static int nfs_sockaddr_match_ipaddr6(const struct sockaddr *sa1,
336 const struct sockaddr_in6 *sin1 = (const struct sockaddr_in6 *)sa1; 336 const struct sockaddr_in6 *sin1 = (const struct sockaddr_in6 *)sa1;
337 const struct sockaddr_in6 *sin2 = (const struct sockaddr_in6 *)sa2; 337 const struct sockaddr_in6 *sin2 = (const struct sockaddr_in6 *)sa2;
338 338
339 if (ipv6_addr_scope(&sin1->sin6_addr) == IPV6_ADDR_SCOPE_LINKLOCAL && 339 if (!ipv6_addr_equal(&sin1->sin6_addr, &sin2->sin6_addr))
340 sin1->sin6_scope_id != sin2->sin6_scope_id)
341 return 0; 340 return 0;
341 else if (ipv6_addr_type(&sin1->sin6_addr) & IPV6_ADDR_LINKLOCAL)
342 return sin1->sin6_scope_id == sin2->sin6_scope_id;
342 343
343 return ipv6_addr_equal(&sin1->sin6_addr, &sin2->sin6_addr); 344 return 1;
344} 345}
345#else /* !defined(CONFIG_IPV6) && !defined(CONFIG_IPV6_MODULE) */ 346#else /* !defined(CONFIG_IPV6) && !defined(CONFIG_IPV6_MODULE) */
346static int nfs_sockaddr_match_ipaddr6(const struct sockaddr *sa1, 347static int nfs_sockaddr_match_ipaddr6(const struct sockaddr *sa1,