netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] netfilter: don't scale the size of the window up twice
@ 2012-04-02  3:25 Changli Gao
  2012-04-04 15:08 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 4+ messages in thread
From: Changli Gao @ 2012-04-02  3:25 UTC (permalink / raw)
  To: Pablo Neira Ayuso
  Cc: Patrick McHardy, David S. Miller, netfilter-devel, netdev,
	Changli Gao

For a picked up connection, the window win is scaled twice: one is by the
initialization code, and the other is by the sender updating code.

I use the temporary variable swin instead of modifying the variable win.

Signed-off-by: Changli Gao <xiaosuo@gmail.com>
---
 net/netfilter/nf_conntrack_proto_tcp.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/netfilter/nf_conntrack_proto_tcp.c b/net/netfilter/nf_conntrack_proto_tcp.c
index 361eade..0d07a1d 100644
--- a/net/netfilter/nf_conntrack_proto_tcp.c
+++ b/net/netfilter/nf_conntrack_proto_tcp.c
@@ -584,8 +584,8 @@ static bool tcp_in_window(const struct nf_conn *ct,
 			 * Let's try to use the data from the packet.
 			 */
 			sender->td_end = end;
-			win <<= sender->td_scale;
-			sender->td_maxwin = (win == 0 ? 1 : win);
+			swin = win << sender->td_scale;
+			sender->td_maxwin = (swin == 0 ? 1 : swin);
 			sender->td_maxend = end + sender->td_maxwin;
 			/*
 			 * We haven't seen traffic in the other direction yet

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

* Re: [PATCH] netfilter: don't scale the size of the window up twice
  2012-04-02  3:25 [PATCH] netfilter: don't scale the size of the window up twice Changli Gao
@ 2012-04-04 15:08 ` Pablo Neira Ayuso
  2012-04-04 19:05   ` Jozsef Kadlecsik
  0 siblings, 1 reply; 4+ messages in thread
From: Pablo Neira Ayuso @ 2012-04-04 15:08 UTC (permalink / raw)
  To: Jozsef Kadlecsik
  Cc: Patrick McHardy, David S. Miller, netfilter-devel, netdev,
	Changli Gao

On Mon, Apr 02, 2012 at 11:25:06AM +0800, Changli Gao wrote:
> For a picked up connection, the window win is scaled twice: one is by the
> initialization code, and the other is by the sender updating code.
> 
> I use the temporary variable swin instead of modifying the variable win.
> 
> Signed-off-by: Changli Gao <xiaosuo@gmail.com>
> ---
>  net/netfilter/nf_conntrack_proto_tcp.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> diff --git a/net/netfilter/nf_conntrack_proto_tcp.c b/net/netfilter/nf_conntrack_proto_tcp.c
> index 361eade..0d07a1d 100644
> --- a/net/netfilter/nf_conntrack_proto_tcp.c
> +++ b/net/netfilter/nf_conntrack_proto_tcp.c
> @@ -584,8 +584,8 @@ static bool tcp_in_window(const struct nf_conn *ct,
>  			 * Let's try to use the data from the packet.
>  			 */
>  			sender->td_end = end;
> -			win <<= sender->td_scale;
> -			sender->td_maxwin = (win == 0 ? 1 : win);
> +			swin = win << sender->td_scale;
> +			sender->td_maxwin = (swin == 0 ? 1 : swin);
>  			sender->td_maxend = end + sender->td_maxwin;
>  			/*
>  			 * We haven't seen traffic in the other direction yet

Jozsef, do you remember if this is intentional?

I'm going to test this patch in my testbed to make sure this does not
break conntrackd.

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

* Re: [PATCH] netfilter: don't scale the size of the window up twice
  2012-04-04 15:08 ` Pablo Neira Ayuso
@ 2012-04-04 19:05   ` Jozsef Kadlecsik
  2012-04-10 12:35     ` Pablo Neira Ayuso
  0 siblings, 1 reply; 4+ messages in thread
From: Jozsef Kadlecsik @ 2012-04-04 19:05 UTC (permalink / raw)
  To: Pablo Neira Ayuso
  Cc: Patrick McHardy, David S. Miller, netfilter-devel, netdev,
	Changli Gao

On Wed, 4 Apr 2012, Pablo Neira Ayuso wrote:

> On Mon, Apr 02, 2012 at 11:25:06AM +0800, Changli Gao wrote:
> > For a picked up connection, the window win is scaled twice: one is by the
> > initialization code, and the other is by the sender updating code.
> > 
> > I use the temporary variable swin instead of modifying the variable win.
> > 
> > Signed-off-by: Changli Gao <xiaosuo@gmail.com>
> > ---
> >  net/netfilter/nf_conntrack_proto_tcp.c |    4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > diff --git a/net/netfilter/nf_conntrack_proto_tcp.c b/net/netfilter/nf_conntrack_proto_tcp.c
> > index 361eade..0d07a1d 100644
> > --- a/net/netfilter/nf_conntrack_proto_tcp.c
> > +++ b/net/netfilter/nf_conntrack_proto_tcp.c
> > @@ -584,8 +584,8 @@ static bool tcp_in_window(const struct nf_conn *ct,
> >  			 * Let's try to use the data from the packet.
> >  			 */
> >  			sender->td_end = end;
> > -			win <<= sender->td_scale;
> > -			sender->td_maxwin = (win == 0 ? 1 : win);
> > +			swin = win << sender->td_scale;
> > +			sender->td_maxwin = (swin == 0 ? 1 : swin);
> >  			sender->td_maxend = end + sender->td_maxwin;
> >  			/*
> >  			 * We haven't seen traffic in the other direction yet
> 
> Jozsef, do you remember if this is intentional?

No, it's a good spotting.

Acked-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>

> I'm going to test this patch in my testbed to make sure this does not
> break conntrackd.

A checking in a testbed doesn't hurt :-).

Best regards,
Jozsef
-
E-mail  : kadlec@blackhole.kfki.hu, kadlecsik.jozsef@wigner.mta.hu
PGP key : http://www.kfki.hu/~kadlec/pgp_public_key.txt
Address : Wigner Research Centre for Physics, Hungarian Academy of Sciences
          H-1525 Budapest 114, POB. 49, Hungary

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

* Re: [PATCH] netfilter: don't scale the size of the window up twice
  2012-04-04 19:05   ` Jozsef Kadlecsik
@ 2012-04-10 12:35     ` Pablo Neira Ayuso
  0 siblings, 0 replies; 4+ messages in thread
From: Pablo Neira Ayuso @ 2012-04-10 12:35 UTC (permalink / raw)
  To: Jozsef Kadlecsik
  Cc: Patrick McHardy, David S. Miller, netfilter-devel, netdev,
	Changli Gao

On Wed, Apr 04, 2012 at 09:05:26PM +0200, Jozsef Kadlecsik wrote:
> On Wed, 4 Apr 2012, Pablo Neira Ayuso wrote:
> 
> > On Mon, Apr 02, 2012 at 11:25:06AM +0800, Changli Gao wrote:
> > > For a picked up connection, the window win is scaled twice: one is by the
> > > initialization code, and the other is by the sender updating code.
> > > 
> > > I use the temporary variable swin instead of modifying the variable win.
> > > 
> > > Signed-off-by: Changli Gao <xiaosuo@gmail.com>
> > > ---
> > >  net/netfilter/nf_conntrack_proto_tcp.c |    4 ++--
> > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > > diff --git a/net/netfilter/nf_conntrack_proto_tcp.c b/net/netfilter/nf_conntrack_proto_tcp.c
> > > index 361eade..0d07a1d 100644
> > > --- a/net/netfilter/nf_conntrack_proto_tcp.c
> > > +++ b/net/netfilter/nf_conntrack_proto_tcp.c
> > > @@ -584,8 +584,8 @@ static bool tcp_in_window(const struct nf_conn *ct,
> > >  			 * Let's try to use the data from the packet.
> > >  			 */
> > >  			sender->td_end = end;
> > > -			win <<= sender->td_scale;
> > > -			sender->td_maxwin = (win == 0 ? 1 : win);
> > > +			swin = win << sender->td_scale;
> > > +			sender->td_maxwin = (swin == 0 ? 1 : swin);
> > >  			sender->td_maxend = end + sender->td_maxwin;
> > >  			/*
> > >  			 * We haven't seen traffic in the other direction yet
> > 
> > Jozsef, do you remember if this is intentional?
> 
> No, it's a good spotting.
> 
> Acked-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>

Applied, thanks.

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

end of thread, other threads:[~2012-04-10 12:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-02  3:25 [PATCH] netfilter: don't scale the size of the window up twice Changli Gao
2012-04-04 15:08 ` Pablo Neira Ayuso
2012-04-04 19:05   ` Jozsef Kadlecsik
2012-04-10 12:35     ` Pablo Neira Ayuso

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