All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH nft] evaluate: reject set definition with no key
@ 2023-12-06 12:42 Pablo Neira Ayuso
  2023-12-06 12:47 ` Florian Westphal
  0 siblings, 1 reply; 2+ messages in thread
From: Pablo Neira Ayuso @ 2023-12-06 12:42 UTC (permalink / raw)
  To: netfilter-devel; +Cc: fw

 tests/shell/testcases/bogons/nft-f/set_definition_with_no_key_assert
 BUG: unhandled key type 2
 nft: src/intervals.c:59: setelem_expr_to_range: Assertion `0' failed.

This patch adds a new unit tests/shell courtesy of Florian Westphal.

Fixes: 3975430b12d9 ("src: expand table command before evaluation")
Reported-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 src/evaluate.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/evaluate.c b/src/evaluate.c
index cf5f32c144d3..6419de572693 100644
--- a/src/evaluate.c
+++ b/src/evaluate.c
@@ -4693,6 +4693,10 @@ static int set_evaluate(struct eval_ctx *ctx, struct set *set)
 	struct stmt *stmt;
 	const char *type;
 
+	if (set->key == NULL)
+		return set_error(ctx, set, "%s definition does not specify key",
+				 set->flags & NFT_SET_MAP ? "map" : "set");
+
 	if (!set_is_anonymous(set->flags)) {
 		table = table_cache_find(&ctx->nft->cache.table_cache,
 					 set->handle.table.name,
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH nft] evaluate: reject set definition with no key
  2023-12-06 12:42 [PATCH nft] evaluate: reject set definition with no key Pablo Neira Ayuso
@ 2023-12-06 12:47 ` Florian Westphal
  0 siblings, 0 replies; 2+ messages in thread
From: Florian Westphal @ 2023-12-06 12:47 UTC (permalink / raw)
  To: Pablo Neira Ayuso; +Cc: netfilter-devel, fw

Pablo Neira Ayuso <pablo@netfilter.org> wrote:
>  tests/shell/testcases/bogons/nft-f/set_definition_with_no_key_assert
>  BUG: unhandled key type 2
>  nft: src/intervals.c:59: setelem_expr_to_range: Assertion `0' failed.
> 
> This patch adds a new unit tests/shell courtesy of Florian Westphal.
> 
> Fixes: 3975430b12d9 ("src: expand table command before evaluation")
> Reported-by: Florian Westphal <fw@strlen.de>
> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>

Looks saner than what I did, thanks Pablo.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-12-06 12:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-06 12:42 [PATCH nft] evaluate: reject set definition with no key Pablo Neira Ayuso
2023-12-06 12:47 ` Florian Westphal

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.