Skip to contentSkip to conversation

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

PATCH Superseded Gopal Yadav 1 participant 1 message Oct 6, 2020 netfilter

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

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

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

---
 src/json.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
src/json.c +5 -1
index 5856f9fc..205b4b24 100644
@@ -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,10 @@ 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);
+		}
 		return json_pack("{s:o}", "elem", root);
 	}
 
Signature · 1 line
2.17.1