From patchwork Fri Dec 28 02:36:45 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [18/19] netfilter: gre: move registration codes out of pernet_operations Date: Thu, 27 Dec 2012 16:36:45 -0000 From: Gao feng X-Patchwork-Id: 208381 Message-Id: <1356662206-2260-19-git-send-email-gaofeng@cn.fujitsu.com> To: netfilter-devel@vger.kernel.org Cc: netdev@vger.kernel.org, canqunzhang@gmail.com, kaber@trash.net, pablo@netfilter.org, ebiederm@xmission.com, Gao feng Move the proto (un)registration codes to the module_init/exit context. Signed-off-by: Gao feng --- net/netfilter/nf_conntrack_proto_gre.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/net/netfilter/nf_conntrack_proto_gre.c b/net/netfilter/nf_conntrack_proto_gre.c index f5f14c2..ea1f651 100644 --- a/net/netfilter/nf_conntrack_proto_gre.c +++ b/net/netfilter/nf_conntrack_proto_gre.c @@ -420,11 +420,25 @@ static struct pernet_operations proto_gre_net_ops = { static int __init nf_ct_proto_gre_init(void) { - return register_pernet_subsys(&proto_gre_net_ops); + int ret; + ret = nf_conntrack_l4proto_register(&nf_conntrack_l4proto_gre4); + if (ret < 0) + goto out_gre4; + + ret = register_pernet_subsys(&proto_gre_net_ops); + if (ret < 0) + goto out_pernet; + + return 0; +out_pernet: + nf_conntrack_l4proto_unregister(&nf_conntrack_l4proto_gre4); +out_gre4: + return ret; } static void __exit nf_ct_proto_gre_fini(void) { + nf_conntrack_l4proto_unregister(&nf_conntrack_l4proto_gre4); unregister_pernet_subsys(&proto_gre_net_ops); }