summaryrefslogtreecommitdiff
path: root/net/ipv6/netfilter/ip6table_nat.c
diff options
context:
space:
mode:
authorDavid Wilder <dwilder@us.ibm.com>2020-06-22 20:10:14 +0300
committerPablo Neira Ayuso <pablo@netfilter.org>2020-06-25 01:50:31 +0300
commit5f027bc74a9be2e53233de4ebcd2f90390b50a62 (patch)
treed29c9d9b0dcb451bc14369a529e045e0eeb1c606 /net/ipv6/netfilter/ip6table_nat.c
parent57ea5f18882a3d7cf6135fa8c949a37c89395837 (diff)
downloadlinux-5f027bc74a9be2e53233de4ebcd2f90390b50a62.tar.xz
netfilter: ip6tables: Add a .pre_exit hook in all ip6table_foo.c.
Using new helpers ip6t_unregister_table_pre_exit() and ip6t_unregister_table_exit(). Fixes: b9e69e127397 ("netfilter: xtables: don't hook tables by default") Signed-off-by: David Wilder <dwilder@us.ibm.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net/ipv6/netfilter/ip6table_nat.c')
-rw-r--r--net/ipv6/netfilter/ip6table_nat.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/net/ipv6/netfilter/ip6table_nat.c b/net/ipv6/netfilter/ip6table_nat.c
index 0f4875952efc..0a23265e3caa 100644
--- a/net/ipv6/netfilter/ip6table_nat.c
+++ b/net/ipv6/netfilter/ip6table_nat.c
@@ -114,16 +114,22 @@ static int __net_init ip6table_nat_table_init(struct net *net)
return ret;
}
+static void __net_exit ip6table_nat_net_pre_exit(struct net *net)
+{
+ if (net->ipv6.ip6table_nat)
+ ip6t_nat_unregister_lookups(net);
+}
+
static void __net_exit ip6table_nat_net_exit(struct net *net)
{
if (!net->ipv6.ip6table_nat)
return;
- ip6t_nat_unregister_lookups(net);
- ip6t_unregister_table(net, net->ipv6.ip6table_nat, NULL);
+ ip6t_unregister_table_exit(net, net->ipv6.ip6table_nat);
net->ipv6.ip6table_nat = NULL;
}
static struct pernet_operations ip6table_nat_net_ops = {
+ .pre_exit = ip6table_nat_net_pre_exit,
.exit = ip6table_nat_net_exit,
};