Commit f68772ed authored by Florian Westphal's avatar Florian Westphal Committed by Pablo Neira Ayuso

netfilter: x_tables: remove paranoia tests

No need for these.
There is only one caller, the xtables core, when the table is registered
for the first time with a particular network namespace.

After ->table_init() call, the table is linked into the tables[af] list,
so next call to that function will skip the ->table_init().
Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent 4d705399
...@@ -44,9 +44,6 @@ static int __net_init arptable_filter_table_init(struct net *net) ...@@ -44,9 +44,6 @@ static int __net_init arptable_filter_table_init(struct net *net)
struct arpt_replace *repl; struct arpt_replace *repl;
int err; int err;
if (net->ipv4.arptable_filter)
return 0;
repl = arpt_alloc_initial_table(&packet_filter); repl = arpt_alloc_initial_table(&packet_filter);
if (repl == NULL) if (repl == NULL)
return -ENOMEM; return -ENOMEM;
......
...@@ -48,9 +48,6 @@ static int __net_init iptable_filter_table_init(struct net *net) ...@@ -48,9 +48,6 @@ static int __net_init iptable_filter_table_init(struct net *net)
struct ipt_replace *repl; struct ipt_replace *repl;
int err; int err;
if (net->ipv4.iptable_filter)
return 0;
repl = ipt_alloc_initial_table(&packet_filter); repl = ipt_alloc_initial_table(&packet_filter);
if (repl == NULL) if (repl == NULL)
return -ENOMEM; return -ENOMEM;
......
...@@ -88,9 +88,6 @@ static int __net_init iptable_mangle_table_init(struct net *net) ...@@ -88,9 +88,6 @@ static int __net_init iptable_mangle_table_init(struct net *net)
struct ipt_replace *repl; struct ipt_replace *repl;
int ret; int ret;
if (net->ipv4.iptable_mangle)
return 0;
repl = ipt_alloc_initial_table(&packet_mangler); repl = ipt_alloc_initial_table(&packet_mangler);
if (repl == NULL) if (repl == NULL)
return -ENOMEM; return -ENOMEM;
......
...@@ -90,9 +90,6 @@ static int __net_init iptable_nat_table_init(struct net *net) ...@@ -90,9 +90,6 @@ static int __net_init iptable_nat_table_init(struct net *net)
struct ipt_replace *repl; struct ipt_replace *repl;
int ret; int ret;
if (net->ipv4.nat_table)
return 0;
repl = ipt_alloc_initial_table(&nf_nat_ipv4_table); repl = ipt_alloc_initial_table(&nf_nat_ipv4_table);
if (repl == NULL) if (repl == NULL)
return -ENOMEM; return -ENOMEM;
......
...@@ -55,9 +55,6 @@ static int __net_init iptable_raw_table_init(struct net *net) ...@@ -55,9 +55,6 @@ static int __net_init iptable_raw_table_init(struct net *net)
if (raw_before_defrag) if (raw_before_defrag)
table = &packet_raw_before_defrag; table = &packet_raw_before_defrag;
if (net->ipv4.iptable_raw)
return 0;
repl = ipt_alloc_initial_table(table); repl = ipt_alloc_initial_table(table);
if (repl == NULL) if (repl == NULL)
return -ENOMEM; return -ENOMEM;
......
...@@ -50,9 +50,6 @@ static int __net_init iptable_security_table_init(struct net *net) ...@@ -50,9 +50,6 @@ static int __net_init iptable_security_table_init(struct net *net)
struct ipt_replace *repl; struct ipt_replace *repl;
int ret; int ret;
if (net->ipv4.iptable_security)
return 0;
repl = ipt_alloc_initial_table(&security_table); repl = ipt_alloc_initial_table(&security_table);
if (repl == NULL) if (repl == NULL)
return -ENOMEM; return -ENOMEM;
......
...@@ -49,9 +49,6 @@ static int __net_init ip6table_filter_table_init(struct net *net) ...@@ -49,9 +49,6 @@ static int __net_init ip6table_filter_table_init(struct net *net)
struct ip6t_replace *repl; struct ip6t_replace *repl;
int err; int err;
if (net->ipv6.ip6table_filter)
return 0;
repl = ip6t_alloc_initial_table(&packet_filter); repl = ip6t_alloc_initial_table(&packet_filter);
if (repl == NULL) if (repl == NULL)
return -ENOMEM; return -ENOMEM;
......
...@@ -81,9 +81,6 @@ static int __net_init ip6table_mangle_table_init(struct net *net) ...@@ -81,9 +81,6 @@ static int __net_init ip6table_mangle_table_init(struct net *net)
struct ip6t_replace *repl; struct ip6t_replace *repl;
int ret; int ret;
if (net->ipv6.ip6table_mangle)
return 0;
repl = ip6t_alloc_initial_table(&packet_mangler); repl = ip6t_alloc_initial_table(&packet_mangler);
if (repl == NULL) if (repl == NULL)
return -ENOMEM; return -ENOMEM;
......
...@@ -92,9 +92,6 @@ static int __net_init ip6table_nat_table_init(struct net *net) ...@@ -92,9 +92,6 @@ static int __net_init ip6table_nat_table_init(struct net *net)
struct ip6t_replace *repl; struct ip6t_replace *repl;
int ret; int ret;
if (net->ipv6.ip6table_nat)
return 0;
repl = ip6t_alloc_initial_table(&nf_nat_ipv6_table); repl = ip6t_alloc_initial_table(&nf_nat_ipv6_table);
if (repl == NULL) if (repl == NULL)
return -ENOMEM; return -ENOMEM;
......
...@@ -54,9 +54,6 @@ static int __net_init ip6table_raw_table_init(struct net *net) ...@@ -54,9 +54,6 @@ static int __net_init ip6table_raw_table_init(struct net *net)
if (raw_before_defrag) if (raw_before_defrag)
table = &packet_raw_before_defrag; table = &packet_raw_before_defrag;
if (net->ipv6.ip6table_raw)
return 0;
repl = ip6t_alloc_initial_table(table); repl = ip6t_alloc_initial_table(table);
if (repl == NULL) if (repl == NULL)
return -ENOMEM; return -ENOMEM;
......
...@@ -49,9 +49,6 @@ static int __net_init ip6table_security_table_init(struct net *net) ...@@ -49,9 +49,6 @@ static int __net_init ip6table_security_table_init(struct net *net)
struct ip6t_replace *repl; struct ip6t_replace *repl;
int ret; int ret;
if (net->ipv6.ip6table_security)
return 0;
repl = ip6t_alloc_initial_table(&security_table); repl = ip6t_alloc_initial_table(&security_table);
if (repl == NULL) if (repl == NULL)
return -ENOMEM; return -ENOMEM;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment