Solves Bug 1462 - `nft -j list set` does not show counters
PATCH v2 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 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
src/json.c +6 -1
@@ -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); }
Signature · 1 line
2.17.1
Phil Sutter
reviewerQuoted 3 lines · Gopal Yadav
Solves Bug 1462 -
nft -j list setdoes not show countersSigned-off-by Gopal Yadav <[email protected]>
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
Quoted 9 lines · Phil Sutter
Quoted 3 lines · Gopal Yadav
Solves Bug 1462 -
nft -j list setdoes not show countersSigned-off-by Gopal Yadav <[email protected]>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?
Phil Sutter
reviewerQuoted 5 lines · Gopal Yadav
Quoted 4 lines · Phil Sutter
Quoted 2 lines · Gopal Yadav
Solves Bug 1462 -
nft -j list setdoes not show counters
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
Signed-off-by Gopal Yadav <[email protected]>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