From 778de37d82e7bc90b4ba2abdfb0ebc8ddb2e7302 Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Fri, 13 Apr 2018 16:52:34 +0200 Subject: libnftables: Keep cmds list outside of parser_state Parser basically turns input into a list of commands and error messages. Having the commands list being part of struct parser_state does not make sense from this point of view, also it will have to go away with upcoming JSON support anyway. While being at it, change nft_netlink() to take just the list of commands instead of the whole parser state as parameter, also take care of command freeing in nft_run_cmd_from_* functions (where the list resides as auto-variable) instead of from inside nft_run(). Signed-off-by: Phil Sutter Signed-off-by: Pablo Neira Ayuso --- include/parser.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'include/parser.h') diff --git a/include/parser.h b/include/parser.h index 0bdb3fa8..79612757 100644 --- a/include/parser.h +++ b/include/parser.h @@ -25,7 +25,7 @@ struct parser_state { struct scope *scopes[SCOPE_NEST_MAX]; unsigned int scope; - struct list_head cmds; + struct list_head *cmds; struct eval_ctx ectx; }; @@ -33,7 +33,8 @@ struct mnl_socket; extern void parser_init(struct mnl_socket *nf_sock, struct nft_cache *cache, struct parser_state *state, struct list_head *msgs, - unsigned int debug_level, struct output_ctx *octx); + struct list_head *cmds, unsigned int debug_level, + struct output_ctx *octx); extern int nft_parse(struct nft_ctx *ctx, void *, struct parser_state *state); extern void *scanner_init(struct parser_state *state); -- cgit v1.2.3