Skip to contentSkip to conversation

Add conntrack marking support from userspace

PATCH In review Pablo Neira 2 participants 2 messages Nov 4, 2005 – Nov 5, 2005

Subsystems (2)
lore
Share & tools
lore

Pablo Neira

author maintainer
#0 lore raw

PATCH 3/7 Add conntrack marking support from userspace

This patch adds support for conntrack marking from user space.

Signature · 2 lines
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

This patch adds support for conntrack marking from user space.

net/ipv4/netfilter/ip_conntrack_netlink.c +10 -0
Index: net-2.6.git/net/ipv4/netfilter/ip_conntrack_netlink.c
===================================================================
@@ -979,6 +979,11 @@ ctnetlink_change_conntrack(struct ip_con
 			return err;
 	}
 
+#if defined(CONFIG_IP_NF_CONNTRACK_MARK)
+	if (cda[CTA_MARK-1])
+		ct->mark = ntohl(*(u_int32_t *)NFA_DATA(cda[CTA_MARK-1]));
+#endif
+
 	DEBUGP("all done\n");
 	return 0;
 }
@@ -1022,6 +1027,11 @@ ctnetlink_create_conntrack(struct nfattr
 	if (ct->helper)
 		ip_conntrack_helper_put(ct->helper);
 
+#if defined(CONFIG_IP_NF_CONNTRACK_MARK)
+	if (cda[CTA_MARK-1])
+		ct->mark = ntohl(*(u_int32_t *)NFA_DATA(cda[CTA_MARK-1]));
+#endif
+
 	DEBUGP("conntrack with id %u inserted\n", ct->id);
 	return 0;
 
#1 lore raw
Quoted 1 line · Pablo Neira

This patch adds support for conntrack marking from user space.

This seems to be missing sizechecks. Looking at ip_conntrack_netlink, they seem to be missing a few other places too.