All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gopal Yadav <gopunop@gmail.com>
To: netfilter-devel@vger.kernel.org
Cc: Gopal Yadav <gopunop@gmail.com>
Subject: [PATCH v2] Solves Bug 1462 - `nft -j list set` does not show counters
Date: Wed,  7 Oct 2020 19:33:37 +0530	[thread overview]
Message-ID: <20201007140337.21218-1-gopunop@gmail.com> (raw)

Solves Bug 1462 - `nft -j list set` does not show counters

Signed-off-by: Gopal Yadav <gopunop@gmail.com>
---
 src/json.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/json.c b/src/json.c
index 5856f9fc..ea6e392c 100644
--- a/src/json.c
+++ b/src/json.c
@@ -589,7 +589,7 @@ json_t *set_elem_expr_json(const struct expr *expr, struct output_ctx *octx)
 		return NULL;
 
 	/* these element attributes require formal set elem syntax */
-	if (expr->timeout || expr->expiration || expr->comment) {
+	if (expr->timeout || expr->expiration || expr->comment || expr->stmt) {
 		root = json_pack("{s:o}", "val", root);
 
 		if (expr->timeout) {
@@ -604,6 +604,11 @@ json_t *set_elem_expr_json(const struct expr *expr, struct output_ctx *octx)
 			tmp = json_string(expr->comment);
 			json_object_set_new(root, "comment", tmp);
 		}
+		if (expr->stmt) {
+			tmp = stmt_print_json(expr->stmt, octx);
+			json_object_update_missing(root, tmp);
+			json_decref(tmp);
+		}
 		return json_pack("{s:o}", "elem", root);
 	}
 
-- 
2.17.1


             reply	other threads:[~2020-10-07 14:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-07 14:03 Gopal Yadav [this message]
2020-10-08 17:02 ` [PATCH v2] Solves Bug 1462 - `nft -j list set` does not show counters Phil Sutter
2020-10-09  5:45   ` Gopal Yadav
2020-10-09  8:31     ` Phil Sutter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201007140337.21218-1-gopunop@gmail.com \
    --to=gopunop@gmail.com \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.