Linux Netfilter development
 help / color / mirror / Atom feed
From: Alexandre Knecht <knecht.alexandre@gmail.com>
To: netfilter-devel@vger.kernel.org
Cc: phil@nwl.cc, fw@strlen.de, Alexandre Knecht <knecht.alexandre@gmail.com>
Subject: [PATCH v6 0/3] parser_json: support handle for rule positioning
Date: Tue, 20 Jan 2026 20:53:00 +0100	[thread overview]
Message-ID: <20260120195303.1987192-1-knecht.alexandre@gmail.com> (raw)

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

-- 
2.51.1


             reply	other threads:[~2026-01-20 19:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-20 19:53 Alexandre Knecht [this message]
2026-01-20 19:53 ` [PATCH v6 1/3] parser_json: support handle for rule positioning in explicit JSON format Alexandre Knecht
2026-01-20 19:53 ` [PATCH v6 2/3] tests: shell: add JSON test for all object types Alexandre Knecht
2026-01-20 19:53 ` [PATCH v6 3/3] tests: shell: add JSON test for handle-based rule positioning Alexandre Knecht
2026-01-20 22:55 ` [PATCH v6 0/3] parser_json: support handle for " Phil Sutter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260120195303.1987192-1-knecht.alexandre@gmail.com \
    --to=knecht.alexandre@gmail.com \
    --cc=fw@strlen.de \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=phil@nwl.cc \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox