Skip to content

parser_json: support handle for rule positioning

Alexandre Knecht netfilter-devel 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v6 Latest3 patches 1 replyIn review
  2. v53 patches 5 repliesSuperseded
  3. v41 patch 6 repliesSuperseded

Changes in v6 from the cover letter

- Merged nested if-conditionals, sorted expressions cheap to expensive (Phil feedback)
- Use Reverse Christmas Tree notation for variable declarations (Phil feedback)
- Test 0007: Use $DIFF to verify ruleset state after ADD operations instead of just checking command success (Phil feedback)

Patches in v6 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3parser_json: support handle for rule positioning in explicit JSON formatsrc/parser_json.c+33 -30 replies
2/3tests: shell: add JSON test for all object typestests/shell/testcases/json/0007add_insert_delete_objects_0 tests/shell/testcases/json/dumps/0007add_insert_delete_objects_0.json-nft tests/shell/testcases/json/dumps/0007add_insert_delete_objects_0.nft+183 -00 replies
3/3tests: shell: add JSON test for handle-based rule positioningtests/shell/testcases/json/0008rule_position_handle_0 tests/shell/testcases/json/dumps/0008rule_position_handle_0.json-nft tests/shell/testcases/json/dumps/0008rule_position_handle_0.nft+244 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v6 yet.

Read the v6 thread

Cover letter [PATCH v6 0/3] parser_json: support handle for rule positioning

This patch series enables handle-based rule positioning for JSON add/insert commands.

Changes since v5:
- Merged nested if-conditionals, sorted expressions cheap to expensive (Phil feedback)
- Use Reverse Christmas Tree notation for variable declarations (Phil feedback)
- Test 0007: Use $DIFF to verify ruleset state after ADD operations instead of just checking command success (Phil feedback)

Changes since v4:
- CTX_F_EXPR_MASK now uses inverse mask (UINT32_MAX & ~(...)) as suggested by Phil, for future-proof expression flag filtering
- Removed nested block in json_parse_cmd(), variables declared at function start per project style (Phil/Florian feedback)
- Test 0007: Removed redundant insert position check (covered by 0008), replaced grep|grep|awk with single sed call
- Test 0008: Added test for insert without handle, added test for multiple commands in single transaction, fixed error message typo
- Added .json-nft dump files for both tests

All JSON tests pass. check-tree.sh shows no new errors.

Alexandre Knecht (3):
parser_json: support handle for rule positioning in explicit JSON
format
tests: shell: add JSON test for all object types
tests: shell: add JSON test for handle-based rule positioning

 src/parser_json.c                             |  36 +++-
 .../json/0007add_insert_delete_objects_0      | 163 ++++++++++++++++++
 .../testcases/json/0008rule_position_handle_0 | 162 +++++++++++++++++
 .../0007add_insert_delete_objects_0.json-nft  |  18 ++
 .../dumps/0007add_insert_delete_objects_0.nft |   2 +
 .../dumps/0008rule_position_handle_0.json-nft |  76 ++++++++
 .../json/dumps/0008rule_position_handle_0.nft |   6 +
 7 files changed, 460 insertions(+), 3 deletions(-)
 create mode 100755 tests/shell/testcases/json/0007add_insert_delete_objects_0
 create mode 100755 tests/shell/testcases/json/0008rule_position_handle_0
 create mode 100644 tests/shell/testcases/json/dumps/0007add_insert_delete_objects_0.json-nft
 create mode 100644 tests/shell/testcases/json/dumps/0007add_insert_delete_objects_0.nft
 create mode 100644 tests/shell/testcases/json/dumps/0008rule_position_handle_0.json-nft
 create mode 100644 tests/shell/testcases/json/dumps/0008rule_position_handle_0.nft
Signature · 1 line
2.51.1