All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH nft] evaluate: better error notice when interval flag is not set on
@ 2020-01-10 10:55 Pablo Neira Ayuso
  2020-01-10 13:07 ` Phil Sutter
  0 siblings, 1 reply; 2+ messages in thread
From: Pablo Neira Ayuso @ 2020-01-10 10:55 UTC (permalink / raw)
  To: netfilter-devel

Users get confused with the existing error notice, let's try a different one:

 # nft add element x y { 1.1.1.0/24 }
 Error: You must add 'flags interval' to your set declaration if you want to add prefix elements
 add element x y { 1.1.1.0/24 }
                   ^^^^^^^^^^

Closes: https://bugzilla.netfilter.org/show_bug.cgi?id=1395
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 src/evaluate.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/src/evaluate.c b/src/evaluate.c
index 34e4473e4c9a..e7881543d2de 100644
--- a/src/evaluate.c
+++ b/src/evaluate.c
@@ -1299,13 +1299,10 @@ static int expr_evaluate_set_elem(struct eval_ctx *ctx, struct expr **expr)
 	    !(ctx->set->flags & (NFT_SET_ANONYMOUS | NFT_SET_INTERVAL))) {
 		switch (elem->key->etype) {
 		case EXPR_PREFIX:
-			return expr_error(ctx->msgs, elem,
-					  "Set member cannot be prefix, "
-					  "missing interval flag on declaration");
 		case EXPR_RANGE:
 			return expr_error(ctx->msgs, elem,
-					  "Set member cannot be range, "
-					  "missing interval flag on declaration");
+					  "You must add 'flags interval' to your %s declaration if you want to add %s elements",
+					  set_is_map(ctx->set->flags) ? "map" : "set", expr_name(elem->key));
 		default:
 			break;
 		}
-- 
2.11.0


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

* Re: [PATCH nft] evaluate: better error notice when interval flag is not set on
  2020-01-10 10:55 [PATCH nft] evaluate: better error notice when interval flag is not set on Pablo Neira Ayuso
@ 2020-01-10 13:07 ` Phil Sutter
  0 siblings, 0 replies; 2+ messages in thread
From: Phil Sutter @ 2020-01-10 13:07 UTC (permalink / raw)
  To: Pablo Neira Ayuso; +Cc: netfilter-devel

On Fri, Jan 10, 2020 at 11:55:46AM +0100, Pablo Neira Ayuso wrote:
> Users get confused with the existing error notice, let's try a different one:
> 
>  # nft add element x y { 1.1.1.0/24 }
>  Error: You must add 'flags interval' to your set declaration if you want to add prefix elements
>  add element x y { 1.1.1.0/24 }
>                    ^^^^^^^^^^

Not sure why "missing inverval flag on declaration" is more confusing
than "you must add 'flags interval' to ...", but maybe I'm just too much
into the topic to notice the difference. :)

> Closes: https://bugzilla.netfilter.org/show_bug.cgi?id=1395

Unrelated? Did you pick the wrong ticket ID?

> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>

Except for nfbz link:

Acked-by: Phil Sutter <phil@nwl.cc>

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

end of thread, other threads:[~2020-01-10 13:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-10 10:55 [PATCH nft] evaluate: better error notice when interval flag is not set on Pablo Neira Ayuso
2020-01-10 13:07 ` Phil Sutter

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.