All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Solves Bug 1388 - Combining --terse with --json has no effect (with test)
@ 2020-09-22  8:25 Gopal
  2020-09-22 21:10 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 2+ messages in thread
From: Gopal @ 2020-09-22  8:25 UTC (permalink / raw)
  To: netfilter-devel; +Cc: Gopal Yadav

From: Gopal Yadav <gopunop@gmail.com>

Solves Bug 1388 - Combining --terse with --json has no effect (with test)

Signed-off-by: Gopal Yadav <gopunop@gmail.com>
---
 src/json.c                                             | 2 +-
 tests/shell/testcases/listing/0021ruleset_json_terse_0 | 9 +++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)
 create mode 100644 tests/shell/testcases/listing/0021ruleset_json_terse_0

diff --git a/src/json.c b/src/json.c
index a9f5000f..5856f9fc 100644
--- a/src/json.c
+++ b/src/json.c
@@ -140,7 +140,7 @@ static json_t *set_print_json(struct output_ctx *octx, const struct set *set)
 		json_object_set_new(root, "gc-interval", tmp);
 	}
 
-	if (set->init && set->init->size > 0) {
+	if (!nft_output_terse(octx) && set->init && set->init->size > 0) {
 		json_t *array = json_array();
 		const struct expr *i;
 
diff --git a/tests/shell/testcases/listing/0021ruleset_json_terse_0 b/tests/shell/testcases/listing/0021ruleset_json_terse_0
new file mode 100644
index 00000000..3fa22565
--- /dev/null
+++ b/tests/shell/testcases/listing/0021ruleset_json_terse_0
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+$NFT flush ruleset
+$NFT add table ip test
+$NFT add chain ip test c
+$NFT add set ip test s { type ipv4_addr\; }
+$NFT add element ip test s { 192.168.3.4, 192.168.3.5 }
+
+test $($NFT -j -t list ruleset | grep 192) || exit 0
-- 
2.17.1


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

* Re: [PATCH] Solves Bug 1388 - Combining --terse with --json has no effect (with test)
  2020-09-22  8:25 [PATCH] Solves Bug 1388 - Combining --terse with --json has no effect (with test) Gopal
@ 2020-09-22 21:10 ` Pablo Neira Ayuso
  0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2020-09-22 21:10 UTC (permalink / raw)
  To: Gopal; +Cc: netfilter-devel

On Tue, Sep 22, 2020 at 01:55:33PM +0530, Gopal wrote:
> From: Gopal Yadav <gopunop@gmail.com>
> 
> Solves Bug 1388 - Combining --terse with --json has no effect (with test)

Applied, thanks.

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

end of thread, other threads:[~2020-09-22 21:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-22  8:25 [PATCH] Solves Bug 1388 - Combining --terse with --json has no effect (with test) Gopal
2020-09-22 21:10 ` Pablo Neira Ayuso

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.