diff options
author | Phil Sutter <phil@nwl.cc> | 2017-08-22 14:40:04 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2017-08-23 23:42:33 +0200 |
commit | 7c43dc46179a6f85406eb861e970cbb06bac05d2 (patch) | |
tree | dbc85c4fcb760060dfda381b3c6205d079ba8151 /src/cli.c | |
parent | c06413211e6f5f8720fa75909f84b6c0b8c17d68 (diff) |
src: Keep cache in struct nft_ctx
This is preliminary work for Eric's libnftables patchset.
Cc: Eric Leblond <eric@regit.org>
Signed-off-by: Phil Sutter <phil@nwl.cc>
Diffstat (limited to 'src/cli.c')
-rw-r--r-- | src/cli.c | 14 |
1 files changed, 6 insertions, 8 deletions
@@ -41,9 +41,8 @@ static const struct input_descriptor indesc_cli = { }; static struct parser_state *state; -static struct nft_ctx cli_nft; +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; @@ -135,12 +134,12 @@ static void cli_complete(char *line) xfree(line); line = s; - parser_init(cli_nf_sock, cli_cache, state, &msgs); + parser_init(cli_nf_sock, &cli_nft->cache, state, &msgs); scanner_push_buffer(scanner, &indesc_cli, line); - nft_run(&cli_nft, cli_nf_sock, cli_cache, scanner, state, &msgs); + nft_run(cli_nft, cli_nf_sock, scanner, state, &msgs); erec_print_list(stdout, &msgs); xfree(line); - cache_release(cli_cache); + cache_release(&cli_nft->cache); iface_cache_release(); } @@ -150,13 +149,12 @@ static char **cli_completion(const char *text, int start, int end) } int cli_init(struct nft_ctx *nft, struct mnl_socket *nf_sock, - struct nft_cache *cache, struct parser_state *_state) + struct parser_state *_state) { const char *home; cli_nf_sock = nf_sock; - cli_nft = *nft; - cli_cache = cache; + cli_nft = nft; rl_readline_name = "nft"; rl_instream = stdin; rl_outstream = stdout; |