Skip to contentSkip to conversation

ECN target does not behave as expected

DISCUSSION Marius Cristian CONSTANTIN 4 participants 4 messages Jan 7, 2003

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

I am running a firewall based on 2.4.20 kernel and 1.2.7a iptables
version. Also patch-o-matic is version 20020825.
I am tryin to disable ECN per destination host, using -j ECN target
and --ecn-tcp-remove option.
When I try to connect to the hosts using the rule in mangle table, if
the tcp_ecn option is enabled, tcpdump shows bad checksum. According to documentation this is only a display bug, because tcpdump has a copy of packet, and does not see entire info. Still, I cannot connect to the host.
If I disable ECN entirely (by using /proc/sys/net/ipv4/tcp_ecn)
connection works perfectly. Any clue or indication to achieve the desire results (ECN enabled in general, but disabled for some hosts)?.
I've searched the archives, found someone reporting similar problem
(http://lists.netfilter.org/pipermail/netfilter/2002-August/037228.html),
but no answer.

Thanx in advance,
Marius Cristian CONSTANTIN

#2 lore raw
In reply to Marius Cristian CONSTANTIN
Quoted 6 lines · Marius Cristian CONSTANTIN

I am running a firewall based on 2.4.20 kernel and 1.2.7a iptables
version. Also patch-o-matic is version 20020825.
I am tryin to disable ECN per destination host, using -j ECN target
and --ecn-tcp-remove option.
When I try to connect to the hosts using the rule in mangle table, if
the tcp_ecn option is enabled, tcpdump shows bad checksum. According to

Quoted 8 lines

documentation this is only a display bug, because tcpdump has a copy of packet, and does not see entire info. Still, I cannot connect to the host.
If I disable ECN entirely (by using /proc/sys/net/ipv4/tcp_ecn)
connection works perfectly. Any clue or indication to achieve the desire results (ECN enabled in general, but disabled for some hosts)?.
I've searched the archives, found someone reporting similar problem
(http://lists.netfilter.org/pipermail/netfilter/2002-August/037228.html),
but no answer.

Apparently you need the patch below - at least that works for me:

net/ipv4/netfilter/ipt_ECN.c +2 -2
diff -urN linux-2.4.20.orig/net/ipv4/netfilter/ipt_ECN.c linux-2.4.20/net/ipv4/netfilter/ipt_ECN.c
@@ -87,8 +87,8 @@
 	}
 
 	if (diffs[0] != *tcpflags) {
-		diffs[0] = htons(diffs[0]) ^ 0xFFFF;
-		diffs[1] = htons(*tcpflags);
+		diffs[0] = diffs[0] ^ 0xFFFF;
+		diffs[1] = *tcpflags;
 		tcph->check = csum_fold(csum_partial((char *)diffs,
 		                                    sizeof(diffs),
 		                                    tcph->check^0xFFFF));

/Rasmus

Signature · 4 lines
-- [ Rasmus "Møffe" Bøg Hansen ] ---------------------------------------
Expect the unexpected.
- HitchHikers Guide to the Galaxy, Douglas Adams
----------------------------------[ moffe at amagerkollegiet dot dk ] --
#3 lore raw
Quoted 1 line · Rasmus B?g Hansen

Apparently you need the patch below - at least that works for me:

For what it's worth I've sent this patch to Marcelo Tosatti
<[email protected]>, the guy who maintains and releases the current 2.4.x kernels. Someone may have done so already but I wanted to be sure the fix makes it into mainstream ;).

-Ath

Signature · 4 lines
- Athanasius = Athanasius(at)miggy.org / http://www.miggy.org/
                  Finger athan(at)fysh.org for PGP key
	   "And it's me who is my enemy. Me who beats me up.
Me who makes the monsters. Me who strips my confidence." Paula Cole - ME