Skip to contentSkip to conversation

xt_layer7

RFC PATCH In review James King 3 participants 9 messages Oct 4, 2008 – Oct 9, 2008

Subsystems (2)
lore
Share & tools
lore

James King

author
#0 lore raw

RFC PATCH 1/1 xt_layer7

I've re-written xt_layer7 (l7-filter) so that it not longer requires patching of the nf_conn structure for data storage, using ct_extend instead, with the goal that it can eventually be used against a vanilla kernel with an unpatched iptables. It still relies on a regex library, when it's been suggested that the preferred backend for a DPI module would be the textsearch infrastructure. Unfortunately, the work needed to support l7-filter's current regex patterns with that looks too prohibitive (although maybe not so for someone more talented than me).

Since it's not really suitable for mainline, I've based it against xtables-addons, but using ct_extend means that we need to call our nf_ct_ext_*_add before the conntrack is confirmed in order to add the private area, meaning a patch to nf_conntrack_core.c, which wouldn't work for a non-included module. I've made a few patches against nf-next to work around this, including a follow-on to nf_conntrack_acct (diffstat below, full patches attached), and I'd really appreciate any comments on what's needed still to get this pulled into the kernel and xtables-addons. Testing it requires the patterns to be installed, they can be had from
http://sourceforge.net/project/showfiles.php?group_id=80085 (untar and move to /etc/l7-protocols/).

One thing I haven't worked out is the following warning that results during a kernel compile now, any pointers on how to fix would be great:
include/net/netfilter/nf_conntrack_acct.h:31: warning:
nf_ct_acct_ext_add defined but not used

include/net/netfilter/nf_conntrack_acct.h | 23 +++++++++++------------

 include/net/netfilter/nf_conntrack_extend.h |    8 ++++----
 net/netfilter/nf_conntrack_acct.c           |    1 +
 net/netfilter/nf_conntrack_core.c           |    1 -
 net/netfilter/nf_conntrack_extend.c         |    4 ----
 net/netfilter/nf_conntrack_netlink.c        |    1 -
 6 files changed, 16 insertions(+), 22 deletions(-)

ct_extend: add init callback
ct_extend: convert nf_conntrack_acct to use init callback
ct_extend: add support for layer7 extension type

 extensions/Kbuild            |    1 +
 extensions/Mbuild            |    1 +
 extensions/libxt_layer7.c    |  393 ++++++++++++++
 extensions/libxt_layer7.man  |   14 +
 extensions/regexp/regexp.c   | 1211 ++++++++++++++++++++++++++++++++++++++++++
 extensions/regexp/regexp.h   |   41 ++
 extensions/regexp/regmagic.h |    5 +
 extensions/regexp/regsub.c   |   97 ++++
 extensions/xt_layer7.c       |  703 ++++++++++++++++++++++++
 extensions/xt_layer7.h       |   67 +++
 mconfig                      |    1 +
 11 files changed, 2534 insertions(+), 0 deletions(-)
 create mode 100644 extensions/libxt_layer7.c
 create mode 100644 extensions/libxt_layer7.man
 create mode 100644 extensions/regexp/regexp.c
 create mode 100644 extensions/regexp/regexp.h
 create mode 100644 extensions/regexp/regmagic.h
 create mode 100644 extensions/regexp/regsub.c
 create mode 100644 extensions/xt_layer7.c
 create mode 100644 extensions/xt_layer7.h

xtables-addons: import layer7 module

Regards,
James

From 3917b654e28fbf9fb25e2d96c10ebee1bf3b1ea5 Mon Sep 17 00:00:00 2001
From: James King <[email protected]>
Date: Fri, 3 Oct 2008 04:44:58 -0700
Subject: [PATCH 1/3] ct_extend: add init callback

