diff options
author | Alexey Dobriyan <adobriyan@gmail.com> | 2008-10-08 05:35:02 -0400 |
---|---|---|
committer | Patrick McHardy <kaber@trash.net> | 2008-10-08 05:35:02 -0400 |
commit | dfdb8d791877052bbb527d9688d94a064721d8f7 (patch) | |
tree | 1aba6921536f1d3244c8967033edefd2bbcf4812 /net | |
parent | e10aad9998e463df8e25ec749538faf3324dd31b (diff) |
netfilter: netns nf_conntrack: add netns boilerplate
One comment: #ifdefs around #include is necessary to overcome amazing compile
breakages in NOTRACK-in-netns patch (see below).
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Diffstat (limited to 'net')
-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 |
3 files changed, 22 insertions, 7 deletions
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); |