From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Phil Sutter <phil@nwl.cc>, netfilter-devel@vger.kernel.org
Subject: Re: [PATCH nft 2/2] evaluate: restore interval + concatenation in anonymous set
Date: Mon, 14 Jun 2021 13:56:44 +0200 [thread overview]
Message-ID: <20210614115644.GA27182@salvia> (raw)
In-Reply-To: <20210614113403.GP22614@orbyte.nwl.cc>
[-- Attachment #1: Type: text/plain, Size: 1251 bytes --]
On Mon, Jun 14, 2021 at 01:34:03PM +0200, Phil Sutter wrote:
> Hi Pablo,
>
> On Fri, Jun 11, 2021 at 07:15:38PM +0200, Pablo Neira Ayuso wrote:
> > Perform the table and set lookup only for non-anonymous sets, where the
> > incremental cache update is required.
> >
> > The problem fixed by 7aa08d45031e ("evaluate: Perform set evaluation on
> > implicitly declared (anonymous) sets") resurrected after the cache
> > rework.
> >
> > # nft add rule x y tcp sport . tcp dport vmap { ssh . 0-65535 : accept, 0-65535 . ssh : accept }
> > BUG: invalid range expression type concat
> > nft: expression.c:1422: range_expr_value_low: Assertion `0' failed.
> > Abort
> >
> > Add a test case to make sure this does not happen again.
> >
> > Fixes: 5ec5c706d993 ("cache: add hashtable cache for table")
> > Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
>
> This triggers a warning:
>
> evaluate.c: In function 'set_evaluate':
> evaluate.c:3870:13: warning: 'table' may be used uninitialized in this function [-Wmaybe-uninitialized]
> 3870 | if (set_cache_find(table, set->handle.set.name) == NULL)
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Hm, this needs to be restricted to anonymous sets, attaching patch.
[-- Attachment #2: x.patch --]
[-- Type: text/x-diff, Size: 444 bytes --]
diff --git a/src/evaluate.c b/src/evaluate.c
index 5311963a20c5..7cd90e2c1840 100644
--- a/src/evaluate.c
+++ b/src/evaluate.c
@@ -3867,7 +3867,8 @@ static int set_evaluate(struct eval_ctx *ctx, struct set *set)
}
ctx->set = NULL;
- if (set_cache_find(table, set->handle.set.name) == NULL)
+ if (!(set->flags & NFT_SET_ANONYMOUS) &&
+ !set_cache_find(table, set->handle.set.name))
set_cache_add(set_get(set), table);
return 0;
next prev parent reply other threads:[~2021-06-14 11:56 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-11 17:15 [PATCH nft 2/2] evaluate: restore interval + concatenation in anonymous set Pablo Neira Ayuso
2021-06-14 11:34 ` Phil Sutter
2021-06-14 11:56 ` Pablo Neira Ayuso [this message]
2021-06-14 11:58 ` Pablo Neira Ayuso
2021-06-14 12:04 ` 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=20210614115644.GA27182@salvia \
--to=pablo@netfilter.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=phil@nwl.cc \
/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).