json: complete multi-statement set element support
Pablo Neira Ayuso
maintainerPATCH 1/1 json: complete multi-statement set element support
Remove artificial limitation on the maximum number of statements per element in listings.
Moreover, update tests/shell which are currently incorrect.
Fixes e6d1d0d61195 ("src: add set element multi-statement support")
Signed-off-by Pablo Neira Ayuso <[email protected]>
--- src/json.c | 2 -- .../nft-f/dumps/0025empty_dynset_0.json-nft | 4 ++++ .../sets/dumps/0060set_multistmt_0.json-nft | 12 ++++++++++++ .../sets/dumps/0060set_multistmt_1.json-nft | 14 ++++++++++++++ 4 files changed, 30 insertions(+), 2 deletions(-)
src/json.c +0 -2
@@ -821,8 +821,6 @@ static json_t *__set_elem_expr_json(const struct expr *expr,/* XXX: detect and complain about clashes? */ json_object_update_missing (root, tmp);json_decref (tmp); -/* TODO: only one statement per element. */ -break ; }return nft_json_pack ("{s:o}" ,"elem" , root); }
tests/shell/testcases/nft-f/dumps/0025empty_dynset_0.json-nft +4 -0
@@ -101,6 +101,10 @@ "rate": 1, "burst": 5, "per": "second" + }, + "counter": { + "packets": 0, + "bytes": 0 } } }
tests/shell/testcases/sets/dumps/0060set_multistmt_0.json-nft +12 -0
@@ -41,6 +41,10 @@ "rate": 1, "burst": 5, "per": "second" + }, + "counter": { + "packets": 0, + "bytes": 0 } } },
@@ -51,6 +55,10 @@ "rate": 1, "burst": 5, "per": "second" + }, + "counter": { + "packets": 0, + "bytes": 0 } } },
@@ -61,6 +69,10 @@ "rate": 1, "burst": 5, "per": "second" + }, + "counter": { + "packets": 0, + "bytes": 0 } } }
tests/shell/testcases/sets/dumps/0060set_multistmt_1.json-nft +14 -0
@@ -44,6 +44,10 @@ "counter": { "packets": 0, "bytes": 0 + }, + "quota": { + "val": 500, + "val_unit": "bytes" } } },
@@ -53,6 +57,12 @@ "counter": { "packets": 9, "bytes": 756 + }, + "quota": { + "val": 500, + "val_unit": "bytes", + "used": 500, + "used_unit": "bytes" } } },
@@ -62,6 +72,10 @@ "counter": { "packets": 0, "bytes": 0 + }, + "quota": { + "val": 1000, + "val_unit": "bytes" } } }
Signature · 1 line
2.47.3