[RFC v2 2/7] net: netfilter conntrack - add per-net functionality for DCCP protocol

Previous thread: [RFC v2 4/7] net: netfilter conntrack - add per-net functionality for UDPLITE protocol by Cyrill Gorcunov on Wednesday, March 11, 2009 - 1:57 pm. (2 messages)

Next thread: [RFC v2 3/7] net: netfilter conntrack - add per-net functionality for SCTP protocol by Cyrill Gorcunov on Wednesday, March 11, 2009 - 1:57 pm. (9 messages)
From: Cyrill Gorcunov
Date: Wednesday, March 11, 2009 - 1:57 pm

Module specific data moved into per-net site and being allocated/freed
during net namespace creation/deletion.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
---
 net/netfilter/nf_conntrack_proto_dccp.c |  145 +++++++++++++++++++++++---------
 1 file changed, 108 insertions(+), 37 deletions(-)

Index: linux-2.6.git/net/netfilter/nf_conntrack_proto_dccp.c
===================================================================
--- linux-2.6.git.orig/net/netfilter/nf_conntrack_proto_dccp.c
+++ linux-2.6.git/net/netfilter/nf_conntrack_proto_dccp.c
@@ -16,6 +16,9 @@
 #include <linux/skbuff.h>
 #include <linux/dccp.h>
 
+#include <net/net_namespace.h>
+#include <net/netns/generic.h>
+
 #include <linux/netfilter/nfnetlink_conntrack.h>
 #include <net/netfilter/nf_conntrack.h>
 #include <net/netfilter/nf_conntrack_l4proto.h>
@@ -23,8 +26,6 @@
 
 static DEFINE_RWLOCK(dccp_lock);
 
-static int nf_ct_dccp_loose __read_mostly = 1;
-
 /* Timeouts are based on values from RFC4340:
  *
  * - REQUEST:
@@ -72,16 +73,6 @@ static int nf_ct_dccp_loose __read_mostl
 
 #define DCCP_MSL (2 * 60 * HZ)
 
-static unsigned int dccp_timeout[CT_DCCP_MAX + 1] __read_mostly = {
-	[CT_DCCP_REQUEST]	= 2 * DCCP_MSL,
-	[CT_DCCP_RESPOND]	= 4 * DCCP_MSL,
-	[CT_DCCP_PARTOPEN]	= 4 * DCCP_MSL,
-	[CT_DCCP_OPEN]		= 12 * 3600 * HZ,
-	[CT_DCCP_CLOSEREQ]	= 64 * HZ,
-	[CT_DCCP_CLOSING]	= 64 * HZ,
-	[CT_DCCP_TIMEWAIT]	= 2 * DCCP_MSL,
-};
-
 static const char * const dccp_state_names[] = {
 	[CT_DCCP_NONE]		= "NONE",
 	[CT_DCCP_REQUEST]	= "REQUEST",
@@ -393,6 +384,22 @@ dccp_state_table[CT_DCCP_ROLE_MAX + 1][D
 	},
 };
 
+/* this module per-net specifics */
+static int dccp_net_id;
+struct dccp_net {
+	int dccp_loose;
+	unsigned int dccp_timeout[CT_DCCP_MAX + 1];
+#ifdef CONFIG_SYSCTL
+	struct ctl_table_header *sysctl_header;
+	struct ctl_table *sysctl_table;
+#endif
+};
+
+static inline struct dccp_net *dccp_pernet(struct net *net)
+{
+	return net_generic(net, dccp_net_id);
+}
+
 static ...
From: Daniel Lezcano
Date: Thursday, March 12, 2009 - 1:54 am

Acked-by: Daniel Lezcano <daniel.lezcano@free.fr>
--

From: Patrick McHardy
Date: Monday, March 16, 2009 - 8:31 am

Applied, thanks.
--

Previous thread: [RFC v2 4/7] net: netfilter conntrack - add per-net functionality for UDPLITE protocol by Cyrill Gorcunov on Wednesday, March 11, 2009 - 1:57 pm. (2 messages)

Next thread: [RFC v2 3/7] net: netfilter conntrack - add per-net functionality for SCTP protocol by Cyrill Gorcunov on Wednesday, March 11, 2009 - 1:57 pm. (9 messages)