Skip to contentSkip to conversation

/home/rusty/devel/kernel/quilt/linux-2.6.10-bk7-Netfilter: When ipt_ECN needs TCP, check it is not inverted

PATCH In review Rusty Russell 1 participant 1 message Jan 5, 2005

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

PATCH 2/18 /home/rusty/devel/kernel/quilt/linux-2.6.10-bk7-Netfilter: When ipt_ECN needs TCP, check it is not inverted

Name: When ipt_ECN needs TCP, check it is not inverted

Status: Tested under nfsim

Writing the nfsim testcase for the ECN target revealed a hole in the rule checking: when checking whether the rule specified TCP, you need to check it isn't inverted.

net/ipv4/netfilter/ipt_ECN.c +1 -1
Index: linux-2.6.10-bk6-Netfilter/net/ipv4/netfilter/ipt_ECN.c
===================================================================
@@ -148,7 +148,7 @@
 	}
 
 	if ((einfo->operation & (IPT_ECN_OP_SET_ECE|IPT_ECN_OP_SET_CWR))
-	    && e->ip.proto != IPPROTO_TCP) {
+	    && (e->ip.proto != IPPROTO_TCP || (e->ip.invflags & IPT_INV_PROTO))) {
 		printk(KERN_WARNING "ECN: cannot use TCP operations on a "
 		       "non-tcp rule\n");
 		return 0;