Adding a ct_extend private area using nf_ct_ext_add() can only be done while the conntrack is still unconfirmed. This patch adds an optional initialization callback to nf_ct_ext_type, which is called when the conntrack is created so that extensions have an easy opportunity to add their private area (i.e. by calling nf_ct_ext_*_add) and initialize the structure(s). This makes it so that future extensions can be as little as a one line patch to the nf_ct_ext_id enum, instead of each one patching init_conntrack() and/or ctnetlink_create_conntrack().

Since we may or may not want to be able to sleep during memory allocation, depending on where nf_ct_ext_init() is called from, pass the kmalloc flag through the callback.

---
 include/net/netfilter/nf_conntrack_extend.h |    9 +++++++++
 net/netfilter/nf_conntrack_core.c           |    1 +
 net/netfilter/nf_conntrack_extend.c         |   17 +++++++++++++++++
 net/netfilter/nf_conntrack_netlink.c        |    1 +
 4 files changed, 28 insertions(+), 0 deletions(-)
include/net/netfilter/nf_conntrack_extend.h +9 -0
index da8ee52..f938395 100644
@@ -38,6 +38,13 @@ static inline void *__nf_ct_ext_find(const struct nf_conn *ct, u8 id)
 #define nf_ct_ext_find(ext, id)	\
 	((id##_TYPE *)__nf_ct_ext_find((ext), (id)))
 
+/* Initialize all relationships */
+extern void __nf_ct_ext_init(struct nf_conn *ct, gfp_t gfp);
+static inline void nf_ct_ext_init(struct nf_conn *ct, gfp_t gfp)
+{
+	__nf_ct_ext_init(ct, gfp);
+}
+
 /* Destroy all relationships */
 extern void __nf_ct_ext_destroy(struct nf_conn *ct);
 static inline void nf_ct_ext_destroy(struct nf_conn *ct)
@@ -65,6 +72,8 @@ __nf_ct_ext_add(struct nf_conn *ct, enum nf_ct_ext_id id, gfp_t gfp);
 
 struct nf_ct_ext_type
 {
+	/* Initializes relationships (can be NULL). */
+	void *(*init)(struct nf_conn *ct, gfp_t gfp);
 	/* Destroys relationships (can be NULL). */
 	void (*destroy)(struct nf_conn *ct);
 	/* Called when realloacted (can be NULL).
net/netfilter/nf_conntrack_core.c +1 -0
index da56b26..c513f22 100644
@@ -559,6 +559,7 @@ init_conntrack(struct net *net,
 		return NULL;
 	}
 
+	nf_ct_ext_init(ct, GFP_ATOMIC);
 	nf_ct_acct_ext_add(ct, GFP_ATOMIC);
 
 	spin_lock_bh(&nf_conntrack_lock);
net/netfilter/nf_conntrack_extend.c +17 -0
index 4b2c769..7b728c4 100644
@@ -19,6 +19,23 @@
 static struct nf_ct_ext_type *nf_ct_ext_types[NF_CT_EXT_NUM];
 static DEFINE_MUTEX(nf_ct_ext_type_mutex);
 
+void __nf_ct_ext_init(struct nf_conn *ct, gfp_t gfp)
+{
+	unsigned int i;
+	struct nf_ct_ext_type *t;
+
+	for (i = 0; i < NF_CT_EXT_NUM; i++) {
+		rcu_read_lock();
+		t = rcu_dereference(nf_ct_ext_types[i]);
+
+		if (t && t->init)
+			t->init(ct, gfp);
+		rcu_read_unlock();
+	}
+
+}
+EXPORT_SYMBOL(__nf_ct_ext_init);
+
 void __nf_ct_ext_destroy(struct nf_conn *ct)
 {
 	unsigned int i;
net/netfilter/nf_conntrack_netlink.c +1 -0
index 918a335..3799b6c 100644
@@ -1165,6 +1165,7 @@ ctnetlink_create_conntrack(struct nlattr *cda[],
 		}
 	}
 
+	nf_ct_ext_init(ct, GFP_KERNEL);
 	nf_ct_acct_ext_add(ct, GFP_KERNEL);
 
 #if defined(CONFIG_NF_CONNTRACK_MARK)
Signature · 1 line
1.5.5.1

From 8a7a19feae4a7f29faac0fcde2b279f5a5bb915a Mon Sep 17 00:00:00 2001
From: James King <[email protected]>
Date: Fri, 3 Oct 2008 04:51:18 -0700
Subject: [PATCH 2/3] ct_extend: convert nf_conntrack_acct to use init callback

The original nf_conntrack_acct patch called nf_ct_acct_ext_add() directly from init_conntrack() and ctnetlink_create_conntrack() (because ct_extend private areas can only be added before the conntrack is confirmed, the best place to do so is when the conntrack is initially allocated). Convert this call to use the new ct_extend init callback. Also prevent an automatic allocation in nf_ct_acct_ext_add() when accounting is disabled.

---
 include/net/netfilter/nf_conntrack_acct.h |   23 +++++++++++------------
 net/netfilter/nf_conntrack_acct.c         |    1 +
 net/netfilter/nf_conntrack_core.c         |    1 -
 net/netfilter/nf_conntrack_netlink.c      |    1 -
 4 files changed, 12 insertions(+), 14 deletions(-)
include/net/netfilter/nf_conntrack_acct.h +11 -12
index 5d5ae55..c6d06d1 100644
@@ -26,21 +26,20 @@ struct nf_conn_counter *nf_conn_acct_find(const struct nf_conn *ct)
 	return nf_ct_ext_find(ct, NF_CT_EXT_ACCT);
 }
 
-static inline
-struct nf_conn_counter *nf_ct_acct_ext_add(struct nf_conn *ct, gfp_t gfp)
+static
+void *nf_ct_acct_ext_add(struct nf_conn *ct, gfp_t gfp)
 {
-	struct nf_conn_counter *acct;
-
-	if (!nf_ct_acct)
-		return NULL;
-
-	acct = nf_ct_ext_add(ct, NF_CT_EXT_ACCT, gfp);
-	if (!acct)
-		pr_debug("failed to add accounting extension area");
+	if (nf_ct_acct) {
 
+		struct nf_conn_counter *acct;
 
-	return acct;
-};
+		acct = nf_ct_ext_add(ct, NF_CT_EXT_ACCT, gfp);
+		if (!acct)
+			pr_debug("nf_conntrack_acct: failed to add extension area");
+		return acct;
+	}
+	return NULL;
+}
 
 extern unsigned int
 seq_print_acct(struct seq_file *s, const struct nf_conn *ct, int dir);
net/netfilter/nf_conntrack_acct.c +1 -0
index 59bd8b9..c7cd3b1 100644
@@ -61,6 +61,7 @@ EXPORT_SYMBOL_GPL(seq_print_acct);
 static struct nf_ct_ext_type acct_extend __read_mostly = {
 	.len	= sizeof(struct nf_conn_counter[IP_CT_DIR_MAX]),
 	.align	= __alignof__(struct nf_conn_counter[IP_CT_DIR_MAX]),
+	.init   = nf_ct_acct_ext_add,
 	.id	= NF_CT_EXT_ACCT,
 };
 
net/netfilter/nf_conntrack_core.c +0 -1
index c513f22..5b5e6a3 100644
@@ -560,7 +560,6 @@ init_conntrack(struct net *net,
 	}
 
 	nf_ct_ext_init(ct, GFP_ATOMIC);
-	nf_ct_acct_ext_add(ct, GFP_ATOMIC);
 
 	spin_lock_bh(&nf_conntrack_lock);
 	exp = nf_ct_find_expectation(tuple);
net/netfilter/nf_conntrack_netlink.c +0 -1
index 3799b6c..8d3ea03 100644
@@ -1166,7 +1166,6 @@ ctnetlink_create_conntrack(struct nlattr *cda[],
 	}
 
 	nf_ct_ext_init(ct, GFP_KERNEL);
-	nf_ct_acct_ext_add(ct, GFP_KERNEL);
 
 #if defined(CONFIG_NF_CONNTRACK_MARK)
 	if (cda[CTA_MARK])
Signature · 1 line
1.5.5.1

From ad51c916b4c143e865fd9593a6073b610ffb74fe Mon Sep 17 00:00:00 2001
From: James King <[email protected]>
Date: Fri, 3 Oct 2008 04:52:34 -0700
Subject: [PATCH 3/3] ct_extend: add support for layer7 extension type

Add NF_CT_EXT_LAYER7 enum to nf_ct_ext_id

---
 include/net/netfilter/nf_conntrack_extend.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
include/net/netfilter/nf_conntrack_extend.h +1 -0
index f938395..9418c48 100644
@@ -8,6 +8,7 @@ enum nf_ct_ext_id
 	NF_CT_EXT_HELPER,
 	NF_CT_EXT_NAT,
 	NF_CT_EXT_ACCT,
+	NF_CT_EXT_LAYER7,
 	NF_CT_EXT_NUM,
 };
 
Signature · 1 line
1.5.5.1

From 02c2cb1a2d992b378f5c77cc4290e9c718504ef1 Mon Sep 17 00:00:00 2001
From: James King <[email protected]>
Date: Fri, 3 Oct 2008 10:44:36 -0700
Subject: [PATCH] xtables-addons: import layer7 module

Import layer7 module (mostly) cleaned up for codingstyle and converted to use ct_extend instead of patching the nf_conn structure.

---
 extensions/Kbuild            |    1 +
 extensions/Mbuild            |    1 +
 extensions/libxt_layer7.c    |  393 ++++++++++++++
 extensions/libxt_layer7.man  |   14 +
 extensions/regexp/regexp.c   | 1211 ++++++++++++++++++++++++++++++++++++++++++
 extensions/regexp/regexp.h   |   41 ++
 extensions/regexp/regmagic.h |    5 +
 extensions/regexp/regsub.c   |   97 ++++
 extensions/xt_layer7.c       |  703 ++++++++++++++++++++++++
 extensions/xt_layer7.h       |   67 +++
 mconfig                      |    1 +
 11 files changed, 2534 insertions(+), 0 deletions(-)
 create mode 100644 extensions/libxt_layer7.c
 create mode 100644 extensions/libxt_layer7.man
 create mode 100644 extensions/regexp/regexp.c
 create mode 100644 extensions/regexp/regexp.h
 create mode 100644 extensions/regexp/regmagic.h
 create mode 100644 extensions/regexp/regsub.c
 create mode 100644 extensions/xt_layer7.c
 create mode 100644 extensions/xt_layer7.h
extensions/Kbuild +1 -0
index 2717b31..e07be7d 100644
@@ -18,6 +18,7 @@ obj-${build_condition}   += xt_condition.o
 obj-${build_fuzzy}       += xt_fuzzy.o
 obj-${build_geoip}       += xt_geoip.o
 obj-${build_ipp2p}       += xt_ipp2p.o
+obj-${build_layer7}      += xt_layer7.o
 obj-${build_ipset}       += ipset/
 obj-${build_portscan}    += xt_portscan.o
 obj-${build_quota2}      += xt_quota2.o
extensions/Mbuild +1 -0
index d19da8e..9d3e8a8 100644
@@ -11,5 +11,6 @@ obj-${build_condition}   += libxt_condition.so
 obj-${build_fuzzy}       += libxt_fuzzy.so
 obj-${build_geoip}       += libxt_geoip.so
 obj-${build_ipp2p}       += libxt_ipp2p.so
+obj-${build_layer7}      += libxt_layer7.so
 obj-${build_portscan}    += libxt_portscan.so
 obj-${build_quota2}      += libxt_quota2.so
extensions/libxt_layer7.c new file +393 -0

393 lines not on this page · raw message

extensions/libxt_layer7.man new file +14 -0
new file mode 100644
index 0000000..83a8c53
@@ -0,0 +1,14 @@
+This module matches packets based on the application layer data of 
+their connections.  It uses regular expression matching to compare 
+the application layer data to regular expressions found it the layer7 
+configuration files.  This is an experimental module which can be found at 
+http://l7-filter.sf.net.  It takes two options.
+.TP
+.BI "--l7proto " "\fIprotocol\fP"
+Match the specified protocol.  The protocol name must match a file 
+name in /etc/l7-protocols/ or one of its first-level child directories.
+.TP
+.BI "--l7dir " "\fIdirectory\fP"
+Use \fIdirectory\fP instead of /etc/l7-protocols/.  This option must be 
+specified before --l7proto.
+
extensions/regexp/regexp.c new file +1211 -0

1,211 lines not on this page · raw message

extensions/regexp/regexp.h new file +41 -0

41 lines not on this page · raw message

extensions/regexp/regmagic.h new file +5 -0
new file mode 100644
index 0000000..5acf447
@@ -0,0 +1,5 @@
+/*
+ * The first byte of the regexp internal "program" is actually this magic
+ * number; the start node begins in the second byte.
+ */
+#define	MAGIC	0234
extensions/regexp/regsub.c new file +97 -0

97 lines not on this page · raw message

extensions/xt_layer7.c new file +703 -0

703 lines not on this page · raw message

extensions/xt_layer7.h new file +67 -0

67 lines not on this page · raw message

mconfig +1 -0
index 5fe5828..3aba7ec 100644
@@ -14,5 +14,6 @@ build_fuzzy=m
 build_geoip=m
 build_ipp2p=m
 build_ipset=m
+build_layer7=m
 build_portscan=m
 build_quota2=m
Signature · 1 line
1.5.5.1
#1 lore raw
Quoted 4 lines · James King

I've re-written xt_layer7 (l7-filter) so that it not longer requires patching of the nf_conn structure for data storage, using ct_extend instead, with the goal that it can eventually be used against a vanilla kernel with an unpatched iptables.

I had the same idea too a while back but put off on it - busy with other iptables things :)

Right now, you still cannot use it with a vanilla kernel because patches like #3 you attached enlarges the allocated region (remember, NF_CT_EXT_NUM just increased by one!), which is going to be a big impact {for users not using all the extensions} {if every imaginable extensions adds itself a NF_CT_EXT_ number}.

Can someone think of a way to nicely fix this up? Like, a linked list instead of the ct_extend[] array perhaps? Yes yes, that's not O(1), but how many extensions at a time are you using anyway!

Quoted 5 lines

One thing I haven't worked out is the following warning that results during a kernel compile now, any pointers on how to fix would be great:
include/net/netfilter/nf_conntrack_acct.h:31: warning:
nf_ct_acct_ext_add defined but not used

Add the "inline" keyword to the function header:

static inline
void *nf_ct_acct_ext_add( .....

#2 lore raw
Quoted 16 lines · Jan Engelhardt
Quoted 4 lines · James King

I've re-written xt_layer7 (l7-filter) so that it not longer requires patching of the nf_conn structure for data storage, using ct_extend instead, with the goal that it can eventually be used against a vanilla kernel with an unpatched iptables.

I had the same idea too a while back but put off on it - busy with other iptables things :)

Right now, you still cannot use it with a vanilla kernel because patches like #3 you attached enlarges the allocated region (remember, NF_CT_EXT_NUM just increased by one!), which is going to be a big impact {for users not using all the extensions} {if every imaginable extensions adds itself a NF_CT_EXT_ number}.

Quoted 3 lines

Can someone think of a way to nicely fix this up? Like, a linked list instead of the ct_extend[] array perhaps? Yes yes, that's not O(1), but how many extensions at a time are you using anyway!

That would have a pretty big storage and runtime impact, I don't think its a good idea.

I think I could agree to add something like a NF_CT_EXT_LIST extensions that wouldn't be used by mainline, but you could use it for xtables-addons. There's some padding in nf_ct_ext so it would (currently) not have any negative impact on mainline. I haven't spent much though on this so it might not work though.

author
#3 lore raw
Quoted 9 lines · Patrick McHardy
Quoted 8 lines · Jan Engelhardt
Quoted 4 lines · James King

I've re-written xt_layer7 (l7-filter) so that it not longer requires patching of the nf_conn structure for data storage, using ct_extend instead, with the goal that it can eventually be used against a vanilla kernel with an unpatched iptables.

Quoted 5 lines
Quoted 5 lines

Right now, you still cannot use it with a vanilla kernel because patches like #3 you attached enlarges the allocated region (remember, NF_CT_EXT_NUM just increased by one!), which is going to be a big impact {for users not using all the extensions} {if every imaginable extensions adds itself a NF_CT_EXT_ number}.

update_alloc_size() skips over unregistered extensions, and it's a bug to pass (id == NULL) to nf_ct_ext_add() or nf_ct_ext_create(), so unused extensions shouldn't really impact memory allocation in terms of allocated region size. Under patch #3, nf_cf_ext_types[] has a single size increase by sizeof(nf_ct_ext_type), and it increases ct->ext->offset by one u8 (so per-conntrack increase). Is this size increase alone enough to rule it out, or am I missing something else here?

Quoted 5 lines

I think I could agree to add something like a NF_CT_EXT_LIST extensions that wouldn't be used by mainline, but you could use it for xtables-addons. There's some padding in nf_ct_ext so it would (currently) not have any negative impact on mainline. I haven't spent much though on this so it might not work though.

If adding NF_CT_EXT_LAYER7 is a no-go, I could give this a try, but I doubt I'd have a chance to get it done before the next merge window closes (I was hoping to have this available for 2.6.28). It would have the same size increases noted above though, so there really wouldn't be any difference between the two approaches (at least until xt_layer7 is no longer the sole user).

How are the first two patches? Layering the allocation inside of a LIST extension would probably require them anyways.

Regards,
James

#4 lore raw
Quoted 7 lines · James King
Quoted 7 lines
Quoted 6 lines · Jan Engelhardt

Right now, you still cannot use it with a vanilla kernel because patches like #3 you attached enlarges the allocated region (remember, NF_CT_EXT_NUM just increased by one!), which is going to be a big impact {for users not using all the extensions} {if every imaginable extensions adds itself a NF_CT_EXT_ number}.

Let me rephrase that one: you cannot use layer7 with vanilla right now because patch #3 is not in vanilla [yet] ;-)

Quoted 8 lines

update_alloc_size() skips over unregistered extensions, and it's a bug to pass (id == NULL) to nf_ct_ext_add() or nf_ct_ext_create(), so unused extensions shouldn't really impact memory allocation in terms of allocated region size. Under patch #3, nf_cf_ext_types[] has a single size increase by sizeof(nf_ct_ext_type), and it increases ct->ext->offset by one u8 (so per-conntrack increase). Is this size increase alone enough to rule it out, or am I missing something else here?

What I meant is the offset[] array. If we were to add 1000 new ct extensions, all users of the particular kernel would pay 1000 bytes for space they will never fully use.
Additionally, NF_CT_EXT_NUM might be too undersized for
*yet more* modules (e.g. out-of-tree) to register their stuff. It's like tcp port numbers - the number is only finite.
A linked list would "solve" this (allow for infinitely many extensions, well, as long as your memory holds it), but of course at the cost of traversing it, etc. as Patrick pointed out.

I am not against these patches - over time, we only accumulated 2 modules, and maybe there is not that much of a market for more than a handul ones.

author
#5 lore raw
Quoted 21 lines · Jan Engelhardt
Quoted 8 lines · James King

update_alloc_size() skips over unregistered extensions, and it's a bug to pass (id == NULL) to nf_ct_ext_add() or nf_ct_ext_create(), so unused extensions shouldn't really impact memory allocation in terms of allocated region size. Under patch #3, nf_cf_ext_types[] has a single size increase by sizeof(nf_ct_ext_type), and it increases ct->ext->offset by one u8 (so per-conntrack increase). Is this size increase alone enough to rule it out, or am I missing something else here?

What I meant is the offset[] array. If we were to add 1000 new ct extensions, all users of the particular kernel would pay 1000 bytes for space they will never fully use.
Additionally, NF_CT_EXT_NUM might be too undersized for
*yet more* modules (e.g. out-of-tree) to register their stuff. It's like tcp port numbers - the number is only finite.
A linked list would "solve" this (allow for infinitely many extensions, well, as long as your memory holds it), but of course at the cost of traversing it, etc. as Patrick pointed out.

Quoted 3 lines

I am not against these patches - over time, we only accumulated 2 modules, and maybe there is not that much of a market for more than a handul ones.

Ah, ok, your first response felt like a NAK, thanks for clarifying. I agree that being able dynamically register unknown extensions in that fashion could be useful in the long run if lots of extensions were to start popping up, but at this point it's an dead even tradeoff between the two approaches, and my immediate goal is to get a module that many people already find very useful supported without an unnecessary patching process.

author
#6 lore raw
Quoted 26 lines · James King
Quoted 21 lines · Jan Engelhardt
Quoted 8 lines · James King

update_alloc_size() skips over unregistered extensions, and it's a bug to pass (id == NULL) to nf_ct_ext_add() or nf_ct_ext_create(), so unused extensions shouldn't really impact memory allocation in terms of allocated region size. Under patch #3, nf_cf_ext_types[] has a single size increase by sizeof(nf_ct_ext_type), and it increases ct->ext->offset by one u8 (so per-conntrack increase). Is this size increase alone enough to rule it out, or am I missing something else here?

What I meant is the offset[] array. If we were to add 1000 new ct extensions, all users of the particular kernel would pay 1000 bytes for space they will never fully use.
Additionally, NF_CT_EXT_NUM might be too undersized for
*yet more* modules (e.g. out-of-tree) to register their stuff. It's like tcp port numbers - the number is only finite.
A linked list would "solve" this (allow for infinitely many extensions, well, as long as your memory holds it), but of course at the cost of traversing it, etc. as Patrick pointed out.

Quoted 3 lines

I am not against these patches - over time, we only accumulated 2 modules, and maybe there is not that much of a market for more than a handul ones.

Quoted 7 lines

Ah, ok, your first response felt like a NAK, thanks for clarifying. I agree that being able dynamically register unknown extensions in that fashion could be useful in the long run if lots of extensions were to start popping up, but at this point it's an dead even tradeoff between the two approaches, and my immediate goal is to get a module that many people already find very useful supported without an unnecessary patching process.

Patrick, do you have any objections to these patches (specifically adding NF_CT_EXT_LAYER7), or were you just against Jan's suggestion to make ct_extend to use a linked list for all extensions? If not, would you like me to send a proper patch series?

#7 lore raw
Quoted 6 lines · James King

Patrick, do you have any objections to these patches (specifically adding NF_CT_EXT_LAYER7), or were you just against Jan's suggestion to make ct_extend to use a linked list for all extensions? If not, would you like me to send a proper patch series?

It is well understood that a linked list incurs a “rather signifcant” runtime hit. Due to simple lack of mass of extensions, we should just go for the patch for now.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#8 lore raw
Quoted 9 lines · Jan Engelhardt
Quoted 5 lines · James King

Patrick, do you have any objections to these patches (specifically adding NF_CT_EXT_LAYER7), or were you just against Jan's suggestion to make ct_extend to use a linked list for all extensions? If not, would you like me to send a proper patch series?

It is well understood that a linked list incurs a “rather signifcant” runtime hit. Due to simple lack of mass of extensions, we should just go for the patch for now.

So you want to keep this externally? Fine by me of course :)

As I stated, I could probably be convinced to add a NF_CT_EXT_LIST extension where you could dynamically add things since its currently for free. But it might be too complicated since I think you would have to duplicate quite a bit of the ct_extend logic.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html