From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Subject: [PATCH nft 1/5] rule: skip fuzzy lookup if object name is not available
Date: Sun, 15 Jun 2025 12:00:15 +0200 [thread overview]
Message-ID: <20250615100019.2988872-2-pablo@netfilter.org> (raw)
In-Reply-To: <20250615100019.2988872-1-pablo@netfilter.org>
Skip fuzzy lookup for suggestions when handles are used.
Note that 4cf97abfee61 ("rule: Avoid segfault with anonymous chains")
already skips it for chain.
Fixes: 285bb67a11ad ("src: introduce simple hints on incorrect set")
Fixes: 9f7817a4e022 ("src: introduce simple hints on incorrect chain")
Fixes: d7476ddd5f7d ("src: introduce simple hints on incorrect table")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
src/rule.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/rule.c b/src/rule.c
index 80315837baf0..a5a668f9992c 100644
--- a/src/rule.c
+++ b/src/rule.c
@@ -211,6 +211,9 @@ struct set *set_lookup_fuzzy(const char *set_name,
struct table *table;
struct set *set;
+ if (!set_name)
+ return NULL;
+
string_misspell_init(&st);
list_for_each_entry(table, &cache->table_cache.list, cache.list) {
@@ -1214,6 +1217,9 @@ struct table *table_lookup_fuzzy(const struct handle *h,
struct string_misspell_state st;
struct table *table;
+ if (!h->table.name)
+ return NULL;
+
string_misspell_init(&st);
list_for_each_entry(table, &cache->table_cache.list, cache.list) {
@@ -1696,6 +1702,9 @@ struct obj *obj_lookup_fuzzy(const char *obj_name,
struct table *table;
struct obj *obj;
+ if (!obj_name)
+ return NULL;
+
string_misspell_init(&st);
list_for_each_entry(table, &cache->table_cache.list, cache.list) {
@@ -2191,6 +2200,9 @@ struct flowtable *flowtable_lookup_fuzzy(const char *ft_name,
struct table *table;
struct flowtable *ft;
+ if (!ft_name)
+ return NULL;
+
string_misspell_init(&st);
list_for_each_entry(table, &cache->table_cache.list, cache.list) {
--
2.30.2
next prev parent reply other threads:[~2025-06-15 10:00 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-15 10:00 [PATCH nft 0/5] assorted updates and fixes Pablo Neira Ayuso
2025-06-15 10:00 ` Pablo Neira Ayuso [this message]
2025-06-15 10:00 ` [PATCH nft 2/5] cache: assert name is non-nul when looking up Pablo Neira Ayuso
2025-06-15 10:00 ` [PATCH nft 3/5] cache: pass name to cache_add() Pablo Neira Ayuso
2025-06-15 10:00 ` [PATCH nft 4/5] parser_bison: only reset by name is supported by now Pablo Neira Ayuso
2025-06-15 10:00 ` [PATCH nft 5/5] parser_bison: allow delete command with map via handle Pablo Neira Ayuso
2025-06-23 17:08 ` [PATCH nft 0/5] assorted updates and fixes 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=20250615100019.2988872-2-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.