summaryrefslogtreecommitdiffstats
path: root/net/ipv4/netfilter/iptable_nat.c
diff options
context:
space:
mode:
authorFlorian Westphal <fw@strlen.de>2016-02-25 10:08:35 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2016-03-02 20:05:23 +0100
commita67dd266adf42a24df31380e9da78390bb4d65ef (patch)
tree50c03ebc1b9c80de06e88eb7002efe5facc369af /net/ipv4/netfilter/iptable_nat.c
parent5f547391f5f25bb71f27860ad25bd1e4715f0752 (diff)
downloadop-kernel-dev-a67dd266adf42a24df31380e9da78390bb4d65ef.zip
op-kernel-dev-a67dd266adf42a24df31380e9da78390bb4d65ef.tar.gz
netfilter: xtables: prepare for on-demand hook register
This change prepares for upcoming on-demand xtables hook registration. We change the protoypes of the register/unregister functions. A followup patch will then add nf_hook_register/unregister calls to the iptables one. Once a hook is registered packets will be picked up, so all assignments of the form net->ipv4.iptable_$table = new_table have to be moved to ip(6)t_register_table, else we can see NULL net->ipv4.iptable_$table later. This patch doesn't change functionality; without this the actual change simply gets too big. Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net/ipv4/netfilter/iptable_nat.c')
-rw-r--r--net/ipv4/netfilter/iptable_nat.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/net/ipv4/netfilter/iptable_nat.c b/net/ipv4/netfilter/iptable_nat.c
index ae2cd27..e984f1d 100644
--- a/net/ipv4/netfilter/iptable_nat.c
+++ b/net/ipv4/netfilter/iptable_nat.c
@@ -98,18 +98,20 @@ static struct nf_hook_ops nf_nat_ipv4_ops[] __read_mostly = {
static int __net_init iptable_nat_net_init(struct net *net)
{
struct ipt_replace *repl;
+ int ret;
repl = ipt_alloc_initial_table(&nf_nat_ipv4_table);
if (repl == NULL)
return -ENOMEM;
- net->ipv4.nat_table = ipt_register_table(net, &nf_nat_ipv4_table, repl);
+ ret = ipt_register_table(net, &nf_nat_ipv4_table, repl,
+ nf_nat_ipv4_ops, &net->ipv4.nat_table);
kfree(repl);
- return PTR_ERR_OR_ZERO(net->ipv4.nat_table);
+ return ret;
}
static void __net_exit iptable_nat_net_exit(struct net *net)
{
- ipt_unregister_table(net, net->ipv4.nat_table);
+ ipt_unregister_table(net, net->ipv4.nat_table, nf_nat_ipv4_ops);
}
static struct pernet_operations iptable_nat_net_ops = {
OpenPOWER on IntegriCloud