f2ece780b4e186dab32423eafc3982662c9d39fb
[openwrt/staging/svanheule.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 @@ -655,10 +655,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 @@ -676,9 +673,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 @@ -698,15 +693,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 @@ -735,7 +728,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 @@ -5810,7 +5803,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 @@ -5974,7 +5966,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 }