Skip to contentSkip to conversation

ECN target wrong tcp csum on little endian

PATCH Applied Harald Welte 2 participants 2 messages Jan 9, 2003 – Jan 10, 2003

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

PATCH 1/1 ECN target wrong tcp csum on little endian

Hi Dave!

This is another patch of the series of patches you will receive from me today.

Please apply to 2.4.x and 2.5.x, thanks.

Author: Patrick McHardy <[email protected]>

The 2.4.20 kernel included the new iptables 'ECN' target, enabling a selective
ECN disable mechanism. Unfortunately there was a bug in the incremental TCP
checksum update, resulting in broken TCP checksums on little endian machines. This patch fixes the Bug.

net/ipv4/netfilter/ipt_ECN.c renamed from net/ipv4/netfilter/ipt_ECN.c.orig +2 -2
@@ -88,8 +88,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));
Signature · 4 lines
- Harald Welte / [email protected]               http://www.gnumonks.org/
============================================================================
"If this were a dictatorship, it'd be a heck of a lot easier, just so long
 as I'm the dictator."  --  George W. Bush Dec 18, 2000
#1 lore raw

From: Harald Welte <[email protected]>
Date: Thu, 9 Jan 2003 15:50:46 +0100

Author: Patrick McHardy <[email protected]>

The 2.4.20 kernel included the new iptables 'ECN' target, enabling a selective
ECN disable mechanism. Unfortunately there was a bug in the incremental TCP
checksum update, resulting in broken TCP checksums on little endian machines. This patch fixes the Bug.

Applied, thanks.