a859e7c72b2655e300ee3e100b729a1e1249b94b
[openwrt/staging/neocturne.git] /
1 From 2c778b2cd59a12f0dcba236e6441a318d1c6486c Mon Sep 17 00:00:00 2001
2 From: Johannes Berg <johannes.berg@intel.com>
3 Date: Tue, 18 Aug 2020 10:17:32 +0200
4 Subject: [PATCH 114/124] netlink: consistently use NLA_POLICY_MIN_LEN()
5
6 commit bc0435855041d7fff0b83dd992fc4be34aa11afb upstream.
7
8 Change places that open-code NLA_POLICY_MIN_LEN() to
9 use the macro instead, giving us flexibility in how we
10 handle the details of the macro.
11
12 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
13 Signed-off-by: David S. Miller <davem@davemloft.net>
14 [Jason: only picked the drivers/net/wireguard/* part]
15 Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
16 ---
17 drivers/net/wireguard/netlink.c | 4 ++--
18 1 file changed, 2 insertions(+), 2 deletions(-)
19
20 --- a/drivers/net/wireguard/netlink.c
21 +++ b/drivers/net/wireguard/netlink.c
22 @@ -34,7 +34,7 @@ static const struct nla_policy peer_poli
23 [WGPEER_A_PUBLIC_KEY] = NLA_POLICY_EXACT_LEN(NOISE_PUBLIC_KEY_LEN),
24 [WGPEER_A_PRESHARED_KEY] = NLA_POLICY_EXACT_LEN(NOISE_SYMMETRIC_KEY_LEN),
25 [WGPEER_A_FLAGS] = { .type = NLA_U32 },
26 - [WGPEER_A_ENDPOINT] = { .type = NLA_MIN_LEN, .len = sizeof(struct sockaddr) },
27 + [WGPEER_A_ENDPOINT] = NLA_POLICY_MIN_LEN(sizeof(struct sockaddr)),
28 [WGPEER_A_PERSISTENT_KEEPALIVE_INTERVAL] = { .type = NLA_U16 },
29 [WGPEER_A_LAST_HANDSHAKE_TIME] = NLA_POLICY_EXACT_LEN(sizeof(struct __kernel_timespec)),
30 [WGPEER_A_RX_BYTES] = { .type = NLA_U64 },
31 @@ -45,7 +45,7 @@ static const struct nla_policy peer_poli
32
33 static const struct nla_policy allowedip_policy[WGALLOWEDIP_A_MAX + 1] = {
34 [WGALLOWEDIP_A_FAMILY] = { .type = NLA_U16 },
35 - [WGALLOWEDIP_A_IPADDR] = { .type = NLA_MIN_LEN, .len = sizeof(struct in_addr) },
36 + [WGALLOWEDIP_A_IPADDR] = NLA_POLICY_MIN_LEN(sizeof(struct in_addr)),
37 [WGALLOWEDIP_A_CIDR_MASK] = { .type = NLA_U8 }
38 };
39