From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Subject: [PATCH nf-next 04/12,v2] netfilter: nft_lookup: only cancel tracking for clobbered dregs
Date: Mon, 14 Mar 2022 01:54:09 +0100 [thread overview]
Message-ID: <20220314005417.315832-5-pablo@netfilter.org> (raw)
In-Reply-To: <20220314005417.315832-1-pablo@netfilter.org>
From: Florian Westphal <fw@strlen.de>
In most cases, nft_lookup will be read-only, i.e. won't clobber
registers. In case of map, we need to cancel the registers that will
see stores.
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
v2: no changes.
net/netfilter/nft_lookup.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/net/netfilter/nft_lookup.c b/net/netfilter/nft_lookup.c
index 90becbf5bff3..dfae12759c7c 100644
--- a/net/netfilter/nft_lookup.c
+++ b/net/netfilter/nft_lookup.c
@@ -253,6 +253,17 @@ static int nft_lookup_validate(const struct nft_ctx *ctx,
return 0;
}
+static bool nft_lookup_reduce(struct nft_regs_track *track,
+ const struct nft_expr *expr)
+{
+ const struct nft_lookup *priv = nft_expr_priv(expr);
+
+ if (priv->set->flags & NFT_SET_MAP)
+ nft_reg_track_cancel(track, priv->dreg, priv->set->dlen);
+
+ return false;
+}
+
static const struct nft_expr_ops nft_lookup_ops = {
.type = &nft_lookup_type,
.size = NFT_EXPR_SIZE(sizeof(struct nft_lookup)),
@@ -263,6 +274,7 @@ static const struct nft_expr_ops nft_lookup_ops = {
.destroy = nft_lookup_destroy,
.dump = nft_lookup_dump,
.validate = nft_lookup_validate,
+ .reduce = nft_lookup_reduce,
};
struct nft_expr_type nft_lookup_type __read_mostly = {
--
2.30.2
next prev parent reply other threads:[~2022-03-14 0:54 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-14 0:54 [PATCH nf-next 00/12,v2] register tracking infrastructure follow up Pablo Neira Ayuso
2022-03-14 0:54 ` [PATCH nf-next 01/12,v2] netfilter: nf_tables: do not reduce read-only expressions Pablo Neira Ayuso
2022-03-14 7:35 ` kernel test robot
2022-03-14 0:54 ` [PATCH nf-next 02/12,v2] netfilter: nf_tables: cancel tracking for clobbered destination registers Pablo Neira Ayuso
2022-03-14 10:38 ` kernel test robot
2022-03-14 0:54 ` [PATCH nf-next 03/12,v2] netfilter: nft_ct: track register operations Pablo Neira Ayuso
2022-03-14 0:54 ` Pablo Neira Ayuso [this message]
2022-03-14 0:54 ` [PATCH nf-next 05/12,v2] netfilter: nft_meta: extend reduce support to bridge family Pablo Neira Ayuso
2022-03-14 0:54 ` [PATCH nf-next 06/12,v2] netfilter: nft_numgen: cancel register tracking Pablo Neira Ayuso
2022-03-14 0:54 ` [PATCH nf-next 07/12,v2] netfilter: nft_osf: track register operations Pablo Neira Ayuso
2022-03-14 0:54 ` [PATCH nf-next 08/12,v2] netfilter: nft_hash: " Pablo Neira Ayuso
2022-03-14 0:54 ` [PATCH nf-next 09/12,v2] netfilter: nft_immediate: cancel register tracking for data destination register Pablo Neira Ayuso
2022-03-14 0:54 ` [PATCH nf-next 10/12,v2] netfilter: nft_socket: track register operations Pablo Neira Ayuso
2022-03-14 0:54 ` [PATCH nf-next 11/12,v2] netfilter: nft_xfrm: " Pablo Neira Ayuso
2022-03-14 0:54 ` [PATCH nf-next 12/12,v2] netfilter: nft_tunnel: " Pablo Neira Ayuso
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=20220314005417.315832-5-pablo@netfilter.org \
--to=pablo@netfilter.org \
--cc=netfilter-devel@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.