Print error message in case family cannot be inferred, before this patch, $? shows 1 after nft execution but no error message was printed. Fixes: e5c9c8fe0bcc ("evaluate: stmt_evaluate_nat_map() only if stmt->nat.ipportmap == true") Signed-off-by: Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx> --- src/evaluate.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/evaluate.c b/src/evaluate.c index fe6384a48e14..f92b160ce3a4 100644 --- a/src/evaluate.c +++ b/src/evaluate.c @@ -3540,7 +3540,9 @@ static int stmt_evaluate_nat_map(struct eval_ctx *ctx, struct stmt *stmt) addr_type = TYPE_IP6ADDR; break; default: - return -1; + return stmt_error(ctx, stmt, + "Table family is %s, you must specify either ip or ip6 family after %s statement to disambiguate", + family2str(stmt->nat.family), stmt->ops->name); } dtype = concat_type_alloc((addr_type << TYPE_BITS) | TYPE_INET_SERVICE); -- 2.30.2