All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] SCTP: Fix SCTP_SET_PEER_PRIMARY_ADDR to accpet v4mapped address
@ 2010-12-08  3:11 ` Wei Yongjun
  0 siblings, 0 replies; 8+ messages in thread
From: Wei Yongjun @ 2010-12-08  3:11 UTC (permalink / raw)
  To: Vlad Yasevich, David Miller; +Cc: linux-sctp, netdev

SCTP_SET_PEER_PRIMARY_ADDR does not accpet v4mapped address, using
v4mapped address in SCTP_SET_PEER_PRIMARY_ADDR socket option will
get -EADDRNOTAVAIL error if v4map is enabled. This patch try to
fix it by mapping v4mapped address to v4 address if allowed.

Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com>
---
 net/sctp/socket.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 6bd5543..0b9ee34 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -2932,6 +2932,7 @@ static int sctp_setsockopt_peer_primary_addr(struct sock *sk, char __user *optva
 	struct sctp_association	*asoc = NULL;
 	struct sctp_setpeerprim	prim;
 	struct sctp_chunk	*chunk;
+	struct sctp_af		*af;
 	int 			err;
 
 	sp = sctp_sk(sk);
@@ -2959,6 +2960,13 @@ static int sctp_setsockopt_peer_primary_addr(struct sock *sk, char __user *optva
 	if (!sctp_state(asoc, ESTABLISHED))
 		return -ENOTCONN;
 
+	af = sctp_get_af_specific(prim.sspp_addr.ss_family);
+	if (!af)
+		return -EINVAL;
+
+	if (!af->addr_valid((union sctp_addr *)&prim.sspp_addr, sp, NULL))
+		return -EADDRNOTAVAIL;
+
 	if (!sctp_assoc_lookup_laddr(asoc, (union sctp_addr *)&prim.sspp_addr))
 		return -EADDRNOTAVAIL;
 



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

* [PATCH] SCTP: Fix SCTP_SET_PEER_PRIMARY_ADDR to accpet v4mapped address
@ 2010-12-08  3:11 ` Wei Yongjun
  0 siblings, 0 replies; 8+ messages in thread
From: Wei Yongjun @ 2010-12-08  3:11 UTC (permalink / raw)
  To: Vlad Yasevich, David Miller; +Cc: linux-sctp, netdev

