aboutsummaryrefslogtreecommitdiffstats
path: root/net/netfilter/nf_nat_core.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/netfilter/nf_nat_core.c')
-rw-r--r--net/netfilter/nf_nat_core.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/net/netfilter/nf_nat_core.c b/net/netfilter/nf_nat_core.c
index 0f39ae7a9f34..0c548ff215b2 100644
--- a/net/netfilter/nf_nat_core.c
+++ b/net/netfilter/nf_nat_core.c
@@ -1203,6 +1203,8 @@ static struct nf_nat_hook nat_hook = {
.manip_pkt = nf_nat_manip_pkt,
};
+int nf_nat_l3proto_init(void);
+void nf_nat_l3proto_exit(void);
static int __init nf_nat_init(void)
{
int ret, i;
@@ -1237,6 +1239,19 @@ static int __init nf_nat_init(void)
WARN_ON(nf_nat_hook != NULL);
RCU_INIT_POINTER(nf_nat_hook, &nat_hook);
+ ret = nf_nat_l3proto_init();
+ if (ret) {
+ nf_ct_extend_unregister(&nat_extend);
+ nf_ct_helper_expectfn_unregister(&follow_master_nat);
+ RCU_INIT_POINTER(nf_nat_hook, NULL);
+
+ synchronize_net();
+ kvfree(nf_nat_bysource);
+ unregister_pernet_subsys(&nat_net_ops);
+
+ return ret;
+ }
+
return 0;
}
@@ -1246,6 +1261,8 @@ static void __exit nf_nat_cleanup(void)
nf_ct_iterate_destroy(nf_nat_proto_clean, &clean);
+ nf_nat_l3proto_exit();
+
nf_ct_extend_unregister(&nat_extend);
nf_ct_helper_expectfn_unregister(&follow_master_nat);
RCU_INIT_POINTER(nf_nat_hook, NULL);