ce46e69d439c21c1570916aa300ebb0b9f7205b7
[oweals/openwrt.git] /
1 From: Pablo Neira Ayuso <pablo@netfilter.org>
2 Date: Tue, 19 Dec 2017 12:17:52 +0100
3 Subject: [PATCH] netfilter: nf_tables: no need for struct nft_af_info to
4  enable/disable table
5
6 nf_tables_table_enable() and nf_tables_table_disable() take a pointer to
7 struct nft_af_info that is never used, remove it.
8
9 Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
10 ---
11
12 --- a/net/netfilter/nf_tables_api.c
13 +++ b/net/netfilter/nf_tables_api.c
14 @@ -640,10 +640,7 @@ err:
15         return err;
16  }
17  
18 -static void _nf_tables_table_disable(struct net *net,
19 -                                    const struct nft_af_info *afi,
20 -                                    struct nft_table *table,
21 -                                    u32 cnt)
22 +static void nft_table_disable(struct net *net, struct nft_table *table, u32 cnt)
23  {
24         struct nft_chain *chain;
25         u32 i = 0;
26 @@ -661,9 +658,7 @@ static void _nf_tables_table_disable(str
27         }
28  }
29  
30 -static int nf_tables_table_enable(struct net *net,
31 -                                 const struct nft_af_info *afi,
32 -                                 struct nft_table *table)
33 +static int nf_tables_table_enable(struct net *net, struct nft_table *table)
34  {
35         struct nft_chain *chain;
36         int err, i = 0;
37 @@ -683,15 +678,13 @@ static int nf_tables_table_enable(struct
38         return 0;
39  err:
40         if (i)
41 -               _nf_tables_table_disable(net, afi, table, i);
42 +               nft_table_disable(net, table, i);
43         return err;
44  }
45  
46 -static void nf_tables_table_disable(struct net *net,
47 -                                   const struct nft_af_info *afi,
48 -                                   struct nft_table *table)
49 +static void nf_tables_table_disable(struct net *net, struct nft_table *table)
50  {
51 -       _nf_tables_table_disable(net, afi, table, 0);
52 +       nft_table_disable(net, table, 0);
53  }
54  
55  static int nf_tables_updtable(struct nft_ctx *ctx)
56 @@ -720,7 +713,7 @@ static int nf_tables_updtable(struct nft
57                 nft_trans_table_enable(trans) = false;
58         } else if (!(flags & NFT_TABLE_F_DORMANT) &&
59                    ctx->table->flags & NFT_TABLE_F_DORMANT) {
60 -               ret = nf_tables_table_enable(ctx->net, ctx->afi, ctx->table);
61 +               ret = nf_tables_table_enable(ctx->net, ctx->table);
62                 if (ret >= 0) {
63                         ctx->table->flags &= ~NFT_TABLE_F_DORMANT;
64                         nft_trans_table_enable(trans) = true;
65 @@ -5771,7 +5764,6 @@ static int nf_tables_commit(struct net *
66                         if (nft_trans_table_update(trans)) {
67                                 if (!nft_trans_table_enable(trans)) {
68                                         nf_tables_table_disable(net,
69 -                                                               trans->ctx.afi,
70                                                                 trans->ctx.table);
71                                         trans->ctx.table->flags |= NFT_TABLE_F_DORMANT;
72                                 }
73 @@ -5933,7 +5925,6 @@ static int nf_tables_abort(struct net *n
74                         if (nft_trans_table_update(trans)) {
75                                 if (nft_trans_table_enable(trans)) {
76                                         nf_tables_table_disable(net,
77 -                                                               trans->ctx.afi,
78                                                                 trans->ctx.table);
79                                         trans->ctx.table->flags |= NFT_TABLE_F_DORMANT;
80                                 }