SCTP_SET_PEER_PRIMARY_ADDR does not accpet v4mapped address, using
v4mapped address in SCTP_SET_PEER_PRIMARY_ADDR socket option will
get -EADDRNOTAVAIL error if v4map is enabled. This patch try to
fix it by mapping v4mapped address to v4 address if allowed.

Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com>
---
 net/sctp/socket.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 6bd5543..0b9ee34 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -2932,6 +2932,7 @@ static int sctp_setsockopt_peer_primary_addr(struct sock *sk, char __user *optva
 	struct sctp_association	*asoc = NULL;
 	struct sctp_setpeerprim	prim;
 	struct sctp_chunk	*chunk;
+	struct sctp_af		*af;
 	int 			err;
 
 	sp = sctp_sk(sk);
@@ -2959,6 +2960,13 @@ static int sctp_setsockopt_peer_primary_addr(struct sock *sk, char __user *optva
 	if (!sctp_state(asoc, ESTABLISHED))
 		return -ENOTCONN;
 
+	af = sctp_get_af_specific(prim.sspp_addr.ss_family);
+	if (!af)
+		return -EINVAL;
+
+	if (!af->addr_valid((union sctp_addr *)&prim.sspp_addr, sp, NULL))
+		return -EADDRNOTAVAIL;
+
 	if (!sctp_assoc_lookup_laddr(asoc, (union sctp_addr *)&prim.sspp_addr))
 		return -EADDRNOTAVAIL;
 



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

* Re: [PATCH] SCTP: Fix SCTP_SET_PEER_PRIMARY_ADDR to accpet v4mapped address
  2010-12-08  3:11 ` Wei Yongjun
@ 2010-12-10 23:01   ` David Miller
  -1 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2010-12-10 23:01 UTC (permalink / raw)
  To: yjwei; +Cc: vladislav.yasevich, linux-sctp, netdev

From: Wei Yongjun <yjwei@cn.fujitsu.com>
Date: Wed, 08 Dec 2010 11:11:09 +0800

> SCTP_SET_PEER_PRIMARY_ADDR does not accpet v4mapped address, using
> v4mapped address in SCTP_SET_PEER_PRIMARY_ADDR socket option will
> get -EADDRNOTAVAIL error if v4map is enabled. This patch try to
> fix it by mapping v4mapped address to v4 address if allowed.
> 
> Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com>

Vlad and other SCTP folks, please review this patch.

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

* Re: [PATCH] SCTP: Fix SCTP_SET_PEER_PRIMARY_ADDR to accpet
@ 2010-12-10 23:01   ` David Miller
  0 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2010-12-10 23:01 UTC (permalink / raw)
  To: yjwei; +Cc: vladislav.yasevich, linux-sctp, netdev

From: Wei Yongjun <yjwei@cn.fujitsu.com>
Date: Wed, 08 Dec 2010 11:11:09 +0800

> SCTP_SET_PEER_PRIMARY_ADDR does not accpet v4mapped address, using
> v4mapped address in SCTP_SET_PEER_PRIMARY_ADDR socket option will
> get -EADDRNOTAVAIL error if v4map is enabled. This patch try to
> fix it by mapping v4mapped address to v4 address if allowed.
> 
> Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com>

Vlad and other SCTP folks, please review this patch.

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

* Re: [PATCH] SCTP: Fix SCTP_SET_PEER_PRIMARY_ADDR to accpet v4mapped address
  2010-12-08  3:11 ` Wei Yongjun
@ 2010-12-10 23:13   ` Vladislav Yasevich
  -1 siblings, 0 replies; 8+ messages in thread
From: Vladislav Yasevich @ 2010-12-10 23:13 UTC (permalink / raw)
  To: Wei Yongjun; +Cc: David Miller, linux-sctp, netdev

On 12/07/2010 10:11 PM, Wei Yongjun wrote:
> SCTP_SET_PEER_PRIMARY_ADDR does not accpet v4mapped address, using
> v4mapped address in SCTP_SET_PEER_PRIMARY_ADDR socket option will
> get -EADDRNOTAVAIL error if v4map is enabled. This patch try to
> fix it by mapping v4mapped address to v4 address if allowed.
> 
> Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com>

Looks good.

Acked-by: Vlad Yasevich <vladislav.yasevich@hp.com>

-vlad

> ---
>  net/sctp/socket.c |    8 ++++++++
>  1 files changed, 8 insertions(+), 0 deletions(-)
> 
> diff --git a/net/sctp/socket.c b/net/sctp/socket.c
> index 6bd5543..0b9ee34 100644
> --- a/net/sctp/socket.c
> +++ b/net/sctp/socket.c
> @@ -2932,6 +2932,7 @@ static int sctp_setsockopt_peer_primary_addr(struct sock *sk, char __user *optva
>  	struct sctp_association	*asoc = NULL;
>  	struct sctp_setpeerprim	prim;
>  	struct sctp_chunk	*chunk;
> +	struct sctp_af		*af;
>  	int 			err;
>  
>  	sp = sctp_sk(sk);
> @@ -2959,6 +2960,13 @@ static int sctp_setsockopt_peer_primary_addr(struct sock *sk, char __user *optva
>  	if (!sctp_state(asoc, ESTABLISHED))
>  		return -ENOTCONN;
>  
> +	af = sctp_get_af_specific(prim.sspp_addr.ss_family);
> +	if (!af)
> +		return -EINVAL;
> +
> +	if (!af->addr_valid((union sctp_addr *)&prim.sspp_addr, sp, NULL))
> +		return -EADDRNOTAVAIL;
> +
>  	if (!sctp_assoc_lookup_laddr(asoc, (union sctp_addr *)&prim.sspp_addr))
>  		return -EADDRNOTAVAIL;
>  
> 
> 


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

* Re: [PATCH] SCTP: Fix SCTP_SET_PEER_PRIMARY_ADDR to accpet v4mapped
@ 2010-12-10 23:13   ` Vladislav Yasevich
  0 siblings, 0 replies; 8+ messages in thread
From: Vladislav Yasevich @ 2010-12-10 23:13 UTC (permalink / raw)
  To: Wei Yongjun; +Cc: David Miller, linux-sctp, netdev

On 12/07/2010 10:11 PM, Wei Yongjun wrote:
> SCTP_SET_PEER_PRIMARY_ADDR does not accpet v4mapped address, using
> v4mapped address in SCTP_SET_PEER_PRIMARY_ADDR socket option will
> get -EADDRNOTAVAIL error if v4map is enabled. This patch try to
> fix it by mapping v4mapped address to v4 address if allowed.
> 
> Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com>

Looks good.

Acked-by: Vlad Yasevich <vladislav.yasevich@hp.com>

-vlad

> ---
>  net/sctp/socket.c |    8 ++++++++
>  1 files changed, 8 insertions(+), 0 deletions(-)
> 
> diff --git a/net/sctp/socket.c b/net/sctp/socket.c
> index 6bd5543..0b9ee34 100644
> --- a/net/sctp/socket.c
> +++ b/net/sctp/socket.c
> @@ -2932,6 +2932,7 @@ static int sctp_setsockopt_peer_primary_addr(struct sock *sk, char __user *optva
>  	struct sctp_association	*asoc = NULL;
>  	struct sctp_setpeerprim	prim;
>  	struct sctp_chunk	*chunk;
> +	struct sctp_af		*af;
>  	int 			err;
>  
>  	sp = sctp_sk(sk);
> @@ -2959,6 +2960,13 @@ static int sctp_setsockopt_peer_primary_addr(struct sock *sk, char __user *optva
>  	if (!sctp_state(asoc, ESTABLISHED))
>  		return -ENOTCONN;
>  
> +	af = sctp_get_af_specific(prim.sspp_addr.ss_family);
> +	if (!af)
> +		return -EINVAL;
> +
> +	if (!af->addr_valid((union sctp_addr *)&prim.sspp_addr, sp, NULL))
> +		return -EADDRNOTAVAIL;
> +
>  	if (!sctp_assoc_lookup_laddr(asoc, (union sctp_addr *)&prim.sspp_addr))
>  		return -EADDRNOTAVAIL;
>  
> 
> 


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

* Re: [PATCH] SCTP: Fix SCTP_SET_PEER_PRIMARY_ADDR to accpet v4mapped address
  2010-12-10 23:13   ` [PATCH] SCTP: Fix SCTP_SET_PEER_PRIMARY_ADDR to accpet v4mapped Vladislav Yasevich
@ 2010-12-10 23:29     ` David Miller
  -1 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2010-12-10 23:29 UTC (permalink / raw)
  To: vladislav.yasevich; +Cc: yjwei, linux-sctp, netdev

From: Vladislav Yasevich <vladislav.yasevich@hp.com>
Date: Fri, 10 Dec 2010 18:13:58 -0500

> On 12/07/2010 10:11 PM, Wei Yongjun wrote:
>> SCTP_SET_PEER_PRIMARY_ADDR does not accpet v4mapped address, using
>> v4mapped address in SCTP_SET_PEER_PRIMARY_ADDR socket option will
>> get -EADDRNOTAVAIL error if v4map is enabled. This patch try to
>> fix it by mapping v4mapped address to v4 address if allowed.
>> 
>> Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com>
> 
> Looks good.
> 
> Acked-by: Vlad Yasevich <vladislav.yasevich@hp.com>

Applied, thanks everyone.

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

* Re: [PATCH] SCTP: Fix SCTP_SET_PEER_PRIMARY_ADDR to accpet
@ 2010-12-10 23:29     ` David Miller
  0 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2010-12-10 23:29 UTC (permalink / raw)
  To: vladislav.yasevich; +Cc: yjwei, linux-sctp, netdev

From: Vladislav Yasevich <vladislav.yasevich@hp.com>
Date: Fri, 10 Dec 2010 18:13:58 -0500

> On 12/07/2010 10:11 PM, Wei Yongjun wrote:
>> SCTP_SET_PEER_PRIMARY_ADDR does not accpet v4mapped address, using
>> v4mapped address in SCTP_SET_PEER_PRIMARY_ADDR socket option will
>> get -EADDRNOTAVAIL error if v4map is enabled. This patch try to
>> fix it by mapping v4mapped address to v4 address if allowed.
>> 
>> Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com>
> 
> Looks good.
> 
> Acked-by: Vlad Yasevich <vladislav.yasevich@hp.com>

Applied, thanks everyone.

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

end of thread, other threads:[~2010-12-10 23:29 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-08  3:11 [PATCH] SCTP: Fix SCTP_SET_PEER_PRIMARY_ADDR to accpet v4mapped address Wei Yongjun
2010-12-08  3:11 ` Wei Yongjun
2010-12-10 23:01 ` David Miller
2010-12-10 23:01   ` [PATCH] SCTP: Fix SCTP_SET_PEER_PRIMARY_ADDR to accpet David Miller
2010-12-10 23:13 ` [PATCH] SCTP: Fix SCTP_SET_PEER_PRIMARY_ADDR to accpet v4mapped address Vladislav Yasevich
2010-12-10 23:13   ` [PATCH] SCTP: Fix SCTP_SET_PEER_PRIMARY_ADDR to accpet v4mapped Vladislav Yasevich
2010-12-10 23:29   ` [PATCH] SCTP: Fix SCTP_SET_PEER_PRIMARY_ADDR to accpet v4mapped address David Miller
2010-12-10 23:29     ` [PATCH] SCTP: Fix SCTP_SET_PEER_PRIMARY_ADDR to accpet David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.