Skip to contentSkip to conversation

RFC: netfilter: xtables: add CT target

PATCH Patrick McHardy 3 participants 11 messages Jan 19, 2010 – Jan 20, 2010

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

The attached two patches add a 'CT' target to specify parameters used during conntrack creation. This can be used to manually attach a helper to a connection. A couple of patches I'm still working on will additionally use this for the "conntrack zones" classification.

I'm wondering if anyone has further ideas of parameters that might make sense to support. We could for example move parameters like sip_direct_signalling and sip_direct_media into the helper structure and allow to set them dynamically for each connection. Or perhaps selectively enable netlink events.

Any suggestions?

commit 549db1232fad40206a2ab6e334f0a4359602be5e

Author: Patrick McHardy <[email protected]>
Date:   Tue Jan 19 09:57:14 2010 +0100

netfilter: xtables: add CT target

Add a new target for the raw table, which can be used to specify conntrack parameters for specific connections, f.i. the conntrack helper.

The target attaches a "template" connection tracking entry to the skb, which is used by the conntrack core when initializing the new conntrack.

include/linux/netfilter/nf_conntrack_common.h +4 -0
index a374787..75f3150 100644
@@ -72,6 +72,10 @@ enum ip_conntrack_status {
 	/* Connection has fixed timeout. */
 	IPS_FIXED_TIMEOUT_BIT = 10,
 	IPS_FIXED_TIMEOUT = (1 << IPS_FIXED_TIMEOUT_BIT),
+
+	/* Conntrack is a template */
+	IPS_TEMPLATE_BIT = 11,
+	IPS_TEMPLATE = (1 << IPS_TEMPLATE_BIT),
 };
 
 #ifdef __KERNEL__
include/linux/netfilter/xt_CT.h new file +11 -0
new file mode 100644
index 0000000..70c3239
@@ -0,0 +1,11 @@
+#ifndef _XT_CT_H
+#define _XT_CT_H
+
+struct xt_ct_target_info {
+	char		helper[16];
+
+	/* Used internally by the kernel */
+	struct nf_conn	*ct __attribute__((aligned(8)));
+};
+
+#endif /* _XT_CT_H */
include/net/netfilter/nf_conntrack_helper.h +5 -1
index d015de9..61cbc6d 100644
@@ -42,12 +42,16 @@ struct nf_conntrack_helper {
 extern struct nf_conntrack_helper *
 __nf_conntrack_helper_find_byname(const char *name);
 
+extern struct nf_conntrack_helper *
+nf_conntrack_helper_try_module_get(const char *name);
+
 extern int nf_conntrack_helper_register(struct nf_conntrack_helper *);
 extern void nf_conntrack_helper_unregister(struct nf_conntrack_helper *);
 
 extern struct nf_conn_help *nf_ct_helper_ext_add(struct nf_conn *ct, gfp_t gfp);
 
-extern int __nf_ct_try_assign_helper(struct nf_conn *ct, gfp_t flags);
+extern int __nf_ct_try_assign_helper(struct nf_conn *ct, struct nf_conn *tmpl,
+				     gfp_t flags);
 
 extern void nf_ct_helper_destroy(struct nf_conn *ct);
 
net/netfilter/Kconfig +5 -0
index 634d14a..2cd1415 100644
@@ -341,6 +341,11 @@ config NETFILTER_XT_TARGET_CONNSECMARK
 
 	  To compile it as a module, choose M here.  If unsure, say N.
 
+config NETFILTER_XT_TARGET_CT
+	tristate '"CT" target support'
+	depends on NF_CONNTRACK
+	depends on NETFILTER_ADVANCED
+
 config NETFILTER_XT_TARGET_DSCP
 	tristate '"DSCP" and "TOS" target support'
 	depends on IP_NF_MANGLE || IP6_NF_MANGLE
net/netfilter/Makefile +1 -0
index 49f62ee..f873644 100644
@@ -44,6 +44,7 @@ obj-$(CONFIG_NETFILTER_XTABLES) += x_tables.o xt_tcpudp.o
 obj-$(CONFIG_NETFILTER_XT_TARGET_CLASSIFY) += xt_CLASSIFY.o
 obj-$(CONFIG_NETFILTER_XT_TARGET_CONNMARK) += xt_CONNMARK.o
 obj-$(CONFIG_NETFILTER_XT_TARGET_CONNSECMARK) += xt_CONNSECMARK.o
+obj-$(CONFIG_NETFILTER_XT_TARGET_CT) += xt_CT.o
 obj-$(CONFIG_NETFILTER_XT_TARGET_DSCP) += xt_DSCP.o
 obj-$(CONFIG_NETFILTER_XT_TARGET_HL) += xt_HL.o
 obj-$(CONFIG_NETFILTER_XT_TARGET_LED) += xt_LED.o
net/netfilter/nf_conntrack_core.c +28 -15

120 lines not on this page · raw message

net/netfilter/nf_conntrack_helper.c +32 -4
index 65c2a7b..0424a64 100644
@@ -81,6 +81,25 @@ __nf_conntrack_helper_find_byname(const char *name)
 }
 EXPORT_SYMBOL_GPL(__nf_conntrack_helper_find_byname);
 
