From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Cc: kaber@trash.net
Subject: [PATCH nft 1/2] evaluate: display error on unexisting chain when listing
Date: Wed, 12 Aug 2015 19:26:31 +0200 [thread overview]
Message-ID: <1439400392-30875-1-git-send-email-pablo@netfilter.org> (raw)
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>
---
Applies on top of the cache-consolidation branch.
src/evaluate.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/src/evaluate.c b/src/evaluate.c
index d432826..937097a 100644
--- a/src/evaluate.c
+++ b/src/evaluate.c
@@ -1956,16 +1956,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;
--
1.7.10.4
next reply other threads:[~2015-08-12 17:20 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-12 17:26 Pablo Neira Ayuso [this message]
2015-08-12 17:26 ` [PATCH nft 2/2] netlink: don't call netlink_dump_*() from listing functions with --debug=netlink Pablo Neira Ayuso
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1439400392-30875-1-git-send-email-pablo@netfilter.org \
--to=pablo@netfilter.org \
--cc=kaber@trash.net \
--cc=netfilter-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).