diff options
author | Alexey Dobriyan <adobriyan@sw.ru> | 2008-01-31 07:02:13 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-31 22:27:35 -0500 |
commit | 8d870052079d255917ec4f8431f5ec102707b7af (patch) | |
tree | 77ab4f07ef4980d179c4e47d3a6e034c055f9bdf /include | |
parent | a98da11d88dbec1d5cebe2c6dbe9939ed8d13f69 (diff) |
[NETFILTER]: x_tables: per-netns xt_tables
In fact all we want is per-netns set of rules, however doing that will
unnecessary complicate routines such as ipt_hook()/ipt_do_table, so
make full xt_table array per-netns.
Every user stubbed with init_net for a while.
Signed-off-by: Alexey Dobriyan <adobriyan@sw.ru>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/netfilter/x_tables.h | 6 | ||||
-rw-r--r-- | include/net/net_namespace.h | 4 | ||||
-rw-r--r-- | include/net/netns/x_tables.h | 10 |
3 files changed, 18 insertions, 2 deletions
diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h index 937cebb3ab54..91a1dd5b9c66 100644 --- a/include/linux/netfilter/x_tables.h +++ b/include/linux/netfilter/x_tables.h | |||
@@ -335,7 +335,8 @@ extern int xt_check_target(const struct xt_target *target, unsigned short family | |||
335 | unsigned int size, const char *table, unsigned int hook, | 335 | unsigned int size, const char *table, unsigned int hook, |
336 | unsigned short proto, int inv_proto); | 336 | unsigned short proto, int inv_proto); |
337 | 337 | ||
338 | extern struct xt_table *xt_register_table(struct xt_table *table, | 338 | extern struct xt_table *xt_register_table(struct net *net, |
339 | struct xt_table *table, | ||
339 | struct xt_table_info *bootstrap, | 340 | struct xt_table_info *bootstrap, |
340 | struct xt_table_info *newinfo); | 341 | struct xt_table_info *newinfo); |
341 | extern void *xt_unregister_table(struct xt_table *table); | 342 | extern void *xt_unregister_table(struct xt_table *table); |
@@ -352,7 +353,8 @@ extern struct xt_target *xt_request_find_target(int af, const char *name, | |||
352 | extern int xt_find_revision(int af, const char *name, u8 revision, int target, | 353 | extern int xt_find_revision(int af, const char *name, u8 revision, int target, |
353 | int *err); | 354 | int *err); |
354 | 355 | ||
355 | extern struct xt_table *xt_find_table_lock(int af, const char *name); | 356 | extern struct xt_table *xt_find_table_lock(struct net *net, int af, |
357 | const char *name); | ||
356 | extern void xt_table_unlock(struct xt_table *t); | 358 | extern void xt_table_unlock(struct xt_table *t); |
357 | 359 | ||
358 | extern int xt_proto_init(int af); | 360 | extern int xt_proto_init(int af); |
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h index b8c1d60ba9e4..28738b7d53eb 100644 --- a/include/net/net_namespace.h +++ b/include/net/net_namespace.h | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <net/netns/packet.h> | 12 | #include <net/netns/packet.h> |
13 | #include <net/netns/ipv4.h> | 13 | #include <net/netns/ipv4.h> |
14 | #include <net/netns/ipv6.h> | 14 | #include <net/netns/ipv6.h> |
15 | #include <net/netns/x_tables.h> | ||
15 | 16 | ||
16 | struct proc_dir_entry; | 17 | struct proc_dir_entry; |
17 | struct net_device; | 18 | struct net_device; |
@@ -56,6 +57,9 @@ struct net { | |||
56 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | 57 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) |
57 | struct netns_ipv6 ipv6; | 58 | struct netns_ipv6 ipv6; |
58 | #endif | 59 | #endif |
60 | #ifdef CONFIG_NETFILTER | ||
61 | struct netns_xt xt; | ||
62 | #endif | ||
59 | }; | 63 | }; |
60 | 64 | ||
61 | #ifdef CONFIG_NET | 65 | #ifdef CONFIG_NET |
diff --git a/include/net/netns/x_tables.h b/include/net/netns/x_tables.h new file mode 100644 index 000000000000..0cb63ed2c1fc --- /dev/null +++ b/include/net/netns/x_tables.h | |||
@@ -0,0 +1,10 @@ | |||
1 | #ifndef __NETNS_X_TABLES_H | ||
2 | #define __NETNS_X_TABLES_H | ||
3 | |||
4 | #include <linux/list.h> | ||
5 | #include <linux/net.h> | ||
6 | |||
7 | struct netns_xt { | ||
8 | struct list_head tables[NPROTO]; | ||
9 | }; | ||
10 | #endif | ||