diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2015-08-12 18:44:22 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2015-08-18 01:36:12 +0200 |
commit | 576bc0f8e51feac9af06dc206d69a695e4d35c91 (patch) | |
tree | 0e87ea5933cbf78aa6d7941c71cf366df4baae04 /src/evaluate.c | |
parent | 2dedd5f419cd9d63fb5b1f76423d096773d3bf6a (diff) |
evaluate: display error on unexisting chain when listing
nft list chain ip test output
<cmdline>:1:1-25: Error: Could not process rule: Chain 'output' does not exist
list chain ip test output
^^^^^^^^^^^^^^^^^^^^^^^^^
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/evaluate.c')
-rw-r--r-- | src/evaluate.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/evaluate.c b/src/evaluate.c index 00e9c4b4..1405da83 100644 --- a/src/evaluate.c +++ b/src/evaluate.c @@ -1960,16 +1960,26 @@ static int cmd_evaluate_delete(struct eval_ctx *ctx, struct cmd *cmd) static int cmd_evaluate_list(struct eval_ctx *ctx, struct cmd *cmd) { + struct table *table; + switch (cmd->obj) { case CMD_OBJ_TABLE: if (cmd->handle.table == NULL) return 0; - case CMD_OBJ_CHAIN: case CMD_OBJ_SET: if (table_lookup(&cmd->handle) == NULL) return cmd_error(ctx, "Could not process rule: Table '%s' does not exist", cmd->handle.table); return 0; + case CMD_OBJ_CHAIN: + table = table_lookup(&cmd->handle); + if (table == NULL) + return cmd_error(ctx, "Could not process rule: Table '%s' does not exist", + cmd->handle.table); + if (chain_lookup(table, &cmd->handle) == NULL) + return cmd_error(ctx, "Could not process rule: Chain '%s' does not exist", + cmd->handle.chain); + return 0; case CMD_OBJ_SETS: case CMD_OBJ_RULESET: return 0; |