Skip to contentSkip to conversation

Fix broken RST handling in ip_conntrack

PATCH New Martin Josefsson 1 participant 1 message Jan 1, 2005

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix broken RST handling in ip_conntrack

Hi Linus, Andrew
(Sending this mail to you since Davem is on vacation)

Here's a patch that fixes a pretty serious bug introduced by a recent "bugfix". The problem is that RST packets are ignored if they follow an ACK packet, this means that the timeout of the connection isn't decreased, so we get lots of old connections lingering around until the timeout expires, the default timeout for state ESTABLISHED is 5 days.

This needs to go into -bk as soon as possible. The bug is present in 2.6.10 as well.

net/ipv4/netfilter/ip_conntrack_proto_tcp.c renamed from net/ipv4/netfilter/ip_conntrack_proto_tcp.c.orig +2 -1
@@ -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
Signature · 1 line
/Martin