evaluate: fix "list set" unexpected behaviour
PATCH 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 ^^^^^^^^^^^^^^^^^^^^
Signed-off-by Pablo M. Bermudo Garay <[email protected]>
--- src/evaluate.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
src/evaluate.c +3 -1
@@ -2674,7 +2674,9 @@ 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->flags &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
Pablo Neira Ayuso
maintainerQuoted 31 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} } }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 ^^^^^^^^^^^^^^^^^^^^Signed-off-by Pablo M. Bermudo Garay <[email protected]>--- src/evaluate.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)src/evaluate.c +0
-0
src/evaluate.c static int cmd_evaluate_list(struct eval_ctx *ctx, struct cmd *cmd) · line 2679
Quoted 7 lines
src/evaluate.c +3
-1@@ -2674,7 +2674,9 @@ 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->flags &SET_F_EVAL )
I'd suggest:
set == NULL && set->flags & (SET_F_EVAL | SET_F_MAP)
Quoted 6 lines
src/evaluate.c +0
-0return cmd_error (ctx,"Could not process rule: Set '%s' does not exist" , cmd->handle.set);return 0 ;Signature · 1 line
2.8.3
2016-06-01 11:20 GMT+02:00 Pablo Neira Ayuso <[email protected]>:
Quoted 3 lines
I'd suggest:
set == NULL && set->flags & (SET_F_EVAL | SET_F_MAP)
Oh, sure. Thank you for pointing that out.