Skip to content

netlink: Add nftables spec w/ multi messages

Donald Hunter netdev netfilter-devel 4 versions – Applied

Status from this message: This series was applied to netdev/net-next.git (main)

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest4 patches 9 repliesApplied 4/4
  2. v34 patches 3 repliesSuperseded
  3. v23 patches 4 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v12 patches9 repliesSuperseded

Changes in v4 from the cover letter

- fix the underlying extack decoding bug and drop the workaround patch

Patches in v4 All 4 applied

#Subject and filesSizeRepliesApplied
1/4doc/netlink/specs: Add draft nftables specDocumentation/netlink/specs/nftables.yaml+1264 -00 repliesApplied
2/4tools/net/ynl: Fix extack decoding for directional opstools/net/ynl/lib/ynl.py+6 -80 repliesApplied
3/4tools/net/ynl: Add multi message support to ynltools/net/ynl/cli.py tools/net/ynl/lib/ynl.py+71 -220 repliesApplied
4/4netfilter: nfnetlink: Handle ACK flags for batch messagesnet/netfilter/nfnetlink.c+5 -09 repliesApplied

Reviews trailers per patch

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

Read the v4 thread

Cover letter [PATCH net-next v4 0/4] netlink: Add nftables spec w/ multi messages

This series adds a ynl spec for nftables and extends ynl with a --multi command line option that makes it possible to send transactional batches for nftables.

This series includes a patch for nfnetlink which adds ACK processing for batch begin/end messages. If you'd prefer that to be sent separately to nf-next then I can do so, but I included it here so that it gets seen in context.

An example of usage is:

./tools/net/ynl/cli.py \
--spec Documentation/netlink/specs/nftables.yaml \
--multi batch-begin '{"res-id": 10}' \
--multi newtable '{"name": "test", "nfgen-family": 1}' \
--multi newchain '{"name": "chain", "table": "test", "nfgen-family": 1}' \
--multi batch-end '{"res-id": 10}'
[None, None, None, None]

It can also be used for bundling get requests:

./tools/net/ynl/cli.py \
--spec Documentation/netlink/specs/nftables.yaml \
--multi gettable '{"name": "test", "nfgen-family": 1}' \
--multi getchain '{"name": "chain", "table": "test", "nfgen-family": 1}' \
--output-json
[{"name": "test", "use": 1, "handle": 1, "flags": [],
"nfgen-family": 1, "version": 0, "res-id": 2},
{"table": "test", "name": "chain", "handle": 1, "use": 0, "nfgen-family": 1, "version": 0, "res-id": 2}]

There are 2 issues that may be worth resolving:

- ynl reports errors by raising an NlError exception so only the first error gets reported. This could be changed to add errors to the list of responses so that multiple errors could be reported.

- If any message does not get a response (e.g. batch-begin w/o patch 2) then ynl waits indefinitely. A recv timeout could be added which would allow ynl to terminate.

v3 -> v4:
- fix the underlying extack decoding bug and drop the workaround patch

v2 -> v3:
- update the ynl multi code to match the latest return value semantics of ynl
- add a ynl patch to handle acks that use req_value
- update the nfnetlink patch based on feedback from Pablo
- move nfnetlink patch to end of series

v1 -> v2:
- add a patch to nfnetlink to process ACKs for batch begin/end
- handle multiple responses correctly

Donald Hunter (4):
doc/netlink/specs: Add draft nftables spec tools/net/ynl: Fix extack decoding for directional ops tools/net/ynl: Add multi message support to ynl
netfilter: nfnetlink: Handle ACK flags for batch messages

 Documentation/netlink/specs/nftables.yaml | 1264 +++++++++++++++++++++
 net/netfilter/nfnetlink.c                 |    5 +
 tools/net/ynl/cli.py                      |   25 +-
 tools/net/ynl/lib/ynl.py                  |   82 +-
 4 files changed, 1346 insertions(+), 30 deletions(-)
 create mode 100644 Documentation/netlink/specs/nftables.yaml
Signature · 1 line
2.44.0