From 0c6379953ab575b3b71dda4bcd94b940f0f68447 Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Sat, 27 Oct 2018 11:44:09 +0200 Subject: 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 --- src/rule.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/rule.c') 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); -- cgit v1.2.3