From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Subject: [PATCH nftables] rule: skip exact matches on fuzzy lookup
Date: Wed, 19 May 2021 23:07:59 +0200 [thread overview]
Message-ID: <20210519210759.264858-1-pablo@netfilter.org> (raw)
The fuzzy lookup is exercised from the error path, when no object is
found. Remove branch that checks for exact matching since that should
not ever happen.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
src/rule.c | 19 -------------------
1 file changed, 19 deletions(-)
diff --git a/src/rule.c b/src/rule.c
index dda1718d69ef..dcf1646a9c7c 100644
--- a/src/rule.c
+++ b/src/rule.c
@@ -215,10 +215,6 @@ struct set *set_lookup_fuzzy(const char *set_name,
list_for_each_entry(set, &table->set_cache.list, cache.list) {
if (set_is_anonymous(set->flags))
continue;
- if (!strcmp(set->handle.set.name, set_name)) {
- *t = table;
- return set;
- }
if (string_misspell_update(set->handle.set.name,
set_name, set, &st))
*t = table;
@@ -765,10 +761,6 @@ struct chain *chain_lookup_fuzzy(const struct handle *h,
list_for_each_entry(table, &cache->table_cache.list, cache.list) {
list_for_each_entry(chain, &table->chain_cache.list, cache.list) {
- if (!strcmp(chain->handle.chain.name, h->chain.name)) {
- *t = table;
- return chain;
- }
if (string_misspell_update(chain->handle.chain.name,
h->chain.name, chain, &st))
*t = table;
@@ -1174,9 +1166,6 @@ struct table *table_lookup_fuzzy(const struct handle *h,
string_misspell_init(&st);
list_for_each_entry(table, &cache->table_cache.list, cache.list) {
- if (!strcmp(table->handle.table.name, h->table.name))
- return table;
-
string_misspell_update(table->handle.table.name,
h->table.name, table, &st);
}
@@ -1728,10 +1717,6 @@ struct obj *obj_lookup_fuzzy(const char *obj_name,
list_for_each_entry(table, &cache->table_cache.list, cache.list) {
list_for_each_entry(obj, &table->obj_cache.list, cache.list) {
- if (!strcmp(obj->handle.obj.name, obj_name)) {
- *t = table;
- return obj;
- }
if (string_misspell_update(obj->handle.obj.name,
obj_name, obj, &st))
*t = table;
@@ -2206,10 +2191,6 @@ struct flowtable *flowtable_lookup_fuzzy(const char *ft_name,
list_for_each_entry(table, &cache->table_cache.list, cache.list) {
list_for_each_entry(ft, &table->ft_cache.list, cache.list) {
- if (!strcmp(ft->handle.flowtable.name, ft_name)) {
- *t = table;
- return ft;
- }
if (string_misspell_update(ft->handle.flowtable.name,
ft_name, ft, &st))
*t = table;
--
2.30.2
reply other threads:[~2021-05-19 21:08 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20210519210759.264858-1-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 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).