parser_json: fix up transaction ordering
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest5 patches 5 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/5 | parser_json: move some code aroundsrc/ | +22 | 0 replies | |
| 2/5 | parser_json: move list_add into json_parse_cmdsrc/ | +18 | 5 replies | |
| 3/5 | parser_json: add and use CMD_ERR helperssrc/ | +73 | 0 replies | |
| 4/5 | parser_json: defer command allocation to nft_cmd_expandsrc/ | +123 | 0 replies | |
| 5/5 | tests: shell: add more json-nft dumpstests/ tests/ tests/ +4 more | +1282 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH nft 0/5] parser_json: fix up transaction ordering
The existing parser cannot handle certain inputs. Example:
"map": {
"table": "test",
[..]
"map": "verdict",
"elem": [ [ "*", {
"jump": {
"target": "testchain"
[..]
},
{
"chain": {
"family": "ip",
"table": "test",
"name": "testchain",
...This will fail to load because the generated transaction adds the element containing the jump to 'testchain' before the 'add chain'.
The normal (bison) parser does not have this issue, elements get added to the map, the map is added to the table.
Then, *after* parsing, the 'add chain' and 'add element' commands are generated via command expansion.
Change the json parser to do the same and avoid cmd_alloc where possible.
Patch 4 is the main change, patch 5 adds test cases that did not work before.
json parser still cannot handle several existing tests due to lack of 'typeof' support (dump would contain base types like 'integer' which are rejected as they lack the needed key length information).
Florian Westphal (5):
parser_json: move some code around
parser_json: move list_add into json_parse_cmd
parser_json: add and use CMD_ERR helpers
parser_json: defer command allocation to nft_cmd_expand
tests: shell: add more json-nft dumps
src/parser_json.c | 331 ++++++++--- .../dumps/0011endless_jump_loop_1.json-nft | 75 +++ .../testcases/maps/dumps/0011vmap_0.json-nft | 145 +++++ .../dumps/map_catchall_double_free_2.json-nft | 46 ++ .../maps/dumps/vmap_mark_bitwise_0.json-nft | 158 +++++ .../maps/dumps/vmap_timeout.json-nft | 229 ++++++++ .../dumps/0008create_verdict_map_0.json-nft | 78 +++ .../sets/dumps/sets_with_ifnames.json-nft | 551 ++++++++++++++++++ 8 files changed, 1516 insertions(+), 97 deletions(-) create mode 100644 tests/shell/testcases/chains/dumps/0011endless_jump_loop_1.json-nft create mode 100644 tests/shell/testcases/maps/dumps/0011vmap_0.json-nft create mode 100644 tests/shell/testcases/maps/dumps/map_catchall_double_free_2.json-nft create mode 100644 tests/shell/testcases/maps/dumps/vmap_mark_bitwise_0.json-nft create mode 100644 tests/shell/testcases/maps/dumps/vmap_timeout.json-nft create mode 100644 tests/shell/testcases/sets/dumps/0008create_verdict_map_0.json-nft create mode 100644 tests/shell/testcases/sets/dumps/sets_with_ifnames.json-nft
Signature · 1 line
2.43.0