]> Pileus Git - ~andy/linux/blobdiff - net/netfilter/nf_conntrack_proto_gre.c
netfilter: nfnetlink_queue: add net namespace support for nfnetlink_queue
[~andy/linux] / net / netfilter / nf_conntrack_proto_gre.c
index b09b7af7f6f803414b962039e37d41df9fbb8a29..155ce9f8a0db047d0e100b1d0283b8b36cd6e082 100644 (file)
@@ -397,15 +397,15 @@ static struct nf_conntrack_l4proto nf_conntrack_l4proto_gre4 __read_mostly = {
 static int proto_gre_net_init(struct net *net)
 {
        int ret = 0;
-       ret = nf_conntrack_l4proto_register(net, &nf_conntrack_l4proto_gre4);
+       ret = nf_ct_l4proto_pernet_register(net, &nf_conntrack_l4proto_gre4);
        if (ret < 0)
-               pr_err("nf_conntrack_l4proto_gre4 :protocol register failed.\n");
+               pr_err("nf_conntrack_gre4: pernet registration failed.\n");
        return ret;
 }
 
 static void proto_gre_net_exit(struct net *net)
 {
-       nf_conntrack_l4proto_unregister(net, &nf_conntrack_l4proto_gre4);
+       nf_ct_l4proto_pernet_unregister(net, &nf_conntrack_l4proto_gre4);
        nf_ct_gre_keymap_flush(net);
 }
 
@@ -418,11 +418,26 @@ 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 = register_pernet_subsys(&proto_gre_net_ops);
+       if (ret < 0)
+               goto out_pernet;
+
+       ret = nf_ct_l4proto_register(&nf_conntrack_l4proto_gre4);
+       if (ret < 0)
+               goto out_gre4;
+
+       return 0;
+out_gre4:
+       unregister_pernet_subsys(&proto_gre_net_ops);
+out_pernet:
+       return ret;
 }
 
 static void __exit nf_ct_proto_gre_fini(void)
 {
+       nf_ct_l4proto_unregister(&nf_conntrack_l4proto_gre4);
        unregister_pernet_subsys(&proto_gre_net_ops);
 }