netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Cc: davem@davemloft.net, netdev@vger.kernel.org, kuba@kernel.org,
	pabeni@redhat.com, edumazet@google.com, fw@strlen.de
Subject: [PATCH nf-next 09/19] netfilter: nf_tables: reduce trans->ctx.chain references
Date: Thu, 27 Jun 2024 13:27:03 +0200	[thread overview]
Message-ID: <20240627112713.4846-10-pablo@netfilter.org> (raw)
In-Reply-To: <20240627112713.4846-1-pablo@netfilter.org>

From: Florian Westphal <fw@strlen.de>

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 <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 net/netfilter/nf_tables_api.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index 3e5980f0bf71..bd311b37fc61 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -1262,7 +1262,7 @@ static bool nft_table_pending_update(const struct nft_ctx *ctx)
 		    ((trans->msg_type == NFT_MSG_NEWCHAIN &&
 		      nft_trans_chain_update(trans)) ||
 		     (trans->msg_type == NFT_MSG_DELCHAIN &&
-		      nft_is_base_chain(trans->ctx.chain))))
+		      nft_is_base_chain(nft_trans_chain(trans)))))
 			return true;
 	}
 
@@ -2815,13 +2815,11 @@ static struct nft_chain *nft_chain_lookup_byid(const struct net *net,
 	struct nft_trans *trans;
 
 	list_for_each_entry(trans, &nft_net->commit_list, list) {
-		struct nft_chain *chain = trans->ctx.chain;
-
 		if (trans->msg_type == NFT_MSG_NEWCHAIN &&
-		    chain->table == table &&
+		    nft_trans_chain(trans)->table == table &&
 		    id == nft_trans_chain_id(trans) &&
-		    nft_active_genmask(chain, genmask))
-			return chain;
+		    nft_active_genmask(nft_trans_chain(trans), genmask))
+			return nft_trans_chain(trans);
 	}
 	return ERR_PTR(-ENOENT);
 }
@@ -10625,9 +10623,9 @@ static int __nf_tables_abort(struct net *net, enum nfnl_abort_action action)
 					break;
 				}
 				nft_use_dec_restore(&table->use);
-				nft_chain_del(trans->ctx.chain);
+				nft_chain_del(nft_trans_chain(trans));
 				nf_tables_unregister_hook(trans->ctx.net, table,
-							  trans->ctx.chain);
+							  nft_trans_chain(trans));
 			}
 			break;
 		case NFT_MSG_DELCHAIN:
@@ -10637,7 +10635,7 @@ static int __nf_tables_abort(struct net *net, enum nfnl_abort_action action)
 					    &nft_trans_basechain(trans)->hook_list);
 			} else {
 				nft_use_inc_restore(&table->use);
-				nft_clear(trans->ctx.net, trans->ctx.chain);
+				nft_clear(trans->ctx.net, nft_trans_chain(trans));
 			}
 			nft_trans_destroy(trans);
 			break;
-- 
2.30.2


  parent reply	other threads:[~2024-06-27 11:27 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-27 11:26 [PATCH nf-next 00/19] Netfilter/IPVS updates for net-next Pablo Neira Ayuso
2024-06-27 11:26 ` [PATCH nf-next 01/19] netfilter: nf_tables: make struct nft_trans first member of derived subtypes Pablo Neira Ayuso
2024-06-27 11:26 ` [PATCH nf-next 02/19] netfilter: nf_tables: move bind list_head into relevant subtypes Pablo Neira Ayuso
2024-06-27 11:26 ` [PATCH nf-next 03/19] netfilter: nf_tables: compact chain+ft transaction objects Pablo Neira Ayuso
2024-06-27 11:26 ` [PATCH nf-next 04/19] netfilter: nf_tables: reduce trans->ctx.table references Pablo Neira Ayuso
2024-06-27 11:26 ` [PATCH nf-next 05/19] netfilter: nf_tables: pass nft_chain to destroy function, not nft_ctx Pablo Neira Ayuso
2024-06-27 11:27 ` [PATCH nf-next 06/19] netfilter: nf_tables: pass more specific nft_trans_chain where possible Pablo Neira Ayuso
2024-06-27 11:27 ` [PATCH nf-next 07/19] netfilter: nf_tables: avoid usage of embedded nft_ctx Pablo Neira Ayuso
2024-06-27 11:27 ` [PATCH nf-next 08/19] netfilter: nf_tables: store chain pointer in rule transaction Pablo Neira Ayuso
2024-06-27 11:27 ` Pablo Neira Ayuso [this message]
2024-06-27 11:27 ` [PATCH nf-next 10/19] netfilter: nf_tables: pass nft_table to destroy function Pablo Neira Ayuso
2024-06-27 11:27 ` [PATCH nf-next 11/19] netfilter: nf_tables: do not store nft_ctx in transaction objects Pablo Neira Ayuso
2024-06-27 11:27 ` [PATCH nf-next 12/19] ipvs: Avoid unnecessary calls to skb_is_gso_sctp Pablo Neira Ayuso
2024-06-27 11:27 ` [PATCH nf-next 13/19] netfilter: nf_conncount: fix wrong variable type Pablo Neira Ayuso
2024-06-27 11:27 ` [PATCH nf-next 14/19] netfilter: cttimeout: remove 'l3num' attr check Pablo Neira Ayuso
2024-06-27 11:27 ` [PATCH nf-next 15/19] netfilter: nf_tables: rise cap on SELinux secmark context Pablo Neira Ayuso
2024-06-27 11:27 ` [PATCH nf-next 16/19] netfilter: nfnetlink_queue: unbreak SCTP traffic Pablo Neira Ayuso
2024-06-27 11:27 ` [PATCH nf-next 17/19] selftests: netfilter: nft_queue.sh: sctp coverage Pablo Neira Ayuso
2024-06-27 11:27 ` [PATCH nf-next 18/19] selftests: netfilter: nft_queue.sh: add test for disappearing listener Pablo Neira Ayuso
2024-06-27 11:27 ` [PATCH nf-next 19/19] netfilter: xt_recent: Lift restrictions on max hitcount value Pablo Neira Ayuso
2024-06-27 11:28 ` [PATCH nf-next 00/19] Netfilter/IPVS updates for net-next Pablo Neira Ayuso
2024-06-27 18:32   ` Jakub Kicinski
2024-06-27 20:00     ` Florian Westphal
2024-06-28 13:36     ` Pablo Neira Ayuso
2024-06-28 15:17     ` Florian Westphal

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=20240627112713.4846-10-pablo@netfilter.org \
    --to=pablo@netfilter.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=fw@strlen.de \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /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).