Skip to contentSkip to conversation

mark conntrack event

PATCH Applied Pablo Neira Ayuso 2 participants 2 messages Jul 25, 2006 – Aug 8, 2006

Subsystems (2)
lore
Share & tools
lore

Pablo Neira Ayuso

author maintainer
#0 lore raw

PATCH 1/8 mark conntrack event

This patch introduces the mark event. ctnetlink can use this to know if the mark needs to be dumped.

Signature · 1 line
The dawn of the fourth age of Linux firewalling is coming; a time of great struggle and heroic deeds -- J.Kadlecsik got inspired by J.Morris

[CONNTRACK] mark conntrack event

This patch introduces the mark event. ctnetlink can use this to know if the mark needs to be dumped.

include/linux/netfilter/nf_conntrack_common.h +4 -0
Index: net-2.6/include/linux/netfilter/nf_conntrack_common.h
===================================================================
@@ -125,6 +125,10 @@
 	/* Counter highest bit has been set */
 	IPCT_COUNTER_FILLING_BIT = 11,
 	IPCT_COUNTER_FILLING = (1 << IPCT_COUNTER_FILLING_BIT),
+
+	/* Mark is set */
+	IPCT_MARK_BIT = 12,
+	IPCT_MARK = (1 << IPCT_MARK_BIT),
 };
 
 enum ip_conntrack_expect_events {
net/netfilter/xt_CONNMARK.c +14 -2
Index: net-2.6/net/netfilter/xt_CONNMARK.c
===================================================================
@@ -52,13 +52,25 @@
 	    switch(markinfo->mode) {
 	    case XT_CONNMARK_SET:
 		newmark = (*ctmark & ~markinfo->mask) | markinfo->mark;
-		if (newmark != *ctmark)
+		if (newmark != *ctmark) {
 		    *ctmark = newmark;
+#ifdef CONFIG_IP_NF_CONNTRACK_EVENTS
+		    ip_conntrack_event_cache(IPCT_MARK, *pskb);
+#else
+		    nf_conntrack_event_cache(IPCT_MARK, *pskb);
+#endif
+		}
 		break;
 	    case XT_CONNMARK_SAVE:
 		newmark = (*ctmark & ~markinfo->mask) | ((*pskb)->nfmark & markinfo->mask);
-		if (*ctmark != newmark)
+		if (*ctmark != newmark) {
 		    *ctmark = newmark;
+#ifdef CONFIG_IP_NF_CONNTRACK_EVENTS
+		    ip_conntrack_event_cache(IPCT_MARK, *pskb);
+#else
+		    nf_conntrack_event_cache(IPCT_MARK, *pskb);
+#endif
+		}
 		break;
 	    case XT_CONNMARK_RESTORE:
 		nfmark = (*pskb)->nfmark;
#1 lore raw
Quoted 2 lines · Pablo Neira Ayuso

This patch introduces the mark event. ctnetlink can use this to know if the mark needs to be dumped.

Applied, thanks.