Skip to content

Commit 551b388

Browse files
Florian Westphalummakynes
Florian Westphal
authored andcommitted
netfilter: nf_tables: reduce trans->ctx.chain references
These objects are the trans_chain subtype, so use the helper instead of referencing trans->ctx, which will be removed soon. Signed-off-by: Florian Westphal <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent 13f20bc commit 551b388

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

net/netfilter/nf_tables_api.c

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1262,7 +1262,7 @@ static bool nft_table_pending_update(const struct nft_ctx *ctx)
12621262
((trans->msg_type == NFT_MSG_NEWCHAIN &&
12631263
nft_trans_chain_update(trans)) ||
12641264
(trans->msg_type == NFT_MSG_DELCHAIN &&
1265-
nft_is_base_chain(trans->ctx.chain))))
1265+
nft_is_base_chain(nft_trans_chain(trans)))))
12661266
return true;
12671267
}
12681268

@@ -2815,13 +2815,11 @@ static struct nft_chain *nft_chain_lookup_byid(const struct net *net,
28152815
struct nft_trans *trans;
28162816

28172817
list_for_each_entry(trans, &nft_net->commit_list, list) {
2818-
struct nft_chain *chain = trans->ctx.chain;
2819-
28202818
if (trans->msg_type == NFT_MSG_NEWCHAIN &&
2821-
chain->table == table &&
2819+
nft_trans_chain(trans)->table == table &&
28222820
id == nft_trans_chain_id(trans) &&
2823-
nft_active_genmask(chain, genmask))
2824-
return chain;
2821+
nft_active_genmask(nft_trans_chain(trans), genmask))
2822+
return nft_trans_chain(trans);
28252823
}
28262824
return ERR_PTR(-ENOENT);
28272825
}
@@ -10625,9 +10623,9 @@ static int __nf_tables_abort(struct net *net, enum nfnl_abort_action action)
1062510623
break;
1062610624
}
1062710625
nft_use_dec_restore(&table->use);
10628-
nft_chain_del(trans->ctx.chain);
10626+
nft_chain_del(nft_trans_chain(trans));
1062910627
nf_tables_unregister_hook(trans->ctx.net, table,
10630-
trans->ctx.chain);
10628+
nft_trans_chain(trans));
1063110629
}
1063210630
break;
1063310631
case NFT_MSG_DELCHAIN:
@@ -10637,7 +10635,7 @@ static int __nf_tables_abort(struct net *net, enum nfnl_abort_action action)
1063710635
&nft_trans_basechain(trans)->hook_list);
1063810636
} else {
1063910637
nft_use_inc_restore(&table->use);
10640-
nft_clear(trans->ctx.net, trans->ctx.chain);
10638+
nft_clear(trans->ctx.net, nft_trans_chain(trans));
1064110639
}
1064210640
nft_trans_destroy(trans);
1064310641
break;

0 commit comments

Comments
 (0)