From: Phil Sutter <phil@nwl.cc>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: netfilter-devel@vger.kernel.org
Subject: [nft PATCH 4/5] cache: Filter for table when listing sets or maps
Date: Wed, 11 Mar 2026 00:11:14 +0100 [thread overview]
Message-ID: <20260310231115.25638-5-phil@nwl.cc> (raw)
In-Reply-To: <20260310231115.25638-1-phil@nwl.cc>
Respect an optionally specified table name to filter listed sets or maps
to by populating the filter accordingly.
Signed-off-by: Phil Sutter <phil@nwl.cc>
---
src/cache.c | 1 +
tests/shell/testcases/listing/cache_filters | 4 ++++
2 files changed, 5 insertions(+)
diff --git a/src/cache.c b/src/cache.c
index 13d4cb19eb4f6..f86d000690929 100644
--- a/src/cache.c
+++ b/src/cache.c
@@ -252,6 +252,7 @@ static unsigned int evaluate_cache_list(struct nft_ctx *nft, struct cmd *cmd,
case CMD_OBJ_SETS:
case CMD_OBJ_MAPS:
filter->list.family = cmd->handle.family;
+ filter->list.table = cmd->handle.table.name;
flags |= NFT_CACHE_TABLE | NFT_CACHE_SET;
if (!nft_output_terse(&nft->output))
flags |= NFT_CACHE_SETELEM;
diff --git a/tests/shell/testcases/listing/cache_filters b/tests/shell/testcases/listing/cache_filters
index 37c8f845dd4c7..7a89330d2b6c0 100755
--- a/tests/shell/testcases/listing/cache_filters
+++ b/tests/shell/testcases/listing/cache_filters
@@ -22,6 +22,8 @@ table ip ip_t {
chain ip_t_c2 {
}
}
+table ip ip_t2 {
+}
EOF
$NFT --debug=netlink list ruleset | \
@@ -38,6 +40,8 @@ $NFT --debug=netlink list sets | \
grep -q 'family 2 ip_t_s ip_t' || fail "broken list sets"
$NFT --debug=netlink list sets ip6 | \
grep -q 'family 2 ip_t_s ip_t' && fail "broken list sets family filter"
+$NFT --debug=netlink list sets ip ip_t2 | \
+ grep -q 'family 2 ip_t_s ip_t' && fail "broken list sets table filter"
$NFT --debug=netlink list flowtables | \
grep -q 'flow table ip_t ip_t_ft' || fail "broken list flowtables"
--
2.51.0
next prev parent reply other threads:[~2026-03-10 23:11 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-10 23:11 [nft PATCH 0/5] Enhance cache filter for list commands Phil Sutter
2026-03-10 23:11 ` [nft PATCH 1/5] cache: Include chains, flowtables and objects in netlink debug output Phil Sutter
2026-03-10 23:11 ` [nft PATCH 2/5] cache: Respect family in all list commands Phil Sutter
2026-03-11 9:34 ` Pablo Neira Ayuso
2026-03-11 10:19 ` Phil Sutter
2026-03-11 12:11 ` Pablo Neira Ayuso
2026-03-11 14:01 ` Phil Sutter
2026-03-10 23:11 ` [nft PATCH 3/5] cache: Relax chain_cache_dump filter application Phil Sutter
2026-03-11 9:38 ` Pablo Neira Ayuso
2026-03-10 23:11 ` Phil Sutter [this message]
2026-03-11 9:39 ` [nft PATCH 4/5] cache: Filter for table when listing sets or maps Pablo Neira Ayuso
2026-03-10 23:11 ` [nft PATCH 5/5] cache: Filter for table when listing flowtables Phil Sutter
2026-03-11 9:40 ` Pablo Neira Ayuso
2026-03-11 15:06 ` [nft PATCH 0/5] Enhance cache filter for list commands Eric Garver
2026-03-11 19:15 ` Phil Sutter
2026-03-18 16:23 ` Phil Sutter
2026-03-18 16:58 ` Pablo Neira Ayuso
2026-03-18 16:59 ` Pablo Neira Ayuso
2026-03-18 18:49 ` Phil Sutter
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=20260310231115.25638-5-phil@nwl.cc \
--to=phil@nwl.cc \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.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.