From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Cc: davem@davemloft.net, netdev@vger.kernel.org, kuba@kernel.org
Subject: [PATCH net-next 10/22] netfilter: x_tables: remove paranoia tests
Date: Mon, 26 Apr 2021 19:10:44 +0200 [thread overview]
Message-ID: <20210426171056.345271-11-pablo@netfilter.org> (raw)
In-Reply-To: <20210426171056.345271-1-pablo@netfilter.org>
From: Florian Westphal <fw@strlen.de>
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: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
net/ipv4/netfilter/arptable_filter.c | 3 ---
net/ipv4/netfilter/iptable_filter.c | 3 ---
net/ipv4/netfilter/iptable_mangle.c | 3 ---
net/ipv4/netfilter/iptable_nat.c | 3 ---
net/ipv4/netfilter/iptable_raw.c | 3 ---
net/ipv4/netfilter/iptable_security.c | 3 ---
net/ipv6/netfilter/ip6table_filter.c | 3 ---
net/ipv6/netfilter/ip6table_mangle.c | 3 ---
net/ipv6/netfilter/ip6table_nat.c | 3 ---
net/ipv6/netfilter/ip6table_raw.c | 3 ---
net/ipv6/netfilter/ip6table_security.c | 3 ---
11 files changed, 33 deletions(-)
diff --git a/net/ipv4/netfilter/arptable_filter.c b/net/ipv4/netfilter/arptable_filter.c
index c121e13dc78c..924f096a6d89 100644
--- a/net/ipv4/netfilter/arptable_filter.c
+++ b/net/ipv4/netfilter/arptable_filter.c
@@ -44,9 +44,6 @@ static int __net_init arptable_filter_table_init(struct net *net)
struct arpt_replace *repl;
int err;
- if (net->ipv4.arptable_filter)
- return 0;
-
repl = arpt_alloc_initial_table(&packet_filter);
if (repl == NULL)
return -ENOMEM;
diff --git a/net/ipv4/netfilter/iptable_filter.c b/net/ipv4/netfilter/iptable_filter.c
index a39998c7977f..84573fa78d1e 100644
--- a/net/ipv4/netfilter/iptable_filter.c
+++ b/net/ipv4/netfilter/iptable_filter.c
@@ -48,9 +48,6 @@ static int __net_init iptable_filter_table_init(struct net *net)
struct ipt_replace *repl;
int err;
- if (net->ipv4.iptable_filter)
- return 0;
-
repl = ipt_alloc_initial_table(&packet_filter);
if (repl == NULL)
return -ENOMEM;
diff --git a/net/ipv4/netfilter/iptable_mangle.c b/net/ipv4/netfilter/iptable_mangle.c
index 7d1713e22553..98e9e9053d85 100644
--- a/net/ipv4/netfilter/iptable_mangle.c
+++ b/net/ipv4/netfilter/iptable_mangle.c
@@ -88,9 +88,6 @@ static int __net_init iptable_mangle_table_init(struct net *net)
struct ipt_replace *repl;
int ret;
- if (net->ipv4.iptable_mangle)
- return 0;
-
repl = ipt_alloc_initial_table(&packet_mangler);
if (repl == NULL)
return -ENOMEM;
diff --git a/net/ipv4/netfilter/iptable_nat.c b/net/ipv4/netfilter/iptable_nat.c
index 16bf3009642e..f4afd28ccc06 100644
--- a/net/ipv4/netfilter/iptable_nat.c
+++ b/net/ipv4/netfilter/iptable_nat.c
@@ -90,9 +90,6 @@ static int __net_init iptable_nat_table_init(struct net *net)
struct ipt_replace *repl;
int ret;
- if (net->ipv4.nat_table)
- return 0;
-
repl = ipt_alloc_initial_table(&nf_nat_ipv4_table);
if (repl == NULL)
return -ENOMEM;
diff --git a/net/ipv4/netfilter/iptable_raw.c b/net/ipv4/netfilter/iptable_raw.c
index a1f556464b93..18776f5a4055 100644
--- a/net/ipv4/netfilter/iptable_raw.c
+++ b/net/ipv4/netfilter/iptable_raw.c
@@ -55,9 +55,6 @@ static int __net_init iptable_raw_table_init(struct net *net)
if (raw_before_defrag)
table = &packet_raw_before_defrag;
- if (net->ipv4.iptable_raw)
- return 0;
-
repl = ipt_alloc_initial_table(table);
if (repl == NULL)
return -ENOMEM;
diff --git a/net/ipv4/netfilter/iptable_security.c b/net/ipv4/netfilter/iptable_security.c
index 33eded4f9080..3df92fb394c5 100644
--- a/net/ipv4/netfilter/iptable_security.c
+++ b/net/ipv4/netfilter/iptable_security.c
@@ -50,9 +50,6 @@ static int __net_init iptable_security_table_init(struct net *net)
struct ipt_replace *repl;
int ret;
- if (net->ipv4.iptable_security)
- return 0;
-
repl = ipt_alloc_initial_table(&security_table);
if (repl == NULL)
return -ENOMEM;
diff --git a/net/ipv6/netfilter/ip6table_filter.c b/net/ipv6/netfilter/ip6table_filter.c
index 0c9f75e23ca0..2bcafa3e2d35 100644
--- a/net/ipv6/netfilter/ip6table_filter.c
+++ b/net/ipv6/netfilter/ip6table_filter.c
@@ -49,9 +49,6 @@ static int __net_init ip6table_filter_table_init(struct net *net)
struct ip6t_replace *repl;
int err;
- if (net->ipv6.ip6table_filter)
- return 0;
-
repl = ip6t_alloc_initial_table(&packet_filter);
if (repl == NULL)
return -ENOMEM;
diff --git a/net/ipv6/netfilter/ip6table_mangle.c b/net/ipv6/netfilter/ip6table_mangle.c
index 9a2266662508..14e22022bf41 100644
--- a/net/ipv6/netfilter/ip6table_mangle.c
+++ b/net/ipv6/netfilter/ip6table_mangle.c
@@ -81,9 +81,6 @@ static int __net_init ip6table_mangle_table_init(struct net *net)
struct ip6t_replace *repl;
int ret;
- if (net->ipv6.ip6table_mangle)
- return 0;
-
repl = ip6t_alloc_initial_table(&packet_mangler);
if (repl == NULL)
return -ENOMEM;
diff --git a/net/ipv6/netfilter/ip6table_nat.c b/net/ipv6/netfilter/ip6table_nat.c
index 7eb61e6b1e52..c7f98755191b 100644
--- a/net/ipv6/netfilter/ip6table_nat.c
+++ b/net/ipv6/netfilter/ip6table_nat.c
@@ -92,9 +92,6 @@ static int __net_init ip6table_nat_table_init(struct net *net)
struct ip6t_replace *repl;
int ret;
- if (net->ipv6.ip6table_nat)
- return 0;
-
repl = ip6t_alloc_initial_table(&nf_nat_ipv6_table);
if (repl == NULL)
return -ENOMEM;
diff --git a/net/ipv6/netfilter/ip6table_raw.c b/net/ipv6/netfilter/ip6table_raw.c
index c9a4aada40ba..ae3df59f0350 100644
--- a/net/ipv6/netfilter/ip6table_raw.c
+++ b/net/ipv6/netfilter/ip6table_raw.c
@@ -54,9 +54,6 @@ static int __net_init ip6table_raw_table_init(struct net *net)
if (raw_before_defrag)
table = &packet_raw_before_defrag;
- if (net->ipv6.ip6table_raw)
- return 0;
-
repl = ip6t_alloc_initial_table(table);
if (repl == NULL)
return -ENOMEM;
diff --git a/net/ipv6/netfilter/ip6table_security.c b/net/ipv6/netfilter/ip6table_security.c
index 73067e08662f..83ca632cbf88 100644
--- a/net/ipv6/netfilter/ip6table_security.c
+++ b/net/ipv6/netfilter/ip6table_security.c
@@ -49,9 +49,6 @@ static int __net_init ip6table_security_table_init(struct net *net)
struct ip6t_replace *repl;
int ret;
- if (net->ipv6.ip6table_security)
- return 0;
-
repl = ip6t_alloc_initial_table(&security_table);
if (repl == NULL)
return -ENOMEM;
--
2.30.2
next prev parent reply other threads:[~2021-04-26 17:12 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-26 17:10 [PATCH net-next 00/22] Netfilter updates for net-next Pablo Neira Ayuso
2021-04-26 17:10 ` [PATCH net-next 01/22] netfilter: nat: move nf_xfrm_me_harder to where it is used Pablo Neira Ayuso
2021-04-26 19:53 ` patchwork-bot+netdevbpf
2021-04-26 17:10 ` [PATCH net-next 02/22] netfilter: nft_socket: add support for cgroupsv2 Pablo Neira Ayuso
2021-04-26 17:10 ` [PATCH net-next 03/22] netfilter: disable defrag once its no longer needed Pablo Neira Ayuso
2021-04-26 17:10 ` [PATCH net-next 04/22] netfilter: ebtables: remove the 3 ebtables pointers from struct net Pablo Neira Ayuso
2021-04-26 17:10 ` [PATCH net-next 05/22] netfilter: x_tables: remove ipt_unregister_table Pablo Neira Ayuso
2021-04-26 17:10 ` [PATCH net-next 06/22] netfilter: x_tables: add xt_find_table Pablo Neira Ayuso
2021-04-26 17:10 ` [PATCH net-next 07/22] netfilter: iptables: unregister the tables by name Pablo Neira Ayuso
2021-04-26 17:10 ` [PATCH net-next 08/22] netfilter: ip6tables: " Pablo Neira Ayuso
2021-04-26 17:10 ` [PATCH net-next 09/22] netfilter: arptables: " Pablo Neira Ayuso
2021-04-26 17:10 ` Pablo Neira Ayuso [this message]
2021-04-26 17:10 ` [PATCH net-next 11/22] netfilter: xt_nat: pass table to hookfn Pablo Neira Ayuso
2021-04-26 17:10 ` [PATCH net-next 12/22] netfilter: ip_tables: pass table pointer via nf_hook_ops Pablo Neira Ayuso
2021-04-26 17:10 ` [PATCH net-next 13/22] netfilter: arp_tables: " Pablo Neira Ayuso
2021-04-26 17:10 ` [PATCH net-next 14/22] netfilter: ip6_tables: " Pablo Neira Ayuso
2021-04-26 17:10 ` [PATCH net-next 15/22] netfilter: remove all xt_table anchors from struct net Pablo Neira Ayuso
2021-04-26 17:10 ` [PATCH net-next 16/22] netfilter: nf_log_syslog: Unset bridge logger in pernet exit Pablo Neira Ayuso
2021-04-26 17:10 ` [PATCH net-next 17/22] netfilter: nftables: add nft_pernet() helper function Pablo Neira Ayuso
2021-04-26 17:10 ` [PATCH net-next 18/22] netfilter: nfnetlink: add struct nfnl_info and pass it to callbacks Pablo Neira Ayuso
2021-04-26 17:10 ` [PATCH net-next 19/22] netfilter: nfnetlink: pass struct nfnl_info to rcu callbacks Pablo Neira Ayuso
2021-04-26 17:10 ` [PATCH net-next 20/22] netfilter: nfnetlink: pass struct nfnl_info to batch callbacks Pablo Neira Ayuso
2021-04-26 17:10 ` [PATCH net-next 21/22] netfilter: nfnetlink: consolidate callback types Pablo Neira Ayuso
2021-04-26 17:10 ` [PATCH net-next 22/22] netfilter: allow to turn off xtables compat layer Pablo Neira Ayuso
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210426171056.345271-11-pablo@netfilter.org \
--to=pablo@netfilter.org \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).