From 48636e1fe6f6d3141de735f9faf4c359938b837c Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Mon, 29 Oct 2018 12:11:09 +0100 Subject: src: add nft_ctx_output_{get,set}_echo() to nft_ctx_output_{get,set}_flags Add NFT_CTX_OUTPUT_ECHO flag and echo the command that has been send to the kernel. Acked-by: Phil Sutter Signed-off-by: Pablo Neira Ayuso --- src/libnftables.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'src/libnftables.c') diff --git a/src/libnftables.c b/src/libnftables.c index ff7a53d2..03c15fba 100644 --- a/src/libnftables.c +++ b/src/libnftables.c @@ -342,16 +342,6 @@ void nft_ctx_output_set_debug(struct nft_ctx *ctx, unsigned int mask) ctx->debug_mask = mask; } -bool nft_ctx_output_get_echo(struct nft_ctx *ctx) -{ - return ctx->output.echo; -} - -void nft_ctx_output_set_echo(struct nft_ctx *ctx, bool val) -{ - ctx->output.echo = val; -} - static const struct input_descriptor indesc_cmdline = { .type = INDESC_BUFFER, .name = "", @@ -431,7 +421,9 @@ err: } free(nlbuf); - if (!rc && nft_output_json(&nft->output) && nft->output.echo) + if (!rc && + nft_output_json(&nft->output) && + nft_output_echo(&nft->output)) json_print_echo(nft); return rc; } @@ -472,7 +464,9 @@ err: nft->scanner = NULL; } - if (!rc && nft_output_json(&nft->output) && nft->output.echo) + if (!rc && + nft_output_json(&nft->output) && + nft_output_echo(&nft->output)) json_print_echo(nft); return rc; } -- cgit v1.2.3