Skip to contentSkip to conversation

fix ECN target / cloned skb problem

PATCH Applied Harald Welte 2 participants 2 messages Feb 20, 2004

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

PATCH 1/1 fix ECN target / cloned skb problem

Hi Dave!

The attached patch fixes a 2.4-only problem in the ECN target - we miss to re-set some pointers after uncloning the skb.

Thanks to Maciej Soltysiak for spotting that problem and preparing the patch.

Please apply, thanks

Signature · 3 lines
- Harald Welte <[email protected]>               http://www.gnumonks.org/
============================================================================
Programming is like sex: One mistake and you have to support it your lifetime
net/ipv4/netfilter/ipt_ECN.c +7 -4
@@ -4,7 +4,7 @@
  * 
  * This software is distributed under GNU GPL v2, 1991
  * 
- * ipt_ECN.c,v 1.4 2002/08/05 19:36:51 laforge Exp
+ * ipt_ECN.c,v 1.7 2003/12/15 15:18:06 laforge Exp 
 */
 
 #include <linux/module.h>
@@ -59,8 +59,8 @@
 	    const struct ipt_ECN_info *einfo)
 {
 
-	struct tcphdr *tcph = (void *) iph + iph->ihl * 4;
-	u_int16_t *tcpflags = (u_int16_t *)tcph + 6;
+	struct tcphdr *tcph;
+	u_int16_t *tcpflags;
 	u_int16_t diffs[2];
 
 	/* raw socket (tcpdump) may have clone of incoming
@@ -71,9 +71,12 @@
 			return NF_DROP;
 		kfree_skb(*pskb);
 		*pskb = nskb;
-		iph = (*pskb)->nh.iph;
 	}
 
+	iph = (*pskb)->nh.iph;
+	tcph = (void *) iph + iph->ihl * 4;
+	tcpflags = (u_int16_t *)tcph + 6;
+
 	diffs[0] = *tcpflags;
 
 	if (einfo->operation & IPT_ECN_OP_SET_ECE
#1 lore raw
Quoted 5 lines · On Fri, 20 Feb 2004 21:01:06 +0100 Harald Welte <[email protected]> wrote:

The attached patch fixes a 2.4-only problem in the ECN target - we miss to re-set some pointers after uncloning the skb.

Thanks to Maciej Soltysiak for spotting that problem and preparing the patch.

Applied, thanks.