diff options
author | Varsha Rao <rvarsha016@gmail.com> | 2017-08-13 10:00:18 +0530 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2017-08-14 11:32:21 +0200 |
commit | 07b45939972eb81c3c3db21c8589b51a62f4843a (patch) | |
tree | b50dfd024653fd11f63821e2e7e4805dbb16036b /src/cli.c | |
parent | bb8e9e84a1b537ccf1b7abbc9d11af0383801a0d (diff) |
src: introduce struct nft_cache
Pass variable cache_initialized and structure list_head as members of
structure nft_cache.
Joint work with Pablo Neira.
Signed-off-by: Varsha Rao <rvarsha016@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/cli.c')
-rw-r--r-- | src/cli.c | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -43,8 +43,8 @@ static const struct input_descriptor indesc_cli = { static struct parser_state *state; static struct nft_ctx cli_nft; static struct mnl_socket *cli_nf_sock; +static struct nft_cache *cli_cache; static void *scanner; - static char histfile[PATH_MAX]; static char *multiline; static bool eof; @@ -135,12 +135,12 @@ static void cli_complete(char *line) xfree(line); line = s; - parser_init(cli_nf_sock, state, &msgs); + parser_init(cli_nf_sock, cli_cache, state, &msgs); scanner_push_buffer(scanner, &indesc_cli, line); - nft_run(&cli_nft, cli_nf_sock, scanner, state, &msgs); + nft_run(&cli_nft, cli_nf_sock, cli_cache, scanner, state, &msgs); erec_print_list(stdout, &msgs); xfree(line); - cache_release(); + cache_release(cli_cache); iface_cache_release(); } @@ -176,12 +176,13 @@ void __fmtstring(1, 0) cli_display(const char *fmt, va_list ap) } int cli_init(struct nft_ctx *nft, struct mnl_socket *nf_sock, - struct parser_state *_state) + struct nft_cache *cache, struct parser_state *_state) { const char *home; cli_nf_sock = nf_sock; cli_nft = *nft; + cli_cache = cache; rl_readline_name = "nft"; rl_instream = stdin; rl_outstream = stdout; |