]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
wireguard: netlink: use WG_KEY_LEN in policies
authorAsbjørn Sloth Tønnesen <ast@fiberby.net>
Wed, 26 Nov 2025 17:35:34 +0000 (17:35 +0000)
committerJason A. Donenfeld <Jason@zx2c4.com>
Mon, 1 Dec 2025 02:25:09 +0000 (03:25 +0100)
commit9755f9de8fac62ed36f1925d6996daf4060d8839
tree5a36d5546ce1317f72fd2cfae516fe5caa33cc15
parentaea199fa157164ed0824d14dddd6c6fa28e130e4
wireguard: netlink: use WG_KEY_LEN in policies

When converting the netlink policies to YNL, the constants used
in the policy have to be visible to userspace.

As NOISE_*_KEY_LEN isn't visible to userspace, change the policy
to use WG_KEY_LEN, as also documented in the UAPI header:

$ grep WG_KEY_LEN include/uapi/linux/wireguard.h
 *    WGDEVICE_A_PRIVATE_KEY: NLA_EXACT_LEN, len WG_KEY_LEN
 *    WGDEVICE_A_PUBLIC_KEY: NLA_EXACT_LEN, len WG_KEY_LEN
 *            WGPEER_A_PUBLIC_KEY: NLA_EXACT_LEN, len WG_KEY_LEN
 *            WGPEER_A_PRESHARED_KEY: NLA_EXACT_LEN, len WG_KEY_LEN
 [...]

Add a couple of BUILD_BUG_ON() to ensure that they stay in sync.

No behavioural changes intended.

Signed-off-by: Asbjørn Sloth Tønnesen <ast@fiberby.net>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
drivers/net/wireguard/netlink.c