]> www.infradead.org Git - linux-platform-drivers-x86.git/commitdiff
netfilter: x_tables: remove paranoia tests
authorFlorian Westphal <fw@strlen.de>
Wed, 21 Apr 2021 07:51:05 +0000 (09:51 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Mon, 26 Apr 2021 01:20:46 +0000 (03:20 +0200)
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
net/ipv4/netfilter/iptable_filter.c
net/ipv4/netfilter/iptable_mangle.c
net/ipv4/netfilter/iptable_nat.c
net/ipv4/netfilter/iptable_raw.c
net/ipv4/netfilter/iptable_security.c
net/ipv6/netfilter/ip6table_filter.c
net/ipv6/netfilter/ip6table_mangle.c
net/ipv6/netfilter/ip6table_nat.c
net/ipv6/netfilter/ip6table_raw.c
net/ipv6/netfilter/ip6table_security.c

index c121e13dc78cb513dab1d8b69e350239ad767818..924f096a6d899170ca305c5d7ea340c4ec299a24 100644 (file)
@@ -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;
index a39998c7977f17d7944747140dd20457d47f3fbf..84573fa78d1e9b00884ef540cd11c0b9e665de26 100644 (file)
@@ -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;
index 7d1713e22553377f8e53cb4d3dffb18925c866e6..98e9e9053d85d28c2a3ce3a3aeaa55f7fa2709c2 100644 (file)
@@ -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;
index 16bf3009642e84a71ef722341290c312345631b5..f4afd28ccc06cb4c7b45a7249b72a32a1b6cce8a 100644 (file)
@@ -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;
index a1f556464b93b89dadada5a0ba2e62cdf3215d47..18776f5a4055c8fdaf4347429c05717d0ef6da96 100644 (file)
@@ -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;
index 33eded4f90805cbcfe40708f6cc56b824b0752f8..3df92fb394c5a54f6faae7bf93b4d380a2836ac5 100644 (file)
@@ -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;
index 0c9f75e23ca0d9a57a4a98976a10c78b64dc84c0..2bcafa3e2d3502edf0845f476f2e39882badbc25 100644 (file)
@@ -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;
index 9a22666625088e6ae33842ad483f44e5c027ef50..14e22022bf418a554a2b0732c5a3f58059f7e468 100644 (file)
@@ -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;
index 7eb61e6b1e52736a797195964697c3d5de0a3bab..c7f98755191b5d11439fcdbc361cf7cbf820c001 100644 (file)
@@ -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;
index c9a4aada40ba3c9107b50caeb3584842f27e24d0..ae3df59f035021c1ceda252179e6e41c4aac39db 100644 (file)
@@ -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;
index 73067e08662f644478077b693ed3ef042afdd3c7..83ca632cbf88ee43f41f0b4c945f22bd9fd5c561 100644 (file)
@@ -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;