diff options
author | Gao feng <gaofeng@cn.fujitsu.com> | 2013-01-21 17:10:33 -0500 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2013-01-23 08:39:20 -0500 |
commit | 6330750d566d764ce4916d8fe2bcdcad28fc7a42 (patch) | |
tree | ed0aaaabedb35628bf9ef5a4a459a1c52773714b /net/ipv4 | |
parent | 04d870017908f40bbb1c51910acc030ae4979db4 (diff) |
netfilter: nf_conntrack: refactor l3proto support for netns
Move the code that register/unregister l3proto to the
module_init/exit context.
Given that we have to modify some interfaces to accomodate
these changes, it is a good time to use shorter function names
for this using the nf_ct_* prefix instead of nf_conntrack_*,
that is:
nf_ct_l3proto_register
nf_ct_l3proto_pernet_register
nf_ct_l3proto_unregister
nf_ct_l3proto_pernet_unregister
We same many line breaks with it.
Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net/ipv4')
-rw-r--r-- | net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c index fcdd0c2406e6..76b84fc9acfc 100644 --- a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c +++ b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c | |||
@@ -438,10 +438,9 @@ static int ipv4_net_init(struct net *net) | |||
438 | pr_err("nf_conntrack_l4proto_icmp4 :protocol register failed\n"); | 438 | pr_err("nf_conntrack_l4proto_icmp4 :protocol register failed\n"); |
439 | goto out_icmp; | 439 | goto out_icmp; |
440 | } | 440 | } |
441 | ret = nf_conntrack_l3proto_register(net, | 441 | ret = nf_ct_l3proto_pernet_register(net, &nf_conntrack_l3proto_ipv4); |
442 | &nf_conntrack_l3proto_ipv4); | ||
443 | if (ret < 0) { | 442 | if (ret < 0) { |
444 | pr_err("nf_conntrack_l3proto_ipv4 :protocol register failed\n"); | 443 | pr_err("nf_conntrack_ipv4: pernet registration failed\n"); |
445 | goto out_ipv4; | 444 | goto out_ipv4; |
446 | } | 445 | } |
447 | return 0; | 446 | return 0; |
@@ -460,8 +459,7 @@ out_tcp: | |||
460 | 459 | ||
461 | static void ipv4_net_exit(struct net *net) | 460 | static void ipv4_net_exit(struct net *net) |
462 | { | 461 | { |
463 | nf_conntrack_l3proto_unregister(net, | 462 | nf_ct_l3proto_pernet_unregister(net, &nf_conntrack_l3proto_ipv4); |
464 | &nf_conntrack_l3proto_ipv4); | ||
465 | nf_conntrack_l4proto_unregister(net, | 463 | nf_conntrack_l4proto_unregister(net, |
466 | &nf_conntrack_l4proto_icmp); | 464 | &nf_conntrack_l4proto_icmp); |
467 | nf_conntrack_l4proto_unregister(net, | 465 | nf_conntrack_l4proto_unregister(net, |
@@ -500,16 +498,25 @@ static int __init nf_conntrack_l3proto_ipv4_init(void) | |||
500 | pr_err("nf_conntrack_ipv4: can't register hooks.\n"); | 498 | pr_err("nf_conntrack_ipv4: can't register hooks.\n"); |
501 | goto cleanup_pernet; | 499 | goto cleanup_pernet; |
502 | } | 500 | } |
501 | |||
502 | ret = nf_ct_l3proto_register(&nf_conntrack_l3proto_ipv4); | ||
503 | if (ret < 0) { | ||
504 | pr_err("nf_conntrack_ipv4: can't register ipv4 proto.\n"); | ||
505 | goto cleanup_hooks; | ||
506 | } | ||
507 | |||
503 | #if defined(CONFIG_PROC_FS) && defined(CONFIG_NF_CONNTRACK_PROC_COMPAT) | 508 | #if defined(CONFIG_PROC_FS) && defined(CONFIG_NF_CONNTRACK_PROC_COMPAT) |
504 | ret = nf_conntrack_ipv4_compat_init(); | 509 | ret = nf_conntrack_ipv4_compat_init(); |
505 | if (ret < 0) | 510 | if (ret < 0) |
506 | goto cleanup_hooks; | 511 | goto cleanup_proto; |
507 | #endif | 512 | #endif |
508 | return ret; | 513 | return ret; |
509 | #if defined(CONFIG_PROC_FS) && defined(CONFIG_NF_CONNTRACK_PROC_COMPAT) | 514 | #if defined(CONFIG_PROC_FS) && defined(CONFIG_NF_CONNTRACK_PROC_COMPAT) |
515 | cleanup_proto: | ||
516 | nf_ct_l3proto_unregister(&nf_conntrack_l3proto_ipv4); | ||
517 | #endif | ||
510 | cleanup_hooks: | 518 | cleanup_hooks: |
511 | nf_unregister_hooks(ipv4_conntrack_ops, ARRAY_SIZE(ipv4_conntrack_ops)); | 519 | nf_unregister_hooks(ipv4_conntrack_ops, ARRAY_SIZE(ipv4_conntrack_ops)); |
512 | #endif | ||
513 | cleanup_pernet: | 520 | cleanup_pernet: |
514 | unregister_pernet_subsys(&ipv4_net_ops); | 521 | unregister_pernet_subsys(&ipv4_net_ops); |
515 | cleanup_sockopt: | 522 | cleanup_sockopt: |
@@ -523,6 +530,7 @@ static void __exit nf_conntrack_l3proto_ipv4_fini(void) | |||
523 | #if defined(CONFIG_PROC_FS) && defined(CONFIG_NF_CONNTRACK_PROC_COMPAT) | 530 | #if defined(CONFIG_PROC_FS) && defined(CONFIG_NF_CONNTRACK_PROC_COMPAT) |
524 | nf_conntrack_ipv4_compat_fini(); | 531 | nf_conntrack_ipv4_compat_fini(); |
525 | #endif | 532 | #endif |
533 | nf_ct_l3proto_unregister(&nf_conntrack_l3proto_ipv4); | ||
526 | nf_unregister_hooks(ipv4_conntrack_ops, ARRAY_SIZE(ipv4_conntrack_ops)); | 534 | nf_unregister_hooks(ipv4_conntrack_ops, ARRAY_SIZE(ipv4_conntrack_ops)); |
527 | unregister_pernet_subsys(&ipv4_net_ops); | 535 | unregister_pernet_subsys(&ipv4_net_ops); |
528 | nf_unregister_sockopt(&so_getorigdst); | 536 | nf_unregister_sockopt(&so_getorigdst); |