Skip to content

Commit a28032f

Browse files
jmberg-intelzx2c4
authored andcommitted
netlink: consistently use NLA_POLICY_MIN_LEN()
Change places that open-code NLA_POLICY_MIN_LEN() to use the macro instead, giving us flexibility in how we handle the details of the macro. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
1 parent 515d544 commit a28032f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/netlink.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ static const struct nla_policy peer_policy[WGPEER_A_MAX + 1] = {
3232
[WGPEER_A_PUBLIC_KEY] = NLA_POLICY_EXACT_LEN(NOISE_PUBLIC_KEY_LEN),
3333
[WGPEER_A_PRESHARED_KEY] = NLA_POLICY_EXACT_LEN(NOISE_SYMMETRIC_KEY_LEN),
3434
[WGPEER_A_FLAGS] = { .type = NLA_U32 },
35-
[WGPEER_A_ENDPOINT] = { .type = NLA_MIN_LEN, .len = sizeof(struct sockaddr) },
35+
[WGPEER_A_ENDPOINT] = NLA_POLICY_MIN_LEN(sizeof(struct sockaddr)),
3636
[WGPEER_A_PERSISTENT_KEEPALIVE_INTERVAL] = { .type = NLA_U16 },
3737
[WGPEER_A_LAST_HANDSHAKE_TIME] = NLA_POLICY_EXACT_LEN(sizeof(struct __kernel_timespec)),
3838
[WGPEER_A_RX_BYTES] = { .type = NLA_U64 },
@@ -43,7 +43,7 @@ static const struct nla_policy peer_policy[WGPEER_A_MAX + 1] = {
4343

4444
static const struct nla_policy allowedip_policy[WGALLOWEDIP_A_MAX + 1] = {
4545
[WGALLOWEDIP_A_FAMILY] = { .type = NLA_U16 },
46-
[WGALLOWEDIP_A_IPADDR] = { .type = NLA_MIN_LEN, .len = sizeof(struct in_addr) },
46+
[WGALLOWEDIP_A_IPADDR] = NLA_POLICY_MIN_LEN(sizeof(struct in_addr)),
4747
[WGALLOWEDIP_A_CIDR_MASK] = { .type = NLA_U8 }
4848
};
4949

0 commit comments

Comments
 (0)