rule: add support for display flow tables content
PATCH 1/1 rule: add support for display flow tables content
This commit adds a new command that displays the definition of a single flow table:
If no family is specified, ip is assumed.
Signed-off-by Pablo M. Bermudo Garay <[email protected]>
--- include/rule.h | 1 + src/evaluate.c | 11 +++++++++++ src/parser_bison.y | 4 ++++ src/rule.c | 2 ++ 4 files changed, 18 insertions(+)
include/rule.h +1 -0
@@ -316,6 +316,7 @@ enum cmd_obj {CMD_OBJ_EXPR ,CMD_OBJ_MONITOR ,CMD_OBJ_EXPORT , +CMD_OBJ_FLOWTABLE , CMD_OBJ_FLOWTABLES, };
src/evaluate.c +11 -0
@@ -2652,6 +2652,7 @@ 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; +struct set *set;int ret; ret =cache_update (cmd->op, ctx->msgs);
@@ -2677,6 +2678,16 @@ static int cmd_evaluate_list(struct eval_ctx *ctx, struct cmd *cmd)return cmd_error (ctx,"Could not process rule: Set '%s' does not exist" , cmd->handle.set);return 0 ; +case CMD_OBJ_FLOWTABLE : + table =table_lookup (&cmd->handle); +if (table ==NULL ) +return cmd_error (ctx,"Could not process rule: Table '%s' does not exist" , + cmd->handle.table); + set =set_lookup (table, cmd->handle.set); +if (set ==NULL || !(set->flags &SET_F_EVAL )) +return cmd_error (ctx,"Could not process rule: Flow table '%s' does not exist" , + cmd->handle.set); +return 0 ;case CMD_OBJ_CHAIN : table =table_lookup (&cmd->handle);if (table ==NULL )
src/parser_bison.y +4 -0
@@ -840,6 +840,10 @@ list_cmd : TABLE table_spec { $$ = cmd_alloc(CMD_LIST, CMD_OBJ_FLOWTABLES, &$3, &@$, NULL); } + | FLOW TABLE set_spec + { + $$ = cmd_alloc(CMD_LIST, CMD_OBJ_FLOWTABLE, &$3, &@$, NULL); + } ; flush_cmd : TABLE table_spec
src/rule.c +2 -0
@@ -1214,6 +1214,8 @@ static int do_command_list(struct netlink_ctx *ctx, struct cmd *cmd)return do_list_ruleset (ctx, cmd);case CMD_OBJ_FLOWTABLES :return do_list_sets (ctx, cmd); +case CMD_OBJ_FLOWTABLE : +return do_list_set (ctx, cmd, table);default :BUG ("invalid command object type %u\n" , cmd->obj); }
Signature · 1 line
2.8.2
Quoted 4 lines · Pablo M. Bermudo Garay
This commit adds a new command that displays the definition of a single flow table:
If no family is specified, ip is assumed.
Applied, thanks. Please include an example next time in your patch description.