+struct nf_conntrack_helper *
+nf_conntrack_helper_try_module_get(const char *name)
+{
+	struct nf_conntrack_helper *h;
+
+	h = __nf_conntrack_helper_find_byname(name);
+#ifdef CONFIG_MODULES
+	if (h == NULL) {
+		if (request_module("nfct-helper-%s", name) == 0)
+			h = __nf_conntrack_helper_find_byname(name);
+	}
+#endif
+	if (h != NULL && !try_module_get(h->me))
+		h = NULL;
+
+	return h;
+}
+EXPORT_SYMBOL_GPL(nf_conntrack_helper_try_module_get);
+
 struct nf_conn_help *nf_ct_helper_ext_add(struct nf_conn *ct, gfp_t gfp)
 {
 	struct nf_conn_help *help;
@@ -94,13 +113,22 @@ struct nf_conn_help *nf_ct_helper_ext_add(struct nf_conn *ct, gfp_t gfp)
 }
 EXPORT_SYMBOL_GPL(nf_ct_helper_ext_add);
 
-int __nf_ct_try_assign_helper(struct nf_conn *ct, gfp_t flags)
+int __nf_ct_try_assign_helper(struct nf_conn *ct, struct nf_conn *tmpl,
+			      gfp_t flags)
 {
+	struct nf_conntrack_helper *helper = NULL;
+	struct nf_conn_help *help;
 	int ret = 0;
-	struct nf_conntrack_helper *helper;
-	struct nf_conn_help *help = nfct_help(ct);
 
-	helper = __nf_ct_helper_find(&ct->tuplehash[IP_CT_DIR_REPLY].tuple);
+	if (tmpl != NULL) {
+		help = nfct_help(tmpl);
+		if (help != NULL)
+			helper = help->helper;
+	}
+
+	help = nfct_help(ct);
+	if (helper == NULL)
+		helper = __nf_ct_helper_find(&ct->tuplehash[IP_CT_DIR_REPLY].tuple);
 	if (helper == NULL) {
 		if (help)
 			rcu_assign_pointer(help->helper, NULL);
net/netfilter/nf_conntrack_netlink.c +1 -1
index 79478df..8bc57c9 100644
@@ -1244,7 +1244,7 @@ ctnetlink_create_conntrack(struct net *net,
 		}
 	} else {
 		/* try an implicit helper assignation */
-		err = __nf_ct_try_assign_helper(ct, GFP_ATOMIC);
+		err = __nf_ct_try_assign_helper(ct, NULL, GFP_ATOMIC);
 		if (err < 0)
 			goto err2;
 	}
net/netfilter/xt_CT.c new file +110 -0

110 lines not on this page · raw message

commit 88f70e95fb12fb1ac629bd3342444d0972ca5441

Author: Patrick McHardy <[email protected]>
Date:   Mon Jan 18 14:20:54 2010 +0100

netfilter: add struct net * to target parameters

include/linux/netfilter/x_tables.h +2 -0
index 3caf5e1..91f14c4 100644
@@ -249,6 +249,7 @@ struct xt_target_param {
  * Other fields see above.
  */
 struct xt_tgchk_param {
+	struct net *net;
 	const char *table;
 	const void *entryinfo;
 	const struct xt_target *target;
@@ -259,6 +260,7 @@ struct xt_tgchk_param {
 
 /* Target destructor parameters */
 struct xt_tgdtor_param {
+	struct net *net;
 	const struct xt_target *target;
 	void *targinfo;
 	u_int8_t family;
net/bridge/netfilter/ebtables.c +6 -4
index 1aa0e4c..12beb58 100644
@@ -579,13 +579,14 @@ ebt_cleanup_match(struct ebt_entry_match *m, struct net *net, unsigned int *i)
 }
 
 static inline int
-ebt_cleanup_watcher(struct ebt_entry_watcher *w, unsigned int *i)
+ebt_cleanup_watcher(struct ebt_entry_watcher *w, struct net *net, unsigned int *i)
 {
 	struct xt_tgdtor_param par;
 
 	if (i && (*i)-- == 0)
 		return 1;
 
+	par.net      = net;
 	par.target   = w->u.watcher;
 	par.targinfo = w->data;
 	par.family   = NFPROTO_BRIDGE;
@@ -606,10 +607,11 @@ ebt_cleanup_entry(struct ebt_entry *e, struct net *net, unsigned int *cnt)
 	/* we're done */
 	if (cnt && (*cnt)-- == 0)
 		return 1;
-	EBT_WATCHER_ITERATE(e, ebt_cleanup_watcher, NULL);
+	EBT_WATCHER_ITERATE(e, ebt_cleanup_watcher, net, NULL);
 	EBT_MATCH_ITERATE(e, ebt_cleanup_match, net, NULL);
 	t = (struct ebt_entry_target *)(((char *)e) + e->target_offset);
 
+	par.net      = net;
 	par.target   = t->u.target;
 	par.targinfo = t->data;
 	par.family   = NFPROTO_BRIDGE;
@@ -674,7 +676,7 @@ ebt_check_entry(struct ebt_entry *e,
 	}
 	i = 0;
 
-	mtpar.net	= net;
+	mtpar.net	= tgpar.net       = net;
 	mtpar.table     = tgpar.table     = name;
 	mtpar.entryinfo = tgpar.entryinfo = e;
 	mtpar.hook_mask = tgpar.hook_mask = hookmask;
@@ -730,7 +732,7 @@ ebt_check_entry(struct ebt_entry *e,
 	(*cnt)++;
 	return 0;
 cleanup_watchers:
-	EBT_WATCHER_ITERATE(e, ebt_cleanup_watcher, &j);
+	EBT_WATCHER_ITERATE(e, ebt_cleanup_watcher, net, &j);
 cleanup_matches:
 	EBT_MATCH_ITERATE(e, ebt_cleanup_match, net, &i);
 	return ret;
net/ipv4/netfilter/ip_tables.c +5 -3
index cfaba0e..7fde8f6 100644
@@ -638,10 +638,11 @@ err:
 	return ret;
 }
 
-static int check_target(struct ipt_entry *e, const char *name)
+static int check_target(struct ipt_entry *e, struct net *net, const char *name)
 {
 	struct ipt_entry_target *t = ipt_get_target(e);
 	struct xt_tgchk_param par = {
+		.net       = net,
 		.table     = name,
 		.entryinfo = e,
 		.target    = t->u.kernel.target,
@@ -697,7 +698,7 @@ find_check_entry(struct ipt_entry *e, struct net *net, const char *name,
 	}
 	t->u.kernel.target = target;
 
-	ret = check_target(e, name);
+	ret = check_target(e, net, name);
 	if (ret)
 		goto err;
 
@@ -788,6 +789,7 @@ cleanup_entry(struct ipt_entry *e, struct net *net, unsigned int *i)
 	IPT_MATCH_ITERATE(e, cleanup_match, net, NULL);
 	t = ipt_get_target(e);
 
+	par.net      = net;
 	par.target   = t->u.kernel.target;
 	par.targinfo = t->data;
 	par.family   = NFPROTO_IPV4;
@@ -1675,7 +1677,7 @@ compat_check_entry(struct ipt_entry *e, struct net *net, const char *name,
 	if (ret)
 		goto cleanup_matches;
 
-	ret = check_target(e, name);
+	ret = check_target(e, net, name);
 	if (ret)
 		goto cleanup_matches;
 
net/ipv6/netfilter/ip6_tables.c +5 -3
index 9f1d45f..0376ed6 100644
@@ -669,10 +669,11 @@ err:
 	return ret;
 }
 
-static int check_target(struct ip6t_entry *e, const char *name)
+static int check_target(struct ip6t_entry *e, struct net *net, const char *name)
 {
 	struct ip6t_entry_target *t = ip6t_get_target(e);
 	struct xt_tgchk_param par = {
+		.net       = net,
 		.table     = name,
 		.entryinfo = e,
 		.target    = t->u.kernel.target,
@@ -729,7 +730,7 @@ find_check_entry(struct ip6t_entry *e, struct net *net, const char *name,
 	}
 	t->u.kernel.target = target;
 
-	ret = check_target(e, name);
+	ret = check_target(e, net, name);
 	if (ret)
 		goto err;
 
@@ -820,6 +821,7 @@ cleanup_entry(struct ip6t_entry *e, struct net *net, unsigned int *i)
 	IP6T_MATCH_ITERATE(e, cleanup_match, net, NULL);
 	t = ip6t_get_target(e);
 
+	par.net      = net;
 	par.target   = t->u.kernel.target;
 	par.targinfo = t->data;
 	par.family   = NFPROTO_IPV6;
@@ -1710,7 +1712,7 @@ static int compat_check_entry(struct ip6t_entry *e, struct net *net,
 	if (ret)
 		goto cleanup_matches;
 
-	ret = check_target(e, name);
+	ret = check_target(e, net, name);
 	if (ret)
 		goto cleanup_matches;
 
#1 lore raw
Quoted 7 lines · Patrick McHardy

The attached two patches add a 'CT' target to specify parameters used during conntrack creation. This can be used to manually attach a helper to a connection. A couple of patches I'm still working on will additionally use this for the "conntrack zones" classification.

I'm wondering if anyone has further ideas of parameters that might make sense to support.

Phil Oester/Pablo had proposed an earlier conntrack target to do just that.

[3]
http://thread.gmane.org/gmane.comp.security.firewalls.netfilter.devel/21499
(Can't find Pablo's update to that)

#2 lore raw
Quoted 10 lines · Jan Engelhardt
Quoted 7 lines · Patrick McHardy

The attached two patches add a 'CT' target to specify parameters used during conntrack creation. This can be used to manually attach a helper to a connection. A couple of patches I'm still working on will additionally use this for the "conntrack zones" classification.

I'm wondering if anyone has further ideas of parameters that might make sense to support.

Quoted 6 lines

Phil Oester/Pablo had proposed an earlier conntrack target to do just that.

[3]
http://thread.gmane.org/gmane.comp.security.firewalls.netfilter.devel/21499
(Can't find Pablo's update to that)

We could use the CT target to specify a fixed timeout, but since it is only used for creating the conntrack entry, the timeouts wouldn't be refreshed for received packets. This doesn't sound very useful. Of course the target could also modify existing connections, but that doesn't fit into the concept very well.

#3 lore raw
In reply to Patrick McHardy
Quoted 10 lines · Patrick McHardy

The attached two patches add a 'CT' target to specify parameters used during conntrack creation. This can be used to manually attach a helper to a connection. A couple of patches I'm still working on will additionally use this for the "conntrack zones" classification.

I'm wondering if anyone has further ideas of parameters that might make sense to support. We could for example move parameters like sip_direct_signalling and sip_direct_media into the helper structure and allow to set them dynamically for each connection. Or perhaps selectively enable netlink events.

Selectively enabling netlink events (not only per connection but per event type) would be cool! Last year I used the CONNMARK target for that purpose
- maybe it fits better to the CT target.

Best regards,
Jozsef
-
E-mail : [email protected], [email protected] PGP key : http://www.kfki.hu/~kadlec/pgp_public_key.txt
Address : KFKI Research Institute for Particle and Nuclear Physics

          H-1525 Budapest 114, POB. 49, Hungary
#4 lore raw
Quoted 13 lines · Jozsef Kadlecsik
Quoted 10 lines · Patrick McHardy

The attached two patches add a 'CT' target to specify parameters used during conntrack creation. This can be used to manually attach a helper to a connection. A couple of patches I'm still working on will additionally use this for the "conntrack zones" classification.

I'm wondering if anyone has further ideas of parameters that might make sense to support. We could for example move parameters like sip_direct_signalling and sip_direct_media into the helper structure and allow to set them dynamically for each connection. Or perhaps selectively enable netlink events.

Quoted 3 lines

Selectively enabling netlink events (not only per connection but per event type) would be cool! Last year I used the CONNMARK target for that purpose
- maybe it fits better to the CT target.

I think it would be a good fit since you probably would want to specify the events to be delivered before the conntrack is created.

Adding an event mask to the ecache extension also looks unproblematic. You could then use a rule like this:

iptables -t raw .. -j CT --ctevents new,related,protoinfo,helper

or something like that. Are the existing event types fine grained enough for this? Also, should the CT target override the global sysctl setting?

#5 lore raw
Quoted 3 lines · Patrick McHardy

or something like that. Are the existing event types fine grained enough for this? Also, should the CT target override the global sysctl setting?

Regarding the override, what I'm adding right now is:

- sysctl=1 enables all events unless specific events are requested
- sysctl=0 disables all events unless specific events are requested

This should be fine from a backwards-compatibility POV.

#6 lore raw
Quoted 11 lines · Patrick McHardy
Quoted 3 lines · Patrick McHardy

or something like that. Are the existing event types fine grained enough for this? Also, should the CT target override the global sysctl setting?

Regarding the override, what I'm adding right now is:

- sysctl=1 enables all events unless specific events are requested
- sysctl=0 disables all events unless specific events are requested

This should be fine from a backwards-compatibility POV.

I'm using this patch for selective delivery and a small patch on top of the CT target to initialize the masks. Besides the masks, it also removes a couple of ctnetlink sysctl checks in the direct delivery paths since they prevent overriding the sysctl. It also seems inconsistent that we continue delivering cached events for conntracks with an ecache entry, but stop delivering direct events when the sysctl is set to zero.

One remaining question is whether we should initialize the masks of an expected connection to those of its master. This seems useful since in the raw table (where the CT target can be used) its unknown whether its an expected connection.

commit 1019e6a541bac66266cdfbc0acae5c3ce655d3f6

Author: Patrick McHardy <[email protected]>
Date:   Tue Jan 19 16:48:25 2010 +0100

netfilter: ctnetlink: support selective event delivery

Add two masks for conntrack end expectation events to struct nf_conntrack_ecache and use them to filter events. Their default value is "all events" when the event sysctl is on and "no events" when it is off. A following patch will add specific initializations. Expectation events depend on the ecache struct of their master conntrack.

include/linux/netfilter/nf_conntrack_common.h +17 -0
index a374787..3a57c14 100644
@@ -74,6 +74,23 @@ enum ip_conntrack_status {
 	IPS_FIXED_TIMEOUT = (1 << IPS_FIXED_TIMEOUT_BIT),
 };
 
+/* Connection tracking event types */
+enum ip_conntrack_events {
+	IPCT_NEW		= 0,	/* new conntrack */
+	IPCT_RELATED		= 1,	/* related conntrack */
+	IPCT_DESTROY		= 2,	/* destroyed conntrack */
+	IPCT_STATUS		= 3,	/* status has changed */
+	IPCT_PROTOINFO		= 4,	/* protocol information has changed */
+	IPCT_HELPER		= 5,	/* new helper has been set */
+	IPCT_MARK		= 6,	/* new mark has been set */
+	IPCT_NATSEQADJ		= 7,	/* NAT is doing sequence adjustment */
+	IPCT_SECMARK		= 8,	/* new security mark has been set */
+};
+
+enum ip_conntrack_expect_events {
+	IPEXP_NEW		= 0,	/* new expectation */
+};
+
 #ifdef __KERNEL__
 struct ip_conntrack_stat {
 	unsigned int searched;
include/net/netfilter/nf_conntrack_ecache.h +28 -30

115 lines not on this page · raw message

net/netfilter/nf_conntrack_core.c +1 -1
index 0e98c32..4d75e21 100644
@@ -648,7 +648,7 @@ init_conntrack(struct net *net,
 	}
 
 	nf_ct_acct_ext_add(ct, GFP_ATOMIC);
-	nf_ct_ecache_ext_add(ct, GFP_ATOMIC);
+	nf_ct_ecache_ext_add(ct, 0, 0, GFP_ATOMIC);
 
 	spin_lock_bh(&nf_conntrack_lock);
 	exp = nf_ct_find_expectation(net, tuple);
net/netfilter/nf_conntrack_netlink.c +1 -1
index 79478df..ec69442 100644
@@ -1276,7 +1276,7 @@ ctnetlink_create_conntrack(struct net *net,
 	}
 
 	nf_ct_acct_ext_add(ct, GFP_ATOMIC);
-	nf_ct_ecache_ext_add(ct, GFP_ATOMIC);
+	nf_ct_ecache_ext_add(ct, 0, 0, GFP_ATOMIC);
 
 #if defined(CONFIG_NF_CONNTRACK_MARK)
 	if (cda[CTA_MARK])
#7 lore raw
In reply to Patrick McHardy

Hi Patrick,

Quoted 21 lines · Patrick McHardy
Quoted 13 lines · Jozsef Kadlecsik
Quoted 10 lines · Patrick McHardy

The attached two patches add a 'CT' target to specify parameters used during conntrack creation. This can be used to manually attach a helper to a connection. A couple of patches I'm still working on will additionally use this for the "conntrack zones" classification.

I'm wondering if anyone has further ideas of parameters that might make sense to support. We could for example move parameters like sip_direct_signalling and sip_direct_media into the helper structure and allow to set them dynamically for each connection. Or perhaps selectively enable netlink events.

Quoted 3 lines

Selectively enabling netlink events (not only per connection but per event type) would be cool! Last year I used the CONNMARK target for that purpose
- maybe it fits better to the CT target.

I think it would be a good fit since you probably would want to specify the events to be delivered before the conntrack is created.

Quoted 7 lines

Adding an event mask to the ecache extension also looks unproblematic. You could then use a rule like this:

iptables -t raw .. -j CT --ctevents new,related,protoinfo,helper

or something like that. Are the existing event types fine grained enough for this?

The possible events were cut back strongly and now the conntrack state changes ASSURED and SEEN_REPLY cannot be distinguished. In my opinion either SEEN_REPLY should not trigger an event at all or IPCT_ASSURED should be put back.

Quoted 1 line

Also, should the CT target override the global sysctl setting?

Yes, definitely.

Best regards,
Jozsef
-
E-mail : [email protected], [email protected] PGP key : http://www.kfki.hu/~kadlec/pgp_public_key.txt
Address : KFKI Research Institute for Particle and Nuclear Physics

          H-1525 Budapest 114, POB. 49, Hungary
#8 lore raw
Quoted 28 lines · Jozsef Kadlecsik

Hi Patrick,

Quoted 24 lines · Patrick McHardy
Quoted 7 lines · Jozsef Kadlecsik
Quoted 5 lines · Patrick McHardy

The attached two patches add a 'CT' target to specify parameters used during conntrack creation. This can be used to manually attach a helper to a connection. A couple of patches I'm still working on will additionally use this for the "conntrack zones" classification.

Quoted 8 lines
Quoted 5 lines

I'm wondering if anyone has further ideas of parameters that might make sense to support. We could for example move parameters like sip_direct_signalling and sip_direct_media into the helper structure and allow to set them dynamically for each connection. Or perhaps selectively enable netlink events.

Selectively enabling netlink events (not only per connection but per event type) would be cool! Last year I used the CONNMARK target for that purpose
- maybe it fits better to the CT target.

I think it would be a good fit since you probably would want to specify the events to be delivered before the conntrack is created.

Adding an event mask to the ecache extension also looks unproblematic. You could then use a rule like this:

iptables -t raw .. -j CT --ctevents new,related,protoinfo,helper

Quoted 7 lines
Quoted 2 lines

or something like that. Are the existing event types fine grained enough for this?

The possible events were cut back strongly and now the conntrack state changes ASSURED and SEEN_REPLY cannot be distinguished. In my opinion either SEEN_REPLY should not trigger an event at all or IPCT_ASSURED should be put back.

I think it makes sense to generate an event for SEEN_REPLY since its a synchronizable event (ctnetlink can also set the SEEN_REPLY bit). I'm not opposed to add back IPCT_ASSURED, but I'm wondering, in what case would userspace be interested in only one of both updates?

Quoted 3 lines
Quoted 1 line

Also, should the CT target override the global sysctl setting?

Yes, definitely.

Thanks.

#9 lore raw
Quoted 17 lines · Patrick McHardy
Quoted 8 lines · Jozsef Kadlecsik
Quoted 5 lines · Patrick McHardy

Adding an event mask to the ecache extension also looks unproblematic. You could then use a rule like this:

iptables -t raw .. -j CT --ctevents new,related,protoinfo,helper

Quoted 7 lines
Quoted 2 lines

or something like that. Are the existing event types fine grained enough for this?

The possible events were cut back strongly and now the conntrack state changes ASSURED and SEEN_REPLY cannot be distinguished. In my opinion either SEEN_REPLY should not trigger an event at all or IPCT_ASSURED should be put back.

Quoted 5 lines

I think it makes sense to generate an event for SEEN_REPLY since its a synchronizable event (ctnetlink can also set the SEEN_REPLY bit). I'm not opposed to add back IPCT_ASSURED, but I'm wondering, in what case would userspace be interested in only one of both updates?

I have only one case, but I think that's worth it: "sparse" conntrack replication. Start replicating the conntrack entry after it reached the ASSURED state and that way it's SYN-flood resistant. (Of course conntrack could filter out the NEW/SEEN_REPLY state changes and wait for ASSURED, but then the events are just sent unnecessarily.)

Best regards,
Jozsef
-
E-mail : [email protected], [email protected] PGP key : http://www.kfki.hu/~kadlec/pgp_public_key.txt
Address : KFKI Research Institute for Particle and Nuclear Physics

          H-1525 Budapest 114, POB. 49, Hungary
#10 lore raw
Quoted 22 lines · Jozsef Kadlecsik
Quoted 14 lines · Patrick McHardy
Quoted 5 lines · Jozsef Kadlecsik
Quoted 3 lines · Patrick McHardy

Adding an event mask to the ecache extension also looks unproblematic. You could then use a rule like this:

Quoted 8 lines
Quoted 4 lines

iptables -t raw .. -j CT --ctevents new,related,protoinfo,helper

or something like that. Are the existing event types fine grained enough for this?

The possible events were cut back strongly and now the conntrack state changes ASSURED and SEEN_REPLY cannot be distinguished. In my opinion either SEEN_REPLY should not trigger an event at all or IPCT_ASSURED should be put back.

Quoted 5 lines

I think it makes sense to generate an event for SEEN_REPLY since its a synchronizable event (ctnetlink can also set the SEEN_REPLY bit). I'm not opposed to add back IPCT_ASSURED, but I'm wondering, in what case would userspace be interested in only one of both updates?

Quoted 5 lines

I have only one case, but I think that's worth it: "sparse" conntrack replication. Start replicating the conntrack entry after it reached the ASSURED state and that way it's SYN-flood resistant. (Of course conntrack could filter out the NEW/SEEN_REPLY state changes and wait for ASSURED, but then the events are just sent unnecessarily.)

Sounds reasonable :) I'll add back the IPCT_ASSURED bit and will post the entire series for review.