From: Mi Jinlong Date: Tue, 30 Aug 2011 09:22:49 +0000 (+0800) Subject: SUNRPC: compare scopeid for link-local addresses X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=038c01598e728cda5b2996c4bf883e8485b2fe50;p=deliverable%2Flinux.git SUNRPC: compare scopeid for link-local addresses 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 Reviewed-by: Chuck Lever Reviewed-by: Jeff Layton Signed-off-by: J. Bruce Fields --- diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h index db7bcaf7c5bd..ee1bb67f525e 100644 --- a/include/linux/sunrpc/clnt.h +++ b/include/linux/sunrpc/clnt.h @@ -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,