Netfilter-Devel Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH v2] Solves Bug 1462 - `nft -j list set` does not show counters
@ 2020-10-07 14:03 Gopal Yadav
  2020-10-08 17:02 ` Phil Sutter
  0 siblings, 1 reply; 4+ messages in thread
From: Gopal Yadav @ 2020-10-07 14:03 UTC (permalink / raw)
  To: netfilter-devel; +Cc: Gopal Yadav

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] Solves Bug 1462 - `nft -j list set` does not show counters
  2020-10-07 14:03 [PATCH v2] Solves Bug 1462 - `nft -j list set` does not show counters Gopal Yadav
@ 2020-10-08 17:02 ` Phil Sutter
  2020-10-09  5:45   ` Gopal Yadav
  0 siblings, 1 reply; 4+ messages in thread
From: Phil Sutter @ 2020-10-08 17:02 UTC (permalink / raw)
  To: Gopal Yadav; +Cc: netfilter-devel

On Wed, Oct 07, 2020 at 07:33:37PM +0530, Gopal Yadav wrote:
> Solves Bug 1462 - `nft -j list set` does not show counters
> 
> Signed-off-by: Gopal Yadav <gopunop@gmail.com>

Added a comment about potential clashes (json_object_update_missing()
hides those) and replaced the duplicate subject line by a commit
message, then applied the result.

Thanks, Phil

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] Solves Bug 1462 - `nft -j list set` does not show counters
  2020-10-08 17:02 ` Phil Sutter
@ 2020-10-09  5:45   ` Gopal Yadav
  2020-10-09  8:31     ` Phil Sutter
  0 siblings, 1 reply; 4+ messages in thread
From: Gopal Yadav @ 2020-10-09  5:45 UTC (permalink / raw)
  To: Phil Sutter, netfilter-devel

On Thu, Oct 8, 2020 at 10:32 PM Phil Sutter <phil@nwl.cc> wrote:
>
> On Wed, Oct 07, 2020 at 07:33:37PM +0530, Gopal Yadav wrote:
> > Solves Bug 1462 - `nft -j list set` does not show counters
> >
> > Signed-off-by: Gopal Yadav <gopunop@gmail.com>
>
> Added a comment about potential clashes (json_object_update_missing()
> hides those) and replaced the duplicate subject line by a commit
> message, then applied the result.

Any description of those potential clashes?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] Solves Bug 1462 - `nft -j list set` does not show counters
  2020-10-09  5:45   ` Gopal Yadav
@ 2020-10-09  8:31     ` Phil Sutter
  0 siblings, 0 replies; 4+ messages in thread
From: Phil Sutter @ 2020-10-09  8:31 UTC (permalink / raw)
  To: Gopal Yadav; +Cc: netfilter-devel

On Fri, Oct 09, 2020 at 11:15:48AM +0530, Gopal Yadav wrote:
> On Thu, Oct 8, 2020 at 10:32 PM Phil Sutter <phil@nwl.cc> wrote:
> >
> > On Wed, Oct 07, 2020 at 07:33:37PM +0530, Gopal Yadav wrote:
> > > Solves Bug 1462 - `nft -j list set` does not show counters
> > >
> > > Signed-off-by: Gopal Yadav <gopunop@gmail.com>
> >
> > Added a comment about potential clashes (json_object_update_missing()
> > hides those) and replaced the duplicate subject line by a commit
> > message, then applied the result.
> 
> Any description of those potential clashes?

AFAICT, none are possible right now. Though the design allows for it and
we might miss that.

Cheers, Phil

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-07 14:03 [PATCH v2] Solves Bug 1462 - `nft -j list set` does not show counters Gopal Yadav
2020-10-08 17:02 ` Phil Sutter
2020-10-09  5:45   ` Gopal Yadav
2020-10-09  8:31     ` Phil Sutter

Netfilter-Devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/netfilter-devel/0 netfilter-devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 netfilter-devel netfilter-devel/ https://lore.kernel.org/netfilter-devel \
		netfilter-devel@vger.kernel.org
	public-inbox-index netfilter-devel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.netfilter-devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git