* [PATCH] Fix RST handling in ip_conntrack_proto_tcp.c
@ 2004-12-31 16:38 Martin Josefsson
2005-01-01 14:59 ` Jozsef Kadlecsik
0 siblings, 1 reply; 5+ messages in thread
From: Martin Josefsson @ 2004-12-31 16:38 UTC (permalink / raw)
To: Jozsef Kadlecsik; +Cc: Netfilter-devel
[-- Attachment #1: Type: text/plain, Size: 1766 bytes --]
Hi Jozsef
Your latest patch contained a change to the RST handling.
The change was that an RST is ignored if the previous packet was an ACK.
This is happens all the time. I know it was intended as a fix for the
SYN - ACK probe - RST sequence but it breaks normal usage. The problem
is that connections that end with RST never get their state changed and
are left in ESTABLISHED state with a large timeout.
The patch below adds a check for
!test_bit(IPS_ASSURED_BIT, &conntrack->status) so your change will only
be active for unassured connections. Maybe you have a better idea for
how to fix both cases.
This patch has been tested by a user that reported the problem on irc
and it fixes the problem for him. I'm also running it on a machine with
lots of traffic and it fixes the problem for me as well.
Please make sure something that fixes the problem is submitted fairly
quickly.
<hint> A tcp-state/windowtracking testcase for nfsim would be great
</hint> :)
--- linux-2.6.10-rc3-bk14/net/ipv4/netfilter/ip_conntrack_proto_tcp.c.orig 2004-12-30 19:48:33.000000000 +0100
+++ linux-2.6.10-rc3-bk14/net/ipv4/netfilter/ip_conntrack_proto_tcp.c 2004-12-30 19:49:46.000000000 +0100
@@ -906,7 +906,8 @@ static int tcp_packet(struct ip_conntrac
if (index == TCP_RST_SET
&& ((test_bit(IPS_SEEN_REPLY_BIT, &conntrack->status)
&& conntrack->proto.tcp.last_index <= TCP_SYNACK_SET)
- || conntrack->proto.tcp.last_index == TCP_ACK_SET)
+ || (!test_bit(IPS_ASSURED_BIT, &conntrack->status)
+ && conntrack->proto.tcp.last_index == TCP_ACK_SET))
&& after(ntohl(th->ack_seq),
conntrack->proto.tcp.last_seq)) {
/* Ignore RST closing down invalid SYN or ACK
--
/Martin
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] Fix RST handling in ip_conntrack_proto_tcp.c
2004-12-31 16:38 [PATCH] Fix RST handling in ip_conntrack_proto_tcp.c Martin Josefsson
@ 2005-01-01 14:59 ` Jozsef Kadlecsik
2005-01-01 15:23 ` Martin Josefsson
0 siblings, 1 reply; 5+ messages in thread
From: Jozsef Kadlecsik @ 2005-01-01 14:59 UTC (permalink / raw)
To: Martin Josefsson; +Cc: Netfilter-devel
Hi Martin,
On Fri, 31 Dec 2004, Martin Josefsson wrote:
> Your latest patch contained a change to the RST handling.
> The change was that an RST is ignored if the previous packet was an ACK.
> This is happens all the time. I know it was intended as a fix for the
> SYN - ACK probe - RST sequence but it breaks normal usage. The problem
> is that connections that end with RST never get their state changed and
> are left in ESTABLISHED state with a large timeout.
Ouch!
> The patch below adds a check for
> !test_bit(IPS_ASSURED_BIT, &conntrack->status) so your change will only
> be active for unassured connections. Maybe you have a better idea for
> how to fix both cases.
>
> This patch has been tested by a user that reported the problem on irc
> and it fixes the problem for him. I'm also running it on a machine with
> lots of traffic and it fixes the problem for me as well.
>
> Please make sure something that fixes the problem is submitted fairly
> quickly.
I think your patch should be submitted immediately. The introduced bug is
too bad to leave it linger on.
> <hint> A tcp-state/windowtracking testcase for nfsim would be great
> </hint> :)
Yep, I got Rusty's message as well :-) Time to dig out the initial tests
from the old cvs and convert them to nfsim with new cases added.
> --- linux-2.6.10-rc3-bk14/net/ipv4/netfilter/ip_conntrack_proto_tcp.c.orig 2004-12-30 19:48:33.000000000 +0100
> +++ linux-2.6.10-rc3-bk14/net/ipv4/netfilter/ip_conntrack_proto_tcp.c 2004-12-30 19:49:46.000000000 +0100
> @@ -906,7 +906,8 @@ static int tcp_packet(struct ip_conntrac
> if (index == TCP_RST_SET
> && ((test_bit(IPS_SEEN_REPLY_BIT, &conntrack->status)
> && conntrack->proto.tcp.last_index <= TCP_SYNACK_SET)
> - || conntrack->proto.tcp.last_index == TCP_ACK_SET)
> + || (!test_bit(IPS_ASSURED_BIT, &conntrack->status)
> + && conntrack->proto.tcp.last_index == TCP_ACK_SET))
> && after(ntohl(th->ack_seq),
> conntrack->proto.tcp.last_seq)) {
> /* Ignore RST closing down invalid SYN or ACK
>
Best regards,
Jozsef
-
E-mail : kadlec@blackhole.kfki.hu, kadlec@sunserv.kfki.hu
PGP key : http://www.kfki.hu/~kadlec/pgp_public_key.txt
Address : KFKI Research Institute for Particle and Nuclear Physics
H-1525 Budapest 114, POB. 49, Hungary
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] Fix RST handling in ip_conntrack_proto_tcp.c
2005-01-01 14:59 ` Jozsef Kadlecsik
@ 2005-01-01 15:23 ` Martin Josefsson
2005-01-02 23:21 ` Patrick McHardy
0 siblings, 1 reply; 5+ messages in thread
From: Martin Josefsson @ 2005-01-01 15:23 UTC (permalink / raw)
To: Jozsef Kadlecsik; +Cc: Netfilter-devel
[-- Attachment #1: Type: text/plain, Size: 691 bytes --]
On Sat, 2005-01-01 at 15:59 +0100, Jozsef Kadlecsik wrote:
> Hi Martin,
Hi Jozsef
> Ouch!
I agree :)
> > Please make sure something that fixes the problem is submitted fairly
> > quickly.
>
> I think your patch should be submitted immediately. The introduced bug is
> too bad to leave it linger on.
I'll submit it to Andrew since Davem is on vacation.
> > <hint> A tcp-state/windowtracking testcase for nfsim would be great
> > </hint> :)
>
> Yep, I got Rusty's message as well :-) Time to dig out the initial tests
> from the old cvs and convert them to nfsim with new cases added.
:) We need more testcases badly, for all sorts of things.
--
/Martin
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Fix RST handling in ip_conntrack_proto_tcp.c
2005-01-01 15:23 ` Martin Josefsson
@ 2005-01-02 23:21 ` Patrick McHardy
2005-01-02 23:22 ` Martin Josefsson
0 siblings, 1 reply; 5+ messages in thread
From: Patrick McHardy @ 2005-01-02 23:21 UTC (permalink / raw)
To: Martin Josefsson; +Cc: Netfilter-devel, Jozsef Kadlecsik
Martin Josefsson wrote:
>On Sat, 2005-01-01 at 15:59 +0100, Jozsef Kadlecsik wrote:
>
>>I think your patch should be submitted immediately. The introduced bug is
>>too bad to leave it linger on.
>>
>
>I'll submit it to Andrew since Davem is on vacation.
>
The patch hasn't shown up in Linus's tree yet. I'm going to add it to
my tree and push it to Dave with the other patches if it didn't show up
by Tuesday.
Regards
Patrick
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2005-01-02 23:22 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-12-31 16:38 [PATCH] Fix RST handling in ip_conntrack_proto_tcp.c Martin Josefsson
2005-01-01 14:59 ` Jozsef Kadlecsik
2005-01-01 15:23 ` Martin Josefsson
2005-01-02 23:21 ` Patrick McHardy
2005-01-02 23:22 ` Martin Josefsson
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.