|
@@ -420,22 +420,19 @@ static int ipv4_net_init(struct net *net)
|
|
|
{
|
|
|
int ret = 0;
|
|
|
|
|
|
- ret = nf_conntrack_l4proto_register(net,
|
|
|
- &nf_conntrack_l4proto_tcp4);
|
|
|
+ ret = nf_ct_l4proto_pernet_register(net, &nf_conntrack_l4proto_tcp4);
|
|
|
if (ret < 0) {
|
|
|
- pr_err("nf_conntrack_l4proto_tcp4 :protocol register failed\n");
|
|
|
+ pr_err("nf_conntrack_tcp4: pernet registration failed\n");
|
|
|
goto out_tcp;
|
|
|
}
|
|
|
- ret = nf_conntrack_l4proto_register(net,
|
|
|
- &nf_conntrack_l4proto_udp4);
|
|
|
+ ret = nf_ct_l4proto_pernet_register(net, &nf_conntrack_l4proto_udp4);
|
|
|
if (ret < 0) {
|
|
|
- pr_err("nf_conntrack_l4proto_udp4 :protocol register failed\n");
|
|
|
+ pr_err("nf_conntrack_udp4: pernet registration failed\n");
|
|
|
goto out_udp;
|
|
|
}
|
|
|
- ret = nf_conntrack_l4proto_register(net,
|
|
|
- &nf_conntrack_l4proto_icmp);
|
|
|
+ ret = nf_ct_l4proto_pernet_register(net, &nf_conntrack_l4proto_icmp);
|
|
|
if (ret < 0) {
|
|
|
- pr_err("nf_conntrack_l4proto_icmp4 :protocol register failed\n");
|
|
|
+ pr_err("nf_conntrack_icmp4: pernet registration failed\n");
|
|
|
goto out_icmp;
|
|
|
}
|
|
|
ret = nf_ct_l3proto_pernet_register(net, &nf_conntrack_l3proto_ipv4);
|
|
@@ -445,14 +442,11 @@ static int ipv4_net_init(struct net *net)
|
|
|
}
|
|
|
return 0;
|
|
|
out_ipv4:
|
|
|
- nf_conntrack_l4proto_unregister(net,
|
|
|
- &nf_conntrack_l4proto_icmp);
|
|
|
+ nf_ct_l4proto_pernet_unregister(net, &nf_conntrack_l4proto_icmp);
|
|
|
out_icmp:
|
|
|
- nf_conntrack_l4proto_unregister(net,
|
|
|
- &nf_conntrack_l4proto_udp4);
|
|
|
+ nf_ct_l4proto_pernet_unregister(net, &nf_conntrack_l4proto_udp4);
|
|
|
out_udp:
|
|
|
- nf_conntrack_l4proto_unregister(net,
|
|
|
- &nf_conntrack_l4proto_tcp4);
|
|
|
+ nf_ct_l4proto_pernet_unregister(net, &nf_conntrack_l4proto_tcp4);
|
|
|
out_tcp:
|
|
|
return ret;
|
|
|
}
|
|
@@ -460,12 +454,9 @@ out_tcp:
|
|
|
static void ipv4_net_exit(struct net *net)
|
|
|
{
|
|
|
nf_ct_l3proto_pernet_unregister(net, &nf_conntrack_l3proto_ipv4);
|
|
|
- nf_conntrack_l4proto_unregister(net,
|
|
|
- &nf_conntrack_l4proto_icmp);
|
|
|
- nf_conntrack_l4proto_unregister(net,
|
|
|
- &nf_conntrack_l4proto_udp4);
|
|
|
- nf_conntrack_l4proto_unregister(net,
|
|
|
- &nf_conntrack_l4proto_tcp4);
|
|
|
+ nf_ct_l4proto_pernet_unregister(net, &nf_conntrack_l4proto_icmp);
|
|
|
+ nf_ct_l4proto_pernet_unregister(net, &nf_conntrack_l4proto_udp4);
|
|
|
+ nf_ct_l4proto_pernet_unregister(net, &nf_conntrack_l4proto_tcp4);
|
|
|
}
|
|
|
|
|
|
static struct pernet_operations ipv4_net_ops = {
|
|
@@ -499,10 +490,28 @@ static int __init nf_conntrack_l3proto_ipv4_init(void)
|
|
|
goto cleanup_pernet;
|
|
|
}
|
|
|
|
|
|
+ ret = nf_ct_l4proto_register(&nf_conntrack_l4proto_tcp4);
|
|
|
+ if (ret < 0) {
|
|
|
+ pr_err("nf_conntrack_ipv4: can't register tcp4 proto.\n");
|
|
|
+ goto cleanup_hooks;
|
|
|
+ }
|
|
|
+
|
|
|
+ ret = nf_ct_l4proto_register(&nf_conntrack_l4proto_udp4);
|
|
|
+ if (ret < 0) {
|
|
|
+ pr_err("nf_conntrack_ipv4: can't register udp4 proto.\n");
|
|
|
+ goto cleanup_tcp4;
|
|
|
+ }
|
|
|
+
|
|
|
+ ret = nf_ct_l4proto_register(&nf_conntrack_l4proto_icmp);
|
|
|
+ if (ret < 0) {
|
|
|
+ pr_err("nf_conntrack_ipv4: can't register icmpv4 proto.\n");
|
|
|
+ goto cleanup_udp4;
|
|
|
+ }
|
|
|
+
|
|
|
ret = nf_ct_l3proto_register(&nf_conntrack_l3proto_ipv4);
|
|
|
if (ret < 0) {
|
|
|
pr_err("nf_conntrack_ipv4: can't register ipv4 proto.\n");
|
|
|
- goto cleanup_hooks;
|
|
|
+ goto cleanup_icmpv4;
|
|
|
}
|
|
|
|
|
|
#if defined(CONFIG_PROC_FS) && defined(CONFIG_NF_CONNTRACK_PROC_COMPAT)
|
|
@@ -515,6 +524,12 @@ static int __init nf_conntrack_l3proto_ipv4_init(void)
|
|
|
cleanup_proto:
|
|
|
nf_ct_l3proto_unregister(&nf_conntrack_l3proto_ipv4);
|
|
|
#endif
|
|
|
+ cleanup_icmpv4:
|
|
|
+ nf_ct_l4proto_unregister(&nf_conntrack_l4proto_icmp);
|
|
|
+ cleanup_udp4:
|
|
|
+ nf_ct_l4proto_unregister(&nf_conntrack_l4proto_udp4);
|
|
|
+ cleanup_tcp4:
|
|
|
+ nf_ct_l4proto_unregister(&nf_conntrack_l4proto_tcp4);
|
|
|
cleanup_hooks:
|
|
|
nf_unregister_hooks(ipv4_conntrack_ops, ARRAY_SIZE(ipv4_conntrack_ops));
|
|
|
cleanup_pernet:
|
|
@@ -531,6 +546,9 @@ static void __exit nf_conntrack_l3proto_ipv4_fini(void)
|
|
|
nf_conntrack_ipv4_compat_fini();
|
|
|
#endif
|
|
|
nf_ct_l3proto_unregister(&nf_conntrack_l3proto_ipv4);
|
|
|
+ nf_ct_l4proto_unregister(&nf_conntrack_l4proto_icmp);
|
|
|
+ nf_ct_l4proto_unregister(&nf_conntrack_l4proto_udp4);
|
|
|
+ nf_ct_l4proto_unregister(&nf_conntrack_l4proto_tcp4);
|
|
|
nf_unregister_hooks(ipv4_conntrack_ops, ARRAY_SIZE(ipv4_conntrack_ops));
|
|
|
unregister_pernet_subsys(&ipv4_net_ops);
|
|
|
nf_unregister_sockopt(&so_getorigdst);
|