diff options
-rw-r--r-- | include/net/net_namespace.h | 6 | ||||
-rw-r--r-- | include/net/netfilter/nf_conntrack_core.h | 4 | ||||
-rw-r--r-- | include/net/netns/conntrack.h | 6 | ||||
-rw-r--r-- | net/netfilter/nf_conntrack_core.c | 4 | ||||
-rw-r--r-- | net/netfilter/nf_conntrack_expect.c | 4 | ||||
-rw-r--r-- | net/netfilter/nf_conntrack_standalone.c | 21 |
6 files changed, 36 insertions, 9 deletions
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h index a8eb43cf0c7e..708009be88b6 100644 --- a/include/net/net_namespace.h +++ b/include/net/net_namespace.h | |||
@@ -16,6 +16,9 @@ | |||
16 | #include <net/netns/ipv6.h> | 16 | #include <net/netns/ipv6.h> |
17 | #include <net/netns/dccp.h> | 17 | #include <net/netns/dccp.h> |
18 | #include <net/netns/x_tables.h> | 18 | #include <net/netns/x_tables.h> |
19 | #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) | ||
20 | #include <net/netns/conntrack.h> | ||
21 | #endif | ||
19 | 22 | ||
20 | struct proc_dir_entry; | 23 | struct proc_dir_entry; |
21 | struct net_device; | 24 | struct net_device; |
@@ -67,6 +70,9 @@ struct net { | |||
67 | #endif | 70 | #endif |
68 | #ifdef CONFIG_NETFILTER | 71 | #ifdef CONFIG_NETFILTER |
69 | struct netns_xt xt; | 72 | struct netns_xt xt; |
73 | #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) | ||
74 | struct netns_ct ct; | ||
75 | #endif | ||
70 | #endif | 76 | #endif |
71 | struct net_generic *gen; | 77 | struct net_generic *gen; |
72 | }; | 78 | }; |
diff --git a/include/net/netfilter/nf_conntrack_core.h b/include/net/netfilter/nf_conntrack_core.h index 05760d6a706e..532aa200cbc9 100644 --- a/include/net/netfilter/nf_conntrack_core.h +++ b/include/net/netfilter/nf_conntrack_core.h | |||
@@ -24,8 +24,8 @@ extern unsigned int nf_conntrack_in(u_int8_t pf, | |||
24 | unsigned int hooknum, | 24 | unsigned int hooknum, |
25 | struct sk_buff *skb); | 25 | struct sk_buff *skb); |
26 | 26 | ||
27 | extern int nf_conntrack_init(void); | 27 | extern int nf_conntrack_init(struct net *net); |
28 | extern void nf_conntrack_cleanup(void); | 28 | extern void nf_conntrack_cleanup(struct net *net); |
29 | 29 | ||
30 | extern int nf_conntrack_proto_init(void); | 30 | extern int nf_conntrack_proto_init(void); |
31 | extern void nf_conntrack_proto_fini(void); | 31 | extern void nf_conntrack_proto_fini(void); |
diff --git a/include/net/netns/conntrack.h b/include/net/netns/conntrack.h new file mode 100644 index 000000000000..82d80b834779 --- /dev/null +++ b/include/net/netns/conntrack.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __NETNS_CONNTRACK_H | ||
2 | #define __NETNS_CONNTRACK_H | ||
3 | |||
4 | struct netns_ct { | ||
5 | }; | ||
6 | #endif | ||
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c index 6aaf64b5dede..ee79e9325891 100644 --- a/net/netfilter/nf_conntrack_core.c +++ b/net/netfilter/nf_conntrack_core.c | |||
@@ -1006,7 +1006,7 @@ EXPORT_SYMBOL_GPL(nf_conntrack_flush); | |||
1006 | 1006 | ||
1007 | /* Mishearing the voices in his head, our hero wonders how he's | 1007 | /* Mishearing the voices in his head, our hero wonders how he's |
1008 | supposed to kill the mall. */ | 1008 | supposed to kill the mall. */ |
1009 | void nf_conntrack_cleanup(void) | 1009 | void nf_conntrack_cleanup(struct net *net) |
1010 | { | 1010 | { |
1011 | rcu_assign_pointer(ip_ct_attach, NULL); | 1011 | rcu_assign_pointer(ip_ct_attach, NULL); |
1012 | 1012 | ||
@@ -1120,7 +1120,7 @@ EXPORT_SYMBOL_GPL(nf_conntrack_set_hashsize); | |||
1120 | module_param_call(hashsize, nf_conntrack_set_hashsize, param_get_uint, | 1120 | module_param_call(hashsize, nf_conntrack_set_hashsize, param_get_uint, |
1121 | &nf_conntrack_htable_size, 0600); | 1121 | &nf_conntrack_htable_size, 0600); |
1122 | 1122 | ||
1123 | int __init nf_conntrack_init(void) | 1123 | int nf_conntrack_init(struct net *net) |
1124 | { | 1124 | { |
1125 | int max_factor = 8; | 1125 | int max_factor = 8; |
1126 | int ret; | 1126 | int ret; |
diff --git a/net/netfilter/nf_conntrack_expect.c b/net/netfilter/nf_conntrack_expect.c index 990fa12f2ee5..e6a79f2a7c53 100644 --- a/net/netfilter/nf_conntrack_expect.c +++ b/net/netfilter/nf_conntrack_expect.c | |||
@@ -537,7 +537,7 @@ static const struct file_operations exp_file_ops = { | |||
537 | }; | 537 | }; |
538 | #endif /* CONFIG_PROC_FS */ | 538 | #endif /* CONFIG_PROC_FS */ |
539 | 539 | ||
540 | static int __init exp_proc_init(void) | 540 | static int exp_proc_init(void) |
541 | { | 541 | { |
542 | #ifdef CONFIG_PROC_FS | 542 | #ifdef CONFIG_PROC_FS |
543 | struct proc_dir_entry *proc; | 543 | struct proc_dir_entry *proc; |
@@ -558,7 +558,7 @@ static void exp_proc_remove(void) | |||
558 | 558 | ||
559 | module_param_named(expect_hashsize, nf_ct_expect_hsize, uint, 0600); | 559 | module_param_named(expect_hashsize, nf_ct_expect_hsize, uint, 0600); |
560 | 560 | ||
561 | int __init nf_conntrack_expect_init(void) | 561 | int nf_conntrack_expect_init(void) |
562 | { | 562 | { |
563 | int err = -ENOMEM; | 563 | int err = -ENOMEM; |
564 | 564 | ||
diff --git a/net/netfilter/nf_conntrack_standalone.c b/net/netfilter/nf_conntrack_standalone.c index 8509db14670b..81dec17196df 100644 --- a/net/netfilter/nf_conntrack_standalone.c +++ b/net/netfilter/nf_conntrack_standalone.c | |||
@@ -440,11 +440,26 @@ static void nf_conntrack_standalone_fini_sysctl(void) | |||
440 | } | 440 | } |
441 | #endif /* CONFIG_SYSCTL */ | 441 | #endif /* CONFIG_SYSCTL */ |
442 | 442 | ||
443 | static int nf_conntrack_net_init(struct net *net) | ||
444 | { | ||
445 | return nf_conntrack_init(net); | ||
446 | } | ||
447 | |||
448 | static void nf_conntrack_net_exit(struct net *net) | ||
449 | { | ||
450 | nf_conntrack_cleanup(net); | ||
451 | } | ||
452 | |||
453 | static struct pernet_operations nf_conntrack_net_ops = { | ||
454 | .init = nf_conntrack_net_init, | ||
455 | .exit = nf_conntrack_net_exit, | ||
456 | }; | ||
457 | |||
443 | static int __init nf_conntrack_standalone_init(void) | 458 | static int __init nf_conntrack_standalone_init(void) |
444 | { | 459 | { |
445 | int ret; | 460 | int ret; |
446 | 461 | ||
447 | ret = nf_conntrack_init(); | 462 | ret = register_pernet_subsys(&nf_conntrack_net_ops); |
448 | if (ret < 0) | 463 | if (ret < 0) |
449 | goto out; | 464 | goto out; |
450 | ret = nf_conntrack_standalone_init_proc(); | 465 | ret = nf_conntrack_standalone_init_proc(); |
@@ -458,7 +473,7 @@ static int __init nf_conntrack_standalone_init(void) | |||
458 | out_sysctl: | 473 | out_sysctl: |
459 | nf_conntrack_standalone_fini_proc(); | 474 | nf_conntrack_standalone_fini_proc(); |
460 | out_proc: | 475 | out_proc: |
461 | nf_conntrack_cleanup(); | 476 | unregister_pernet_subsys(&nf_conntrack_net_ops); |
462 | out: | 477 | out: |
463 | return ret; | 478 | return ret; |
464 | } | 479 | } |
@@ -467,7 +482,7 @@ static void __exit nf_conntrack_standalone_fini(void) | |||
467 | { | 482 | { |
468 | nf_conntrack_standalone_fini_sysctl(); | 483 | nf_conntrack_standalone_fini_sysctl(); |
469 | nf_conntrack_standalone_fini_proc(); | 484 | nf_conntrack_standalone_fini_proc(); |
470 | nf_conntrack_cleanup(); | 485 | unregister_pernet_subsys(&nf_conntrack_net_ops); |
471 | } | 486 | } |
472 | 487 | ||
473 | module_init(nf_conntrack_standalone_init); | 488 | module_init(nf_conntrack_standalone_init); |