summaryrefslogtreecommitdiffstats
path: root/src/libnftables.c
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2018-10-29 12:11:09 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2018-10-29 15:07:35 +0100
commit48636e1fe6f6d3141de735f9faf4c359938b837c (patch)
tree261623cb4aa26de34f1432fd2b6964f9a57ae789 /src/libnftables.c
parent7a6f12d75034fed940ce635e76a13123430f088e (diff)
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 <phil@nwl.cc> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/libnftables.c')
-rw-r--r--src/libnftables.c18
1 files changed, 6 insertions, 12 deletions
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 = "<cmdline>",
@@ -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;
}