After this patch, we obtain:
# nft list set ip6 test pepe
<cmdline>:1:1-22: Error: Could not process rule: Set 'foo' does not exist
list set ip6 test foo
^^^^^^^^^^^^^^^^^^^^^
So we get things aligned with table and chain listing commands.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Acked-by: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>
case CMD_OBJ_TABLE:
if (cmd->handle.table == NULL)
return 0;
+
+ table = table_lookup(&cmd->handle);
+ if (table == NULL)
+ return cmd_error(ctx, "Could not process rule: Table '%s' does not exist",
+ cmd->handle.table);
+ return 0;
case CMD_OBJ_SET:
- if (table_lookup(&cmd->handle) == NULL)
+ 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 (set_lookup(table, cmd->handle.set) == NULL)
+ return cmd_error(ctx, "Could not process rule: Set '%s' does not exist",
+ cmd->handle.set);
return 0;
case CMD_OBJ_CHAIN:
table = table_lookup(&cmd->handle);