table inet filter {
}
table inet filter {
chain test {
counter
}
}
will now report:
crash:7:13-16: Error: No such file or directory
chain test {
^^^^
... which is still bogus, but we won't fallback to the 'internal'
location anymore and at least somehwat hint that there is a problem
with 'test' chain.
The error occurs because we're looking up the chain in the first
'table inet filter' instance, not the second.
Signed-off-by: Florian Westphal <[email protected]>
---
src/evaluate.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/evaluate.c b/src/evaluate.c
index 69b853f58722..b56932ccabcc 100644
--- a/src/evaluate.c
+++ b/src/evaluate.c
@@ -182,17 +182,17 @@ static int table_not_found(struct eval_ctx *ctx)
family2str(table->handle.family));
}
-static int chain_not_found(struct eval_ctx *ctx)
+static int chain_not_found(struct eval_ctx *ctx, struct handle *h)
{
const struct table *table;
struct chain *chain;
- chain = chain_lookup_fuzzy(&ctx->cmd->handle, &ctx->nft->cache, &table);
+ chain = chain_lookup_fuzzy(h, &ctx->nft->cache, &table);
if (chain == NULL)
- return cmd_error(ctx, &ctx->cmd->handle.chain.location,
+ return cmd_error(ctx, &h->chain.location,
"%s", strerror(ENOENT));
- return cmd_error(ctx, &ctx->cmd->handle.chain.location,
+ return cmd_error(ctx, &h->chain.location,
"%s; did you mean chain ā%sā in table %s ā%sā?",
strerror(ENOENT), chain->handle.chain.name,
family2str(chain->handle.family),
@@ -3264,7 +3264,7 @@ static int rule_cache_update(struct eval_ctx *ctx, enum
cmd_ops op)
chain = chain_lookup(table, &rule->handle);
if (!chain)
- return chain_not_found(ctx);
+ return chain_not_found(ctx, &rule->handle);
if (rule->handle.index.id) {
ref = rule_lookup_by_index(chain, rule->handle.index.id);
@@ -3710,7 +3710,7 @@ static int cmd_evaluate_list(struct eval_ctx *ctx, struct
cmd *cmd)
return table_not_found(ctx);
if (chain_lookup(table, &cmd->handle) == NULL)
- return chain_not_found(ctx);
+ return chain_not_found(ctx, &cmd->handle);
return 0;
case CMD_OBJ_QUOTA:
@@ -3843,7 +3843,7 @@ static int cmd_evaluate_rename(struct eval_ctx *ctx,
struct cmd *cmd)
return table_not_found(ctx);
if (chain_lookup(table, &ctx->cmd->handle) == NULL)
- return chain_not_found(ctx);
+ return chain_not_found(ctx, &ctx->cmd->handle);
break;
default:
--
2.21.0