linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/2] SUNRPC: compare scopeid for link-local addresses
@ 2011-08-30  9:22 Mi Jinlong
  2011-08-30 10:07 ` Jeff Layton
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Mi Jinlong @ 2011-08-30  9:22 UTC (permalink / raw)
  To: NFS; +Cc: J. Bruce Fields, Jeff Layton, Chuck Lever, Steve Dickson

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>
---
 include/linux/sunrpc/clnt.h |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index db7bcaf..ee1bb67 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,
-- 
1.7.6



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] SUNRPC: compare scopeid for link-local addresses
  2011-08-30  9:22 [PATCH 2/2] SUNRPC: compare scopeid for link-local addresses Mi Jinlong
@ 2011-08-30 10:07 ` Jeff Layton
  2011-08-30 14:28 ` Chuck Lever
  2011-09-13  7:45 ` Mi Jinlong
  2 siblings, 0 replies; 6+ messages in thread
From: Jeff Layton @ 2011-08-30 10:07 UTC (permalink / raw)
  To: Mi Jinlong; +Cc: NFS, J. Bruce Fields, Chuck Lever, Steve Dickson

On Tue, 30 Aug 2011 17:22:49 +0800
Mi Jinlong <mijinlong@cn.fujitsu.com> wrote:

> 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: 
> ---
>  include/linux/sunrpc/clnt.h |    8 +++++++-
>  1 files changed, 7 insertions(+), 1 deletions(-)
> 
> diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
> index db7bcaf..ee1bb67 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,

Reviewed-by: Jeff Layton <jlayton@redhat.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] SUNRPC: compare scopeid for link-local addresses
  2011-08-30  9:22 [PATCH 2/2] SUNRPC: compare scopeid for link-local addresses Mi Jinlong
  2011-08-30 10:07 ` Jeff Layton
@ 2011-08-30 14:28 ` Chuck Lever
  2011-08-30 15:05   ` Chuck Lever
  2011-09-13  7:45 ` Mi Jinlong
  2 siblings, 1 reply; 6+ messages in thread
From: Chuck Lever @ 2011-08-30 14:28 UTC (permalink / raw)
  To: Mi Jinlong; +Cc: NFS, J. Bruce Fields, Jeff Layton, Steve Dickson


On Aug 30, 2011, at 5:22 AM, Mi Jinlong wrote:

> 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>
> ---
> include/linux/sunrpc/clnt.h |    8 +++++++-
> 1 files changed, 7 insertions(+), 1 deletions(-)
> 
> diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
> index db7bcaf..ee1bb67 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;

Thanks for splitting the patches.

The address comparators I've seen check that both addresses are link-local before comparing the scope IDs.  I don't think we can assume the kind of source-destination address relationship we have in parts of the RPC server code.

> +
> +	return true;
> }
> 
> static inline bool __rpc_copy_addr6(struct sockaddr *dst,
> -- 
> 1.7.6
> 
> 

-- 
Chuck Lever
chuck[dot]lever[at]oracle[dot]com





^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] SUNRPC: compare scopeid for link-local addresses
  2011-08-30 14:28 ` Chuck Lever
@ 2011-08-30 15:05   ` Chuck Lever
  0 siblings, 0 replies; 6+ messages in thread
From: Chuck Lever @ 2011-08-30 15:05 UTC (permalink / raw)
  To: Mi Jinlong; +Cc: NFS, J. Bruce Fields, Jeff Layton, Steve Dickson


On Aug 30, 2011, at 10:28 AM, Chuck Lever wrote:

> 
> On Aug 30, 2011, at 5:22 AM, Mi Jinlong wrote:
> 
>> 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>
>> ---
>> include/linux/sunrpc/clnt.h |    8 +++++++-
>> 1 files changed, 7 insertions(+), 1 deletions(-)
>> 
>> diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
>> index db7bcaf..ee1bb67 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;
> 
> Thanks for splitting the patches.
> 
> The address comparators I've seen check that both addresses are link-local before comparing the scope IDs.  I don't think we can assume the kind of source-destination address relationship we have in parts of the RPC server code.

Jeff points out that you've already tested that the addresses are equal.  So, never mind.

Reviewed-by: Chuck Lever <chuck.lever@oracle.com>

> 
>> +
>> +	return true;
>> }
>> 
>> static inline bool __rpc_copy_addr6(struct sockaddr *dst,
>> -- 
>> 1.7.6
>> 
>> 
> 
> -- 
> Chuck Lever
> chuck[dot]lever[at]oracle[dot]com
> 
> 
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Chuck Lever
chuck[dot]lever[at]oracle[dot]com





^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] SUNRPC: compare scopeid for link-local addresses
  2011-08-30  9:22 [PATCH 2/2] SUNRPC: compare scopeid for link-local addresses Mi Jinlong
  2011-08-30 10:07 ` Jeff Layton
  2011-08-30 14:28 ` Chuck Lever
@ 2011-09-13  7:45 ` Mi Jinlong
  2011-09-14 12:23   ` J. Bruce Fields
  2 siblings, 1 reply; 6+ messages in thread
From: Mi Jinlong @ 2011-09-13  7:45 UTC (permalink / raw)
  To: NFS; +Cc: J. Bruce Fields, Jeff Layton, Chuck Lever, Steve Dickson

Hi guys:

  What's the situation about those two paths?


thanks,
Mi Jinlong

Mi Jinlong:
> 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>
> ---
>  include/linux/sunrpc/clnt.h |    8 +++++++-
>  1 files changed, 7 insertions(+), 1 deletions(-)
> 
> diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
> index db7bcaf..ee1bb67 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,


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] SUNRPC: compare scopeid for link-local addresses
  2011-09-13  7:45 ` Mi Jinlong
@ 2011-09-14 12:23   ` J. Bruce Fields
  0 siblings, 0 replies; 6+ messages in thread
From: J. Bruce Fields @ 2011-09-14 12:23 UTC (permalink / raw)
  To: Mi Jinlong; +Cc: NFS, Jeff Layton, Chuck Lever, Steve Dickson

On Tue, Sep 13, 2011 at 03:45:24PM +0800, Mi Jinlong wrote:
> Hi guys:
> 
>   What's the situation about those two paths?

Apologies for the delay; both look reasonable to me, thanks.  Applying
for 3.2.  (May be a few days before I push it out to my public tree.)

--b.

> 
> 
> thanks,
> Mi Jinlong
> 
> Mi Jinlong:
> > 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>
> > ---
> >  include/linux/sunrpc/clnt.h |    8 +++++++-
> >  1 files changed, 7 insertions(+), 1 deletions(-)
> > 
> > diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
> > index db7bcaf..ee1bb67 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,
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-09-14 12:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-30  9:22 [PATCH 2/2] SUNRPC: compare scopeid for link-local addresses Mi Jinlong
2011-08-30 10:07 ` Jeff Layton
2011-08-30 14:28 ` Chuck Lever
2011-08-30 15:05   ` Chuck Lever
2011-09-13  7:45 ` Mi Jinlong
2011-09-14 12:23   ` J. Bruce Fields

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).