Skip to contentSkip to conversation

improvement for TCP connection tracking

PATCH New Pablo Neira Ayuso 5 participants 12 messages Feb 26, 2011 – Feb 28, 2011

Subsystems (2)
lore
Share & tools
lore

Pablo Neira Ayuso

author maintainer
#0 lore raw

PATCH 1/1 improvement for TCP connection tracking

Hi Patrick, Jozsef,

I've been testing the following patch in my HA firewall setup with success. This patch provides better recovery in stress scenarios.

Please, if you're OK with it, pass to it 2.6.38.

---

Pablo Neira Ayuso (1):
netfilter: nf_ct_tcp: better handling for SYN retransmissions after SYN+ACK

 net/netfilter/nf_conntrack_proto_tcp.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
author maintainer
#1 lore raw

PATCH 1/1 netfilter: nf_ct_tcp: better handling for SYN retransmissions after SYN+ACK

Consider the following scenario:

client firewall server

     |              |             |
     |     syn      |     syn     |
     |------------->|------------>|
     |              |             |
     |   syn+ack    |   syn+ack   |
     |      x<------|<------------|      syn+ack got lost!
     |              |             |
     |     syn      |     syn     |
     |------------->|------------>|
     |              |             |
     |   syn+ack    |   syn+ack   |
     |<-------------|<------------|
     |              |             |

Note that the syn+ack is lost after we have seen it. Without this patch, the TCP tracking ignores the retransmitted SYN without checking if the sequence number is in the window.

This patch also helps a lot to conntrackd in stress scenarios (assumming a client that generates lots of small TCP connections). During the failover, consider that the new primary has injected one outdated flow in SYN_RECV state (this is likely to happen if the conntrack event rate is high because the backup will be a bit delayed from the primary). With the current code, if the client starts a new fresh connection that matches the tuple, the SYN packet will be ignored without updating the state tracking, and the SYN+ACK in reply will blocked as it will not pass checkings III or IV (since all state tracking in the original direction is not initialized because of the SYN packet was ignored).

---
 net/netfilter/nf_conntrack_proto_tcp.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
