Netfilter-Devel Archive on lore.kernel.org
 help / color / 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	[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, back to index

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

Netfilter-Devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/netfilter-devel/0 netfilter-devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 netfilter-devel netfilter-devel/ https://lore.kernel.org/netfilter-devel \
		netfilter-devel@vger.kernel.org
	public-inbox-index netfilter-devel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.netfilter-devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git