Skip to content

wireguard: netlink: ynl conversion

Asbjørn Sloth Tønnesen lkml netdev wireguard 4 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest10 patches 1 replyIn review
  2. v311 patches 37 repliesSuperseded
  3. v211 patches 2 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v111 patches1 replySuperseded

Changes in v4 from the cover letter

- Thanks Jason and Jakub for all the feedback.
- Old patch 03 has been accepted into Jason's tree.
- Old patch 09 split_ops conversion has been moved to new 03.
- Old patch 10 function renaming was merged into old patch 11 (new 10).
- Patch 04 has been added to adjust .maxattr for GET_DEVICE.
- The old patches 04-08 and 11 was renumbered to patch 05-10.
- Changes to the spec:
- Re-wrap the documentation lines in the spec.
- Reword the index/type documentation.
- get-device now have a more strict request attribute list.
- The pre/post functions now avoids renaming.
- Changes to patch 10 (was 10+11):
- The generated kernel code now uses YNL-ARG --function-prefix, to reduce the function renaming.
- The generated files have been moved to their own sub-directory.
- The commit messages have in general been tweaked a bit.

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/10wireguard: netlink: validate nested arrays in policydrivers/net/wireguard/netlink.c+6 -40 replies
2/10wireguard: netlink: use WG_KEY_LEN in policiesdrivers/net/wireguard/netlink.c+7 -40 replies
3/10wireguard: netlink: convert to split opsdrivers/net/wireguard/netlink.c+9 -70 replies
4/10wireguard: netlink: lower .maxattr for WG_CMD_GET_DEVICEdrivers/net/wireguard/netlink.c+1 -10 replies
5/10netlink: specs: add specification for wireguardDocumentation/netlink/specs/wireguard.yaml MAINTAINERS include/uapi/linux/wireguard.h+299 -1290 replies
6/10wireguard: uapi: move enum wg_cmdinclude/uapi/linux/wireguard.h+8 -70 replies
7/10wireguard: uapi: move flag enumsinclude/uapi/linux/wireguard.h+14 -110 replies
8/10wireguard: uapi: generate header with ynl-gendrivers/net/wireguard/netlink.c include/uapi/linux/wireguard.h+22 -220 replies
9/10tools: ynl: add sample for wireguardMAINTAINERS tools/net/ynl/Makefile.deps tools/net/ynl/samples/.gitignore +1 more+108 -00 replies
10/10wireguard: netlink: generate netlink codedrivers/net/wireguard/Makefile drivers/net/wireguard/generated/netlink.c drivers/net/wireguard/generated/netlink.h +1 more+109 -560 replies

Reviews trailers per patch

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

Read the v4 thread

Cover letter [PATCH wireguard v4 00/10] wireguard: netlink: ynl conversion

This series completes the implementation of YNL for WireGuard, as previously announced[1].

This series consist of 5 parts:
1) Patch 01-04 - Misc. changes
2) Patch 05 - Add YNL specification for wireguard
3) Patch 06-08 - Transition to a generated UAPI header
4) Patch 09 - Adds a sample program for the generated C library
5) Patch 10 - Transition to generated netlink policy code

The main benefit of having a YNL specification is unlocked after the first 2 parts, the RFC version seems to already have spawned a new Rust netlink binding[2] using wireguard as it's main example.

Part 3 and 5 validates that the specification is complete and aligned, the generated code might have a few warts, but they don't matter too much, and are mostly a transitional problem[3].

Part 4 is possible after part 2, but is ordered after part 3, as it would otherwise have to update the header guard in Makefile.deps.

For the UAPI and non-generated kernel C code the diff stat looks like this:

$ git diff --stat wg-devel..wg-ynl include/ drivers/ \
	':(exclude)*generated/*'
 drivers/net/wireguard/Makefile  |   2 +-
 drivers/net/wireguard/netlink.c |  67 +++---------
 include/uapi/linux/wireguard.h  | 191 ++++++--------------------------
 3 files changed, 46 insertions(+), 214 deletions(-)

[1] [PATCH net 0/4] tools: ynl-gen: misc fixes + wireguard ynl plan

    https://lore.kernel.org/r/[email protected]/

[2] https://github.com/one-d-wide/netlink-bindings/
[3] https://lore.kernel.org/r/[email protected]/

---
v4:
- Thanks Jason and Jakub for all the feedback.
- Old patch 03 has been accepted into Jason's tree.
- Old patch 09 split_ops conversion has been moved to new 03.
- Old patch 10 function renaming was merged into old patch 11 (new 10).
- Patch 04 has been added to adjust .maxattr for GET_DEVICE.
- The old patches 04-08 and 11 was renumbered to patch 05-10.
- Changes to the spec:
- Re-wrap the documentation lines in the spec.
- Reword the index/type documentation.
- get-device now have a more strict request attribute list.
- The pre/post functions now avoids renaming.
- Changes to patch 10 (was 10+11):
- The generated kernel code now uses YNL-ARG --function-prefix, to reduce the function renaming.
- The generated files have been moved to their own sub-directory.
- The commit messages have in general been tweaked a bit.

v3: https://lore.kernel.org/r/[email protected]/
- Spec: Make flags-mask checks implicit (thanks Jakub).
- Sample: Add header to Makefile.deps, and avoid copy (thanks Jakub).

v2: https://lore.kernel.org/r/[email protected]/
- Add missing forward declaration

v1: https://lore.kernel.org/r/[email protected]/
- Policy arguement to nla_parse_nested() changed to NULL (thanks Johannes).
- Added attr-cnt-name to the spec, to reduce the diff a bit.
- Refined the doc in the spec a bit.
- Reword commit messages a bit.
- Reordered the patches, and reduced the series from 14 to 11 patches.

RFC: https://lore.kernel.org/r/[email protected]/

Asbjørn Sloth Tønnesen (10):
wireguard: netlink: validate nested arrays in policy
wireguard: netlink: use WG_KEY_LEN in policies
wireguard: netlink: convert to split ops
wireguard: netlink: lower .maxattr for WG_CMD_GET_DEVICE
netlink: specs: add specification for wireguard
wireguard: uapi: move enum wg_cmd
wireguard: uapi: move flag enums
wireguard: uapi: generate header with ynl-gen
tools: ynl: add sample for wireguard
wireguard: netlink: generate netlink code

 Documentation/netlink/specs/wireguard.yaml | 298 +++++++++++++++++++++
 MAINTAINERS                                |   2 +
 drivers/net/wireguard/Makefile             |   2 +-
 drivers/net/wireguard/generated/netlink.c  |  73 +++++
 drivers/net/wireguard/generated/netlink.h  |  30 +++
 drivers/net/wireguard/netlink.c            |  67 +----
 include/uapi/linux/wireguard.h             | 191 +++----------
 tools/net/ynl/Makefile.deps                |   2 +
 tools/net/ynl/samples/.gitignore           |   1 +
 tools/net/ynl/samples/wireguard.c          | 104 +++++++
 10 files changed, 556 insertions(+), 214 deletions(-)
 create mode 100644 Documentation/netlink/specs/wireguard.yaml
 create mode 100644 drivers/net/wireguard/generated/netlink.c
 create mode 100644 drivers/net/wireguard/generated/netlink.h
 create mode 100644 tools/net/ynl/samples/wireguard.c
Signature · 1 line
2.51.0