net/netfilter/nf_conntrack_proto_tcp.c +2 -2
index 3fb2b73..be0b84d 100644
@@ -142,12 +142,12 @@ static const u8 tcp_conntracks[2][6][TCP_CONNTRACK_MAX] = {
 	{
 /* ORIGINAL */
 /* 	     sNO, sSS, sSR, sES, sFW, sCW, sLA, sTW, sCL, sS2	*/
-/*syn*/	   { sSS, sSS, sIG, sIG, sIG, sIG, sIG, sSS, sSS, sS2 },
+/*syn*/	   { sSS, sSS, sSR, sIG, sIG, sIG, sIG, sSS, sSS, sS2 },
 /*
  *	sNO -> sSS	Initialize a new connection
  *	sSS -> sSS	Retransmitted SYN
  *	sS2 -> sS2	Late retransmitted SYN
- *	sSR -> sIG
+ *	sSR -> sSR	Retransmitted SYN, SYN/ACK got lost?
  *	sES -> sIG	Error: SYNs in window outside the SYN_SENT state
  *			are errors. Receiver will reply with RST
  *			and close the connection.
#2 lore raw

Re: [PATCH] netfilter: nf_ct_tcp: better handling for SYN retransmissions after SYN+ACK

Quoted 13 lines · Pablo Neira Ayuso

 net/netfilter/nf_conntrack_proto_tcp.c |    4 ++--

 1 files changed, 2 insertions(+), 2 deletions(-)
net/netfilter/nf_conntrack_proto_tcp.c +0 -1
index 3fb2b73..be0b84d 100644
@@ -142,12 +142,12 @@ static const u8 tcp_conntracks[2][6][TCP_CONNTRACK_MAX] = {
        {
  /* ORIGINAL */
  /*          sNO, sSS, sSR, sES, sFW, sCW, sLA, sTW, sCL, sS2   */
-/*syn*/           { sSS, sSS, sIG, sIG, sIG, sIG, sIG, sSS, sSS, sS2 },

net/netfilter/nf_conntrack_proto_tcp.c static const u8 tcp_conntracks[2][6][TCP_CONNTRACK_MAX] = { · line 153

Quoted 10 lines
net/netfilter/nf_conntrack_proto_tcp.c +2 -1
+/*syn*/           { sSS, sSS, sSR, sIG, sIG, sIG, sIG, sSS, sSS, sS2 },
  /*
  *     sNO -> sSS      Initialize a new connection
  *     sSS -> sSS      Retransmitted SYN
  *     sS2 -> sS2      Late retransmitted SYN
- *     sSR -> sIG
+ *     sSR -> sSR      Retransmitted SYN, SYN/ACK got lost?
  *     sES -> sIG      Error: SYNs in window outside the SYN_SENT state
  *                     are errors. Receiver will reply with RST
  *                     and close the connection.

I think you should change [reply][eSR][syn_ack] to ignore. Then the following code will be executed, and in fact, the following code is for you scenario according to the comments.

878 case TCP_CONNTRACK_IGNORE:
879 /* Ignored packets:

 880                  *
 881                  * Our connection entry may be out of sync, so ignore
 882                  * packets which may signal the real connection between
 883                  * the client and the server.
 884                  *
 885                  * a) SYN in ORIGINAL
 886                  * b) SYN/ACK in REPLY
 887                  * c) ACK in reply direction after initial SYN in original.
 888                  *
 889                  * If the ignored packet is invalid, the receiver will send
 890                  * a RST we'll catch below.
 891                  */
 892                 if (index == TCP_SYNACK_SET
 893                     && ct->proto.tcp.last_index == TCP_SYN_SET
 894                     && ct->proto.tcp.last_dir != dir
 895                     && ntohl(th->ack_seq) == ct->proto.tcp.last_end) {

896 /* b) This SYN/ACK acknowledges a SYN
that we earlier
897 * ignored as invalid. This means that
the client and
898 * the server are both in sync, while the
firewall is
899 * not. We get in sync from the
previously annotated
900 * values.
901 */

 902                         old_state = TCP_CONNTRACK_SYN_SENT;
 903                         new_state = TCP_CONNTRACK_SYN_RECV;
 904                         ct->proto.tcp.seen[ct->proto.tcp.last_dir].td_end =

905 ct->proto.tcp.last_end;
906
ct->proto.tcp.seen[ct->proto.tcp.last_dir].td_maxend =
907 ct->proto.tcp.last_end;
908
ct->proto.tcp.seen[ct->proto.tcp.last_dir].td_maxwin =
909 ct->proto.tcp.last_win == 0 ?
910 1 : ct->proto.tcp.last_win;
911
ct->proto.tcp.seen[ct->proto.tcp.last_dir].td_scale =
912 ct->proto.tcp.last_wscale;
913 ct->proto.tcp.seen[ct->proto.tcp.last_dir].flags =
914 ct->proto.tcp.last_flags;
915 memset(&ct->proto.tcp.seen[dir], 0,
916 sizeof(struct ip_ct_tcp_state));
917 break;
918 }

Signature · 6 lines
Regards,
Changli Gao([email protected])
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#3 lore raw

Re: [PATCH] netfilter: nf_ct_tcp: better handling for SYN retransmissions after SYN+ACK

In reply to Pablo Neira Ayuso

Hi Pablo,

Quoted 17 lines · Pablo Neira Ayuso

Consider the following scenario:

client firewall server

     |              |             |
     |     syn      |     syn     |
     |------------->|------------>|
     |              |             |
     |   syn+ack    |   syn+ack   |
     |      x<------|<------------|      syn+ack got lost!
     |              |             |
     |     syn      |     syn     |
     |------------->|------------>|
     |              |             |
     |   syn+ack    |   syn+ack   |
     |<-------------|<------------|
     |              |             |
Quoted 3 lines

Note that the syn+ack is lost after we have seen it. Without this patch, the TCP tracking ignores the retransmitted SYN without checking if the sequence number is in the window.

Maybe I'm just blind, but I don't see what you try to achieve. Actually, with your patch you switch off the path which would handle the case when conntrack holds an outdated entry from whatever reason.

Present code, cases:

a. conntrack in sync, SYN/ACK lost and client resends the SYN
- we ignore it but it does not do any harm
b. conntrack entry is outdated, new SYN received
- we ignore it but save the initialization data from it
- when the reply SYN/ACK receives and it matches the saved data, we pick up the new connection

With your patch, cases:

a. conntrack in sync, SYN/ACK lost and client resends the SYN
- SYN is out of window and will be marked as invalid
b. conntrack entry is outdated, new SYN received
- SYN is out of window and will be marked as invalid

What do I miss?

Quoted 11 lines

This patch also helps a lot to conntrackd in stress scenarios (assumming a client that generates lots of small TCP connections). During the failover, consider that the new primary has injected one outdated flow in SYN_RECV state (this is likely to happen if the conntrack event rate is high because the backup will be a bit delayed from the primary). With the current code, if the client starts a new fresh connection that matches the tuple, the SYN packet will be ignored without updating the state tracking, and the SYN+ACK in reply will blocked as it will not pass checkings III or IV (since all state tracking in the original direction is not initialized because of the SYN packet was ignored).

The last_dir entries are updated from the ignored SYN packet and thus the SYN+ACK won't be blocked - if the packet is a true answer to the SYN.

Quoted 16 lines
---
 net/netfilter/nf_conntrack_proto_tcp.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
net/netfilter/nf_conntrack_proto_tcp.c +0 -1
index 3fb2b73..be0b84d 100644
@@ -142,12 +142,12 @@ static const u8 tcp_conntracks[2][6][TCP_CONNTRACK_MAX] = {
 	{
 /* ORIGINAL */
 /* 	     sNO, sSS, sSR, sES, sFW, sCW, sLA, sTW, sCL, sS2	*/
-/*syn*/	   { sSS, sSS, sIG, sIG, sIG, sIG, sIG, sSS, sSS, sS2 },

net/netfilter/nf_conntrack_proto_tcp.c static const u8 tcp_conntracks[2][6][TCP_CONNTRACK_MAX] = { · line 153

Quoted 10 lines
net/netfilter/nf_conntrack_proto_tcp.c +2 -1
+/*syn*/	   { sSS, sSS, sSR, sIG, sIG, sIG, sIG, sSS, sSS, sS2 },
 /*
  *	sNO -> sSS	Initialize a new connection
  *	sSS -> sSS	Retransmitted SYN
  *	sS2 -> sS2	Late retransmitted SYN
- *	sSR -> sIG
+ *	sSR -> sSR	Retransmitted SYN, SYN/ACK got lost?
  *	sES -> sIG	Error: SYNs in window outside the SYN_SENT state
  *			are errors. Receiver will reply with RST
  *			and close the connection.

Bes regards,
Jozsef
-
E-mail : [email protected], [email protected] 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
author maintainer
#4 lore raw

Re: [PATCH] netfilter: nf_ct_tcp: better handling for SYN retransmissions after SYN+ACK

Hi Jozsef,

Quoted 4 lines · Jozsef Kadlecsik

Maybe I'm just blind, but I don't see what you try to achieve. Actually, with your patch you switch off the path which would handle the case when conntrack holds an outdated entry from whatever reason.

Quoted 8 lines

Present code, cases:

a. conntrack in sync, SYN/ACK lost and client resends the SYN
- we ignore it but it does not do any harm
b. conntrack entry is outdated, new SYN received
- we ignore it but save the initialization data from it
- when the reply SYN/ACK receives and it matches the saved data, we pick up the new connection

This is what it seems at first sight, but this is not what it happens if the conntrack is in SYN_RECV state.

Initially, the SYN packet hits first item of 'b', thus we save data from it. But the SYN/ACK packet is considered a retransmission given that we're in SYN_RECV state. Therefore, we never hit the second item of 'b'.

Quoted 6 lines

With your patch, cases:

a. conntrack in sync, SYN/ACK lost and client resends the SYN
- SYN is out of window and will be marked as invalid
b. conntrack entry is outdated, new SYN received
- SYN is out of window and will be marked as invalid

Damn, you're right, this patch is broken, that SYN packet won't pass boundary III, IIRC.

Quoted 1 line

What do I miss?

That we're in SYN_RECV state :-).

Quoted 12 lines
Quoted 11 lines

This patch also helps a lot to conntrackd in stress scenarios (assumming a client that generates lots of small TCP connections). During the failover, consider that the new primary has injected one outdated flow in SYN_RECV state (this is likely to happen if the conntrack event rate is high because the backup will be a bit delayed from the primary). With the current code, if the client starts a new fresh connection that matches the tuple, the SYN packet will be ignored without updating the state tracking, and the SYN+ACK in reply will blocked as it will not pass checkings III or IV (since all state tracking in the original direction is not initialized because of the SYN packet was ignored).

Quoted 2 lines

The last_dir entries are updated from the ignored SYN packet and thus the SYN+ACK won't be blocked - if the packet is a true answer to the SYN.

This is what it happens with other states, but not for SYN_RECV.

I have reworked the patch and the description. With this, the SYN_RECV state if we're out of sync receives the same handling.

I have test it here, it works fine. Let me know if you're OK with it.

netfilter: nf_ct_tcp: fix out of sync scenario while in SYN_RECV

From: Pablo Neira Ayuso <[email protected]>

This patch fixes the out of sync scenarios while in SYN_RECV state.

Quoting Jozsef, what it happens if we are out of sync if the following:

Quoted 4 lines

b. conntrack entry is outdated, new SYN received
- (b1) we ignore it but save the initialization data from it
- (b2) when the reply SYN/ACK receives and it matches the saved data, we pick up the new connection

This is what it should happen if we are in SYN_RECV state. Initially, the SYN packet hits b1, thus we save data from it. But the SYN/ACK packet is considered a retransmission given that we're in SYN_RECV state. Therefore, we never hit b2 and we don't get in sync. To fix this, we check if we were already in SYN_RECV and the previous packet was a SYN. In that case, we enter the ignore case that get us in sync.

This patch helps a lot to conntrackd in stress scenarios (assumming a client that generates lots of small TCP connections). During the failover, consider that the new primary has injected one outdated flow in SYN_RECV state (this is likely to happen if the conntrack event rate is high because the backup will be a bit delayed from the primary). With the current code, if the client starts a new fresh connection that matches the tuple, the SYN packet will be ignored without updating the state tracking, and the SYN+ACK in reply will blocked as it will not pass checkings III or IV (since all state tracking in the original direction is not initialized because of the SYN packet was ignored and the ignore case that get us in sync is not applied).

---
 net/netfilter/nf_conntrack_proto_tcp.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
net/netfilter/nf_conntrack_proto_tcp.c +15 -0
index 3fb2b73..baa9450 100644
@@ -842,6 +842,20 @@ static int tcp_packet(struct nf_conn *ct,
 	tuple = &ct->tuplehash[dir].tuple;
 
 	switch (new_state) {
+	case TCP_CONNTRACK_SYN_RECV:
+		/* Special case: we were in SYN_RECV state but we are out of
+		 * sync. We have previously seen a SYN packet in the original
+		 * direction which has been ignored, now we see the SYN/ACK
+		 * packet but the TCP state transition considers that this is
+		 * a retransmission. However, this is not. Jump to the code
+		 * that get us in sync. */
+		if (old_state == TCP_CONNTRACK_SYN_RECV &&
+		    index == TCP_SYNACK_SET &&
+		    ct->proto.tcp.last_index == TCP_SYN_SET &&
+		    ct->proto.tcp.last_dir != dir &&
+		    ntohl(th->ack_seq) == ct->proto.tcp.last_end)
+			goto syn_recv_out_of_sync;
+		break;
 	case TCP_CONNTRACK_SYN_SENT:
 		if (old_state < TCP_CONNTRACK_TIME_WAIT)
 			break;
@@ -899,6 +913,7 @@ static int tcp_packet(struct nf_conn *ct,
 			 * not. We get in sync from the previously annotated
 			 * values.
 			 */
+syn_recv_out_of_sync:
 			old_state = TCP_CONNTRACK_SYN_SENT;
 			new_state = TCP_CONNTRACK_SYN_RECV;
 			ct->proto.tcp.seen[ct->proto.tcp.last_dir].td_end =
#5 lore raw

Re: [PATCH] netfilter: nf_ct_tcp: better handling for SYN retransmissions after SYN+ACK

Hi Pablo,

Quoted 14 lines · Pablo Neira Ayuso
Quoted 4 lines · Jozsef Kadlecsik

Maybe I'm just blind, but I don't see what you try to achieve. Actually, with your patch you switch off the path which would handle the case when conntrack holds an outdated entry from whatever reason.

Quoted 8 lines

Present code, cases:

a. conntrack in sync, SYN/ACK lost and client resends the SYN
- we ignore it but it does not do any harm
b. conntrack entry is outdated, new SYN received
- we ignore it but save the initialization data from it
- when the reply SYN/ACK receives and it matches the saved data, we pick up the new connection

Quoted 6 lines

This is what it seems at first sight, but this is not what it happens if the conntrack is in SYN_RECV state.

Initially, the SYN packet hits first item of 'b', thus we save data from it. But the SYN/ACK packet is considered a retransmission given that we're in SYN_RECV state. Therefore, we never hit the second item of 'b'.

Yes, you're right! We don't hit 'b' in the SYN_RECV state.

Quoted 29 lines
Quoted 6 lines

With your patch, cases:

a. conntrack in sync, SYN/ACK lost and client resends the SYN
- SYN is out of window and will be marked as invalid
b. conntrack entry is outdated, new SYN received
- SYN is out of window and will be marked as invalid

Damn, you're right, this patch is broken, that SYN packet won't pass boundary III, IIRC.

Quoted 1 line

What do I miss?

That we're in SYN_RECV state :-).

Quoted 12 lines
Quoted 11 lines

This patch also helps a lot to conntrackd in stress scenarios (assumming a client that generates lots of small TCP connections). During the failover, consider that the new primary has injected one outdated flow in SYN_RECV state (this is likely to happen if the conntrack event rate is high because the backup will be a bit delayed from the primary). With the current code, if the client starts a new fresh connection that matches the tuple, the SYN packet will be ignored without updating the state tracking, and the SYN+ACK in reply will blocked as it will not pass checkings III or IV (since all state tracking in the original direction is not initialized because of the SYN packet was ignored).

Quoted 2 lines

The last_dir entries are updated from the ignored SYN packet and thus the SYN+ACK won't be blocked - if the packet is a true answer to the SYN.

Quoted 6 lines

This is what it happens with other states, but not for SYN_RECV.

I have reworked the patch and the description. With this, the SYN_RECV state if we're out of sync receives the same handling.

I have test it here, it works fine. Let me know if you're OK with it.

The patch looks OK but I think Changli Gao is also right and it'd be simpler to set the [reply][synack][SR] state to sIG. What do you think?

Best regards,
Jozsef
-
E-mail : [email protected], [email protected] 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
author maintainer
#6 lore raw

Re: [PATCH] netfilter: nf_ct_tcp: better handling for SYN retransmissions after SYN+ACK

Quoted 5 lines · Jozsef Kadlecsik
Quoted 1 line · Pablo Neira Ayuso

I have test it here, it works fine. Let me know if you're OK with it.

The patch looks OK but I think Changli Gao is also right and it'd be simpler to set the [reply][synack][SR] state to sIG. What do you think?

I read his email before leaving and after I made the new patch.

Indeed, his idea is simpler, here's a new patch. I tested it here, it works fine.

Patrick, please apply!

net/netfilter/nf_conntrack_proto_tcp.c +2 -2
Index: linux-2.6.37/net/netfilter/nf_conntrack_proto_tcp.c
===================================================================
@@ -227,11 +227,11 @@
  *	sCL -> sIV
  */
 /* 	     sNO, sSS, sSR, sES, sFW, sCW, sLA, sTW, sCL, sS2	*/
-/*synack*/ { sIV, sSR, sSR, sIG, sIG, sIG, sIG, sIG, sIG, sSR },
+/*synack*/ { sIV, sSR, sIG, sIG, sIG, sIG, sIG, sIG, sIG, sSR },
 /*
  *	sSS -> sSR	Standard open.
  *	sS2 -> sSR	Simultaneous open
- *	sSR -> sSR	Retransmitted SYN/ACK.
+ *	sSR -> sIG	Retransmitted SYN/ACK, ignore it.
  *	sES -> sIG	Late retransmitted SYN/ACK?
  *	sFW -> sIG	Might be SYN/ACK answering ignored SYN
  *	sCW -> sIG
author maintainer
#7 lore raw

Re: [PATCH] netfilter: nf_ct_tcp: better handling for SYN retransmissions after SYN+ACK

Quoted 7 lines · Pablo Neira Ayuso
Quoted 5 lines · Jozsef Kadlecsik
Quoted 1 line · Pablo Neira Ayuso

I have test it here, it works fine. Let me know if you're OK with it.

The patch looks OK but I think Changli Gao is also right and it'd be simpler to set the [reply][synack][SR] state to sIG. What do you think?

Quoted 6 lines

I read his email before leaving and after I made the new patch.

Indeed, his idea is simpler, here's a new patch. I tested it here, it works fine.

Patrick, please apply!

Hm, I forgot to include the description. New patch attached.

netfilter: nf_ct_tcp: fix out of sync scenario while in SYN_RECV

From: Pablo Neira Ayuso <[email protected]>

This patch fixes the out of sync scenarios while in SYN_RECV state.

Quoting Jozsef, what it happens if we are out of sync if the following:

Quoted 4 lines

b. conntrack entry is outdated, new SYN received
- (b1) we ignore it but save the initialization data from it
- (b2) when the reply SYN/ACK receives and it matches the saved data, we pick up the new connection

This is what it should happen if we are in SYN_RECV state. Initially, the SYN packet hits b1, thus we save data from it. But the SYN/ACK packet is considered a retransmission given that we're in SYN_RECV state. Therefore, we never hit b2 and we don't get in sync. To fix this, we ignore SYN/ACK if we are in SYN_RECV. If the previous packet was a SYN, then we enter the ignore case that get us in sync.

This patch helps a lot to conntrackd in stress scenarios (assumming a client that generates lots of small TCP connections). During the failover, consider that the new primary has injected one outdated flow in SYN_RECV state (this is likely to happen if the conntrack event rate is high because the backup will be a bit delayed from the primary). With the current code, if the client starts a new fresh connection that matches the tuple, the SYN packet will be ignored without updating the state tracking, and the SYN+ACK in reply will blocked as it will not pass checkings III or IV (since all state tracking in the original direction is not initialized because of the SYN packet was ignored and the ignore case that get us in sync is not applied).

I posted a couple of patches before this one. Changli Gao spotted a simpler way to fix this problem. This patch implements his idea.

Cc Changli Gao <[email protected]>
Cc Jozsef Kadlecsik <[email protected]>
---
 net/netfilter/nf_conntrack_proto_tcp.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
net/netfilter/nf_conntrack_proto_tcp.c +2 -2
index 3fb2b73..19bbab7 100644
@@ -227,11 +227,11 @@ static const u8 tcp_conntracks[2][6][TCP_CONNTRACK_MAX] = {
  *	sCL -> sIV
  */
 /* 	     sNO, sSS, sSR, sES, sFW, sCW, sLA, sTW, sCL, sS2	*/
-/*synack*/ { sIV, sSR, sSR, sIG, sIG, sIG, sIG, sIG, sIG, sSR },
+/*synack*/ { sIV, sSR, sIG, sIG, sIG, sIG, sIG, sIG, sIG, sSR },
 /*
  *	sSS -> sSR	Standard open.
  *	sS2 -> sSR	Simultaneous open
- *	sSR -> sSR	Retransmitted SYN/ACK.
+ *	sSR -> sIG	Retransmitted SYN/ACK, ignore it.
  *	sES -> sIG	Late retransmitted SYN/ACK?
  *	sFW -> sIG	Might be SYN/ACK answering ignored SYN
  *	sCW -> sIG
#8 lore raw

Re: [PATCH] netfilter: nf_ct_tcp: better handling for SYN retransmissions after SYN+ACK

It's a bit off-topic, but can it be recommended to hack into nf_ct_tcp somehow changing it's structure to assign each connection unique id and pass it with each retransmission event detected to nfqueue - without setting too complicated skbuffs / iptables rules? Or this is considered as dirty hacking and should be implemented other way?

Reasons to do this: currently, trying to set up a small NFQUEUE-based program that will modify data in TCP streams, that causes retransmissions due to changed size thus requires SEQ/ACK tuning (and as far as I suspect, something deeper than a filter table affects the idea, but it's the separate question) and the network-caused retransmissions are a bit of pain to track.

Quoted 9 lines · Pablo Neira Ayuso
Quoted 7 lines · Pablo Neira Ayuso
Quoted 5 lines · Jozsef Kadlecsik
Quoted 1 line · Pablo Neira Ayuso

I have test it here, it works fine. Let me know if you're OK with it.

The patch looks OK but I think Changli Gao is also right and it'd be simpler to set the [reply][synack][SR] state to sIG. What do you think?

Quoted 8 lines
Quoted 6 lines

I read his email before leaving and after I made the new patch.

Indeed, his idea is simpler, here's a new patch. I tested it here, it works fine.

Patrick, please apply!

Hm, I forgot to include the description. New patch attached.

--
С уважением,
Игорь
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#9 lore raw

Re: [PATCH] netfilter: nf_ct_tcp: better handling for SYN retransmissions after SYN+ACK

In reply to Pablo Neira Ayuso
Quoted 8 lines · Pablo Neira Ayuso
Quoted 7 lines · Pablo Neira Ayuso
Quoted 5 lines · Jozsef Kadlecsik
Quoted 1 line · Pablo Neira Ayuso

I have test it here, it works fine. Let me know if you're OK with it.

The patch looks OK but I think Changli Gao is also right and it'd be simpler to set the [reply][synack][SR] state to sIG. What do you think?

Quoted 8 lines
Quoted 6 lines

I read his email before leaving and after I made the new patch.

Indeed, his idea is simpler, here's a new patch. I tested it here, it works fine.

Patrick, please apply!

Hm, I forgot to include the description. New patch attached.

Thanks. I'll apply this tommorrow, assuming Jozsef is fine with this version.

#10 lore raw

Re: [PATCH] netfilter: nf_ct_tcp: better handling for SYN retransmissions after SYN+ACK

Quoted 14 lines · Patrick McHardy
Quoted 13 lines · Pablo Neira Ayuso
Quoted 12 lines · Pablo Neira Ayuso
Quoted 5 lines · Jozsef Kadlecsik
Quoted 1 line · Pablo Neira Ayuso

I have test it here, it works fine. Let me know if you're OK with it.

The patch looks OK but I think Changli Gao is also right and it'd be simpler to set the [reply][synack][SR] state to sIG. What do you think?

I read his email before leaving and after I made the new patch.

Indeed, his idea is simpler, here's a new patch. I tested it here, it works fine.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Patrick, please apply!

Hm, I forgot to include the description. New patch attached.

Thanks. I'll apply this tommorrow, assuming Jozsef is fine with this version.

Yes, of course

Best regards,
Jozsef
-
E-mail : [email protected], [email protected] 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
#11 lore raw

Re: [PATCH] netfilter: nf_ct_tcp: better handling for SYN retransmissions after SYN+ACK

Am 27.02.2011 18:28, schrieb Jozsef Kadlecsik:

Quoted 7 lines
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
Quoted 1 line

Hm, I forgot to include the description. New patch attached.

Thanks. I'll apply this tommorrow, assuming Jozsef is fine with this version.

Yes, of course

Applied, thanks everyone.