summaryrefslogtreecommitdiffstats
path: root/src/rule.c
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2018-10-27 11:44:09 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2018-10-29 15:07:35 +0100
commit0c6379953ab575b3b71dda4bcd94b940f0f68447 (patch)
tree5c05aef9bd8a372faa1317bfe7895f3858e8ed70 /src/rule.c
parenta42d2865bc7e96fe63276e22acd523d996aaf0a4 (diff)
src: add nft_ctx_output_{get,set}_stateless() to nft_ctx_output_{get,flags}_flags
Add NFT_CTX_OUTPUT_STATELESS flag and enable stateless printing from new output flags interface. This patch adds nft_output_save_flags() and nft_output_restore_flags() to temporarily disable stateful printing Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/rule.c')
-rw-r--r--src/rule.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/rule.c b/src/rule.c
index 63da3306..35c60de4 100644
--- a/src/rule.c
+++ b/src/rule.c
@@ -486,7 +486,7 @@ static void do_set_print(const struct set *set, struct print_fmt_options *opts,
{
set_print_declaration(set, opts, octx);
- if (set->flags & NFT_SET_EVAL && octx->stateless) {
+ if (set->flags & NFT_SET_EVAL && nft_output_stateless(octx)) {
nft_print(octx, "%s}%s", opts->tab, opts->nl);
return;
}
@@ -1683,7 +1683,7 @@ static void obj_print_data(const struct obj *obj,
if (octx->handle > 0)
nft_print(octx, " # handle %" PRIu64, obj->handle.handle.id);
nft_print(octx, "%s%s%s", opts->nl, opts->tab, opts->tab);
- if (octx->stateless) {
+ if (nft_output_stateless(octx)) {
nft_print(octx, "packets 0 bytes 0");
break;
}
@@ -1702,7 +1702,7 @@ static void obj_print_data(const struct obj *obj,
nft_print(octx, "%s%" PRIu64 " %s",
obj->quota.flags & NFT_QUOTA_F_INV ? "over " : "",
bytes, data_unit);
- if (!octx->stateless && obj->quota.used) {
+ if (!nft_output_stateless(octx) && obj->quota.used) {
data_unit = get_rate(obj->quota.used, &bytes);
nft_print(octx, " used %" PRIu64 " %s",
bytes, data_unit);