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@xxxxxxxxxxxxx> --- 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