Skip to contentSkip to conversation

evaluate: fix "list set" unexpected behaviour

PATCH Applied Pablo M. Bermudo Garay 2 participants 2 messages Jun 1, 2016 netfilter

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 evaluate: fix "list set" unexpected behaviour

Special sets like maps and flow tables have their own commands to be listed and inspected.

Before this patch, "nft list set" was able to display these special sets content:

  # nft list set filter test
  table ip filter {
          map test {
                  type ipv4_addr : inet_service
                  elements = { 192.168.1.101 : http-alt}
          }
  }

Now an error is shown:

  # nft list set filter test
  <cmdline>:1:1-20: Error: Could not process rule: Set 'test' does not exist
  list set filter test
  ^^^^^^^^^^^^^^^^^^^^
---
 src/evaluate.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
src/evaluate.c +2 -1
index 423523f..f24e5f3 100644
@@ -2674,7 +2674,8 @@ static int cmd_evaluate_list(struct eval_ctx *ctx, struct cmd *cmd)
 		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)
+		set = set_lookup(table, cmd->handle.set);
+		if (set == NULL || set->flags & (SET_F_MAP | SET_F_EVAL))
 			return cmd_error(ctx, "Could not process rule: Set '%s' does not exist",
 					 cmd->handle.set);
 		return 0;
Signature · 1 line
2.8.3
maintainer Applied
#1 lore raw
Quoted 14 lines · Pablo M. Bermudo Garay

Special sets like maps and flow tables have their own commands to be listed and inspected.

Before this patch, "nft list set" was able to display these special sets content:

  # nft list set filter test
  table ip filter {
          map test {
                  type ipv4_addr : inet_service
                  elements = { 192.168.1.101 : http-alt}
          }
  }
Quoted 6 lines

Now an error is shown:

  # nft list set filter test
  <cmdline>:1:1-20: Error: Could not process rule: Set 'test' does not exist
  list set filter test
  ^^^^^^^^^^^^^^^^^^^^

OK, let's place this in the tree before the release.

Applied, thanks.