netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* 2.6.27 [BUG-FIX] [PATCH 1/1] dccp: Port redirection support for DCCP
@ 2008-10-18  9:21 Gerrit Renker
  2008-10-18  9:48 ` KOVACS Krisztian
  0 siblings, 1 reply; 6+ messages in thread
From: Gerrit Renker @ 2008-10-18  9:21 UTC (permalink / raw)
  To: David S. Miller, netdev; +Cc: hidden

Dave, can you please consider the patch below. This fixes a 
bug for DCCP in the current netdev-2.6 tree (2.6.27).

---------------------------> 2.6.27 patch <-----------------------------
dccp: Port redirection support for DCCP

Commit a3116ac5c216fc3c145906a46df9ce542ff7dcf2 from 1st October ("tcp: Port
redirection support for TCP") broke DCCP skb lookup by changing inet_csk_clone,
which is used by DCCP to generate the child socket after the handshake.

This patch updates DCCP to use 'loc_port' instead of 'sport', which fixes the
problem, and thus inheriting port redirection support via the new interface.

Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
---
 net/dccp/ipv6.c      |    2 +-
 net/dccp/minisocks.c |    1 +
 net/dccp/output.c    |    2 +-
 3 files changed, 3 insertions(+), 2 deletions(-)

--- a/net/dccp/minisocks.c
+++ b/net/dccp/minisocks.c
@@ -309,6 +309,7 @@ void dccp_reqsk_init(struct request_sock
 	struct dccp_request_sock *dreq = dccp_rsk(req);
 
 	inet_rsk(req)->rmt_port	  = dccp_hdr(skb)->dccph_sport;
+	inet_rsk(req)->loc_port	  = dccp_hdr(skb)->dccph_dport;
 	inet_rsk(req)->acked	  = 0;
 	req->rcv_wnd		  = sysctl_dccp_feat_sequence_window;
 	dreq->dreq_timestamp_echo = 0;
--- a/net/dccp/ipv6.c
+++ b/net/dccp/ipv6.c
@@ -259,7 +259,7 @@ static int dccp_v6_send_response(struct 
 	fl.fl6_flowlabel = 0;
 	fl.oif = ireq6->iif;
 	fl.fl_ip_dport = inet_rsk(req)->rmt_port;
-	fl.fl_ip_sport = inet_sk(sk)->sport;
+	fl.fl_ip_sport = inet_rsk(req)->loc_port;
 	security_req_classify_flow(req, &fl);
 
 	opt = np->opt;
--- a/net/dccp/output.c
+++ b/net/dccp/output.c
@@ -347,7 +347,7 @@ struct sk_buff *dccp_make_response(struc
 	/* Build and checksum header */
 	dh = dccp_zeroed_hdr(skb, dccp_header_size);
 
-	dh->dccph_sport	= inet_sk(sk)->sport;
+	dh->dccph_sport	= inet_rsk(req)->loc_port;
 	dh->dccph_dport	= inet_rsk(req)->rmt_port;
 	dh->dccph_doff	= (dccp_header_size +
 			   DCCP_SKB_CB(skb)->dccpd_opt_len) / 4;
-- 

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

* Re: 2.6.27 [BUG-FIX] [PATCH 1/1] dccp: Port redirection support for DCCP
  2008-10-18  9:21 2.6.27 [BUG-FIX] [PATCH 1/1] dccp: Port redirection support for DCCP Gerrit Renker
@ 2008-10-18  9:48 ` KOVACS Krisztian
  2008-10-18 10:06   ` 2.6.27 [BUG-FIX] [PATCH 1/1] dccp: Port redirection support for?DCCP Gerrit Renker
  0 siblings, 1 reply; 6+ messages in thread
From: KOVACS Krisztian @ 2008-10-18  9:48 UTC (permalink / raw)
  To: Gerrit Renker; +Cc: David S. Miller, netdev

Hi,

On Saturday 18 October 2008, Gerrit Renker wrote:
> Commit a3116ac5c216fc3c145906a46df9ce542ff7dcf2 from 1st October ("tcp:
> Port redirection support for TCP") broke DCCP skb lookup by changing
> inet_csk_clone, which is used by DCCP to generate the child socket
> after the handshake.
>
> This patch updates DCCP to use 'loc_port' instead of 'sport', which
> fixes the problem, and thus inheriting port redirection support via the
> new interface.
>
> Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>

Yeah, Gerrit and me simultaneously found this to be the culprit.
One minor comment below.

> ---
>  net/dccp/ipv6.c      |    2 +-
>  net/dccp/minisocks.c |    1 +
>  net/dccp/output.c    |    2 +-
>  3 files changed, 3 insertions(+), 2 deletions(-)
>
> --- a/net/dccp/minisocks.c
> +++ b/net/dccp/minisocks.c
> @@ -309,6 +309,7 @@ void dccp_reqsk_init(struct request_sock
>  	struct dccp_request_sock *dreq = dccp_rsk(req);
>
>  	inet_rsk(req)->rmt_port	  = dccp_hdr(skb)->dccph_sport;
> +	inet_rsk(req)->loc_port	  = dccp_hdr(skb)->dccph_dport;
>  	inet_rsk(req)->acked	  = 0;
>  	req->rcv_wnd		  = sysctl_dccp_feat_sequence_window;
>  	dreq->dreq_timestamp_echo = 0;
> --- a/net/dccp/ipv6.c
> +++ b/net/dccp/ipv6.c
> @@ -259,7 +259,7 @@ static int dccp_v6_send_response(struct
>  	fl.fl6_flowlabel = 0;
>  	fl.oif = ireq6->iif;
>  	fl.fl_ip_dport = inet_rsk(req)->rmt_port;
> -	fl.fl_ip_sport = inet_sk(sk)->sport;
> +	fl.fl_ip_sport = inet_rsk(req)->loc_port;
>  	security_req_classify_flow(req, &fl);
>
>  	opt = np->opt;
> --- a/net/dccp/output.c
> +++ b/net/dccp/output.c
> @@ -347,7 +347,7 @@ struct sk_buff *dccp_make_response(struc
>  	/* Build and checksum header */
>  	dh = dccp_zeroed_hdr(skb, dccp_header_size);
>
> -	dh->dccph_sport	= inet_sk(sk)->sport;
> +	dh->dccph_sport	= inet_rsk(req)->loc_port;
>  	dh->dccph_dport	= inet_rsk(req)->rmt_port;
>  	dh->dccph_doff	= (dccp_header_size +
>  			   DCCP_SKB_CB(skb)->dccpd_opt_len) / 4;

I think we're still missing this one:

diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c
index 1106278..aa00cdd 100644
--- a/net/dccp/ipv6.c
+++ b/net/dccp/ipv6.c
@@ -558,7 +558,7 @@ static struct sock *dccp_v6_request_recv_sock(struct sock *sk,
 		ipv6_addr_copy(&fl.fl6_src, &ireq6->loc_addr);
 		fl.oif = sk->sk_bound_dev_if;
 		fl.fl_ip_dport = inet_rsk(req)->rmt_port;
-		fl.fl_ip_sport = inet_sk(sk)->sport;
+		fl.fl_ip_sport = inet_rsk(req)->loc_port;
 		security_sk_classify_flow(sk, &fl);
 
 		if (ip6_dst_lookup(sk, &dst, &fl))

What do you think?

-- 
KOVACS Krisztian

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

* Re: 2.6.27 [BUG-FIX] [PATCH 1/1] dccp: Port redirection support for?DCCP
  2008-10-18  9:48 ` KOVACS Krisztian
