]> git.karo-electronics.de Git - linux-beck.git/commitdiff
SUNRPC: compare scopeid for link-local addresses
authorMi Jinlong <mijinlong@cn.fujitsu.com>
Tue, 30 Aug 2011 09:22:49 +0000 (17:22 +0800)
committerJ. Bruce Fields <bfields@redhat.com>
Wed, 14 Sep 2011 12:22:02 +0000 (08:22 -0400)
For ipv6 link-local addresses, sunrpc do not compare those scope id.
This patch let sunrpc compares scope id only on link-local addresses.

Signed-off-by: Mi Jinlong <mijinlong@cn.fujitsu.com>
Reviewed-by: Chuck Lever <chuck.lever@oracle.com>
Reviewed-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
include/linux/sunrpc/clnt.h

index db7bcaf7c5bd98a873f1b50fc3ad87a13df6c353..ee1bb67f525e100dfb3516081ac6f52c98a6da57 100644 (file)
@@ -218,7 +218,13 @@ static inline bool __rpc_cmp_addr6(const struct sockaddr *sap1,
 {
        const struct sockaddr_in6 *sin1 = (const struct sockaddr_in6 *)sap1;
        const struct sockaddr_in6 *sin2 = (const struct sockaddr_in6 *)sap2;
-       return ipv6_addr_equal(&sin1->sin6_addr, &sin2->sin6_addr);
+
+       if (!ipv6_addr_equal(&sin1->sin6_addr, &sin2->sin6_addr))
+               return false;
+       else if (ipv6_addr_type(&sin1->sin6_addr) & IPV6_ADDR_LINKLOCAL)
+               return sin1->sin6_scope_id == sin2->sin6_scope_id;
+
+       return true;
 }
 
 static inline bool __rpc_copy_addr6(struct sockaddr *dst,