@ 2008-10-18 10:06   ` Gerrit Renker
  2008-10-18 10:21     ` 2.6.27 [BUG-FIX] [PATCH 1/1] dccp: Port redirection support for DCCP KOVACS Krisztian
  0 siblings, 1 reply; 6+ messages in thread
From: Gerrit Renker @ 2008-10-18 10:06 UTC (permalink / raw)
  To: KOVACS Krisztian; +Cc: David S. Miller, netdev

| I think we're still missing this one:
| 
| diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c
| index 1106278..aa00cdd 100644
| --- a/net/dccp/ipv6.c
| +++ b/net/dccp/ipv6.c
| @@ -558,7 +558,7 @@ static struct sock *dccp_v6_request_recv_sock(struct sock *sk,
|  		ipv6_addr_copy(&fl.fl6_src, &ireq6->loc_addr);
|  		fl.oif = sk->sk_bound_dev_if;
|  		fl.fl_ip_dport = inet_rsk(req)->rmt_port;
| -		fl.fl_ip_sport = inet_sk(sk)->sport;
| +		fl.fl_ip_sport = inet_rsk(req)->loc_port;
|  		security_sk_classify_flow(sk, &fl);
|  
|  		if (ip6_dst_lookup(sk, &dst, &fl))
| 
| What do you think?
Ack - missed this one. Do you want to send your patch or would you like
me to send an update for the above?

Thanks
Gerrit

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

* Re: 2.6.27 [BUG-FIX] [PATCH 1/1] dccp: Port redirection support for DCCP
  2008-10-18 10:06   ` 2.6.27 [BUG-FIX] [PATCH 1/1] dccp: Port redirection support for?DCCP Gerrit Renker
@ 2008-10-18 10:21     ` KOVACS Krisztian
  2008-10-18 15:25       ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 6+ messages in thread
From: KOVACS Krisztian @ 2008-10-18 10:21 UTC (permalink / raw)
  To: Gerrit Renker; +Cc: David S. Miller, netdev

Hi,

On Saturday 18 October 2008, Gerrit Renker wrote:
> | I think we're still missing this one:
> |
> | diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c
> | index 1106278..aa00cdd 100644
> | --- a/net/dccp/ipv6.c
> | +++ b/net/dccp/ipv6.c
> | @@ -558,7 +558,7 @@ static struct sock
> | *dccp_v6_request_recv_sock(struct sock *sk,
> | ipv6_addr_copy(&fl.fl6_src, &ireq6->loc_addr);
> |  		fl.oif = sk->sk_bound_dev_if;
> |  		fl.fl_ip_dport = inet_rsk(req)->rmt_port;
> | -		fl.fl_ip_sport = inet_sk(sk)->sport;
> | +		fl.fl_ip_sport = inet_rsk(req)->loc_port;
> |  		security_sk_classify_flow(sk, &fl);
> |
> |  		if (ip6_dst_lookup(sk, &dst, &fl))
> |
> | What do you think?
>
> Ack - missed this one. Do you want to send your patch or would you like
> me to send an update for the above?

Dave & Gerrit, please find the updated patch below.

- 8< -
dccp: Port redirection support for DCCP

Commit a3116ac5c216fc3c145906a46df9ce542ff7dcf2 from 1st October ("tcp: Port
redirection support for TCP") broke DCCP skb lookup by changing inet_csk_clone,
which is used by DCCP to generate the child socket after the handshake.

This patch updates DCCP to use 'loc_port' instead of 'sport', which fixes the
problem, and thus inheriting port redirection support via the new interface.

Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
Signed-off-by: KOVACS Krisztian <hidden@sch.bme.hu>
---
 net/dccp/ipv6.c      |    4 ++--
 net/dccp/minisocks.c |    1 +
 net/dccp/output.c    |    2 +-
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c
index 1106278..d4ce122 100644
--- a/net/dccp/ipv6.c
+++ b/net/dccp/ipv6.c
@@ -259,7 +259,7 @@ static int dccp_v6_send_response(struct sock *sk, struct request_sock *req)
 	fl.fl6_flowlabel = 0;
 	fl.oif = ireq6->iif;
 	fl.fl_ip_dport = inet_rsk(req)->rmt_port;
-	fl.fl_ip_sport = inet_sk(sk)->sport;
+	fl.fl_ip_sport = inet_rsk(req)->loc_port;
 	security_req_classify_flow(req, &fl);
 
 	opt = np->opt;
@@ -558,7 +558,7 @@ static struct sock *dccp_v6_request_recv_sock(struct sock *sk,
 		ipv6_addr_copy(&fl.fl6_src, &ireq6->loc_addr);
 		fl.oif = sk->sk_bound_dev_if;
 		fl.fl_ip_dport = inet_rsk(req)->rmt_port;
-		fl.fl_ip_sport = inet_sk(sk)->sport;
+		fl.fl_ip_sport = inet_rsk(req)->loc_port;
 		security_sk_classify_flow(sk, &fl);
 
 		if (ip6_dst_lookup(sk, &dst, &fl))
diff --git a/net/dccp/minisocks.c b/net/dccp/minisocks.c
index b2804e2..e6bf99e 100644
--- a/net/dccp/minisocks.c
+++ b/net/dccp/minisocks.c
@@ -309,6 +309,7 @@ void dccp_reqsk_init(struct request_sock *req, struct sk_buff *skb)
 	struct dccp_request_sock *dreq = dccp_rsk(req);
 
 	inet_rsk(req)->rmt_port	  = dccp_hdr(skb)->dccph_sport;
+	inet_rsk(req)->loc_port	  = dccp_hdr(skb)->dccph_dport;
 	inet_rsk(req)->acked	  = 0;
 	req->rcv_wnd		  = sysctl_dccp_feat_sequence_window;
 	dreq->dreq_timestamp_echo = 0;
diff --git a/net/dccp/output.c b/net/dccp/output.c
index d06945c..809d803 100644
--- a/net/dccp/output.c
+++ b/net/dccp/output.c
@@ -347,7 +347,7 @@ struct sk_buff *dccp_make_response(struct sock *sk, struct dst_entry *dst,
 	/* Build and checksum header */
 	dh = dccp_zeroed_hdr(skb, dccp_header_size);
 
-	dh->dccph_sport	= inet_sk(sk)->sport;
+	dh->dccph_sport	= inet_rsk(req)->loc_port;
 	dh->dccph_dport	= inet_rsk(req)->rmt_port;
 	dh->dccph_doff	= (dccp_header_size +
 			   DCCP_SKB_CB(skb)->dccpd_opt_len) / 4;
-- 
1.5.4.4

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

* Re: 2.6.27 [BUG-FIX] [PATCH 1/1] dccp: Port redirection support for DCCP
  2008-10-18 10:21     ` 2.6.27 [BUG-FIX] [PATCH 1/1] dccp: Port redirection support for DCCP KOVACS Krisztian
@ 2008-10-18 15:25       ` Arnaldo Carvalho de Melo
  2008-10-20  6:37         ` David Miller
  0 siblings, 1 reply; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2008-10-18 15:25 UTC (permalink / raw)
  To: KOVACS Krisztian; +Cc: Gerrit Renker, David S. Miller, netdev

Em Sat, Oct 18, 2008 at 12:21:58PM +0200, KOVACS Krisztian escreveu:
> Hi,
> 
> On Saturday 18 October 2008, Gerrit Renker wrote:
> > | I think we're still missing this one:
> > |
> > | diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c
> > | index 1106278..aa00cdd 100644
> > | --- a/net/dccp/ipv6.c
> > | +++ b/net/dccp/ipv6.c
> > | @@ -558,7 +558,7 @@ static struct sock
> > | *dccp_v6_request_recv_sock(struct sock *sk,
> > | ipv6_addr_copy(&fl.fl6_src, &ireq6->loc_addr);
> > |  		fl.oif = sk->sk_bound_dev_if;
> > |  		fl.fl_ip_dport = inet_rsk(req)->rmt_port;
> > | -		fl.fl_ip_sport = inet_sk(sk)->sport;
> > | +		fl.fl_ip_sport = inet_rsk(req)->loc_port;
> > |  		security_sk_classify_flow(sk, &fl);
> > |
> > |  		if (ip6_dst_lookup(sk, &dst, &fl))
> > |
> > | What do you think?
> >
> > Ack - missed this one. Do you want to send your patch or would you like
> > me to send an update for the above?
> 
> Dave & Gerrit, please find the updated patch below.
> 
> - 8< -
> dccp: Port redirection support for DCCP
> 
> Commit a3116ac5c216fc3c145906a46df9ce542ff7dcf2 from 1st October ("tcp: Port
> redirection support for TCP") broke DCCP skb lookup by changing inet_csk_clone,
> which is used by DCCP to generate the child socket after the handshake.
> 
> This patch updates DCCP to use 'loc_port' instead of 'sport', which fixes the
> problem, and thus inheriting port redirection support via the new interface.
> 
> Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
> Signed-off-by: KOVACS Krisztian <hidden@sch.bme.hu>

Good work! Better two fixes than none! :-)

Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com>

- Arnaldo 

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

* Re: 2.6.27 [BUG-FIX] [PATCH 1/1] dccp: Port redirection support for DCCP
  2008-10-18 15:25       ` Arnaldo Carvalho de Melo
@ 2008-10-20  6:37         ` David Miller
  0 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2008-10-20  6:37 UTC (permalink / raw)
  To: acme; +Cc: hidden, gerrit, netdev

From: Arnaldo Carvalho de Melo <acme@redhat.com>
Date: Sat, 18 Oct 2008 12:25:02 -0300

> Em Sat, Oct 18, 2008 at 12:21:58PM +0200, KOVACS Krisztian escreveu:
> > dccp: Port redirection support for DCCP
> > 
> > Commit a3116ac5c216fc3c145906a46df9ce542ff7dcf2 from 1st October ("tcp: Port
> > redirection support for TCP") broke DCCP skb lookup by changing inet_csk_clone,
> > which is used by DCCP to generate the child socket after the handshake.
> > 
> > This patch updates DCCP to use 'loc_port' instead of 'sport', which fixes the
> > problem, and thus inheriting port redirection support via the new interface.
> > 
> > Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
> > Signed-off-by: KOVACS Krisztian <hidden@sch.bme.hu>
> 
> Good work! Better two fixes than none! :-)
> 
> Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com>

Applied, thanks everyone.

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

end of thread, other threads:[~2008-10-20  6:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-18  9:21 2.6.27 [BUG-FIX] [PATCH 1/1] dccp: Port redirection support for DCCP Gerrit Renker
2008-10-18  9:48 ` KOVACS Krisztian
2008-10-18 10:06   ` 2.6.27 [BUG-FIX] [PATCH 1/1] dccp: Port redirection support for?DCCP Gerrit Renker
2008-10-18 10:21     ` 2.6.27 [BUG-FIX] [PATCH 1/1] dccp: Port redirection support for DCCP KOVACS Krisztian
2008-10-18 15:25       ` Arnaldo Carvalho de Melo
2008-10-20  6:37         ` David Miller

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).