ipc: uniformly ignore preshared keys that are zero
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
parent
f51349c52b
commit
4e4867dc95
|
@ -136,6 +136,7 @@ static int kernel_get_device(struct wgdevice **device, const char *ifname)
|
||||||
binary = nvlist_get_binary(nvl_peers[i], "preshared-key", &size);
|
binary = nvlist_get_binary(nvl_peers[i], "preshared-key", &size);
|
||||||
if (binary && size == sizeof(peer->preshared_key)) {
|
if (binary && size == sizeof(peer->preshared_key)) {
|
||||||
memcpy(peer->preshared_key, binary, sizeof(peer->preshared_key));
|
memcpy(peer->preshared_key, binary, sizeof(peer->preshared_key));
|
||||||
|
if (!key_is_zero(peer->preshared_key))
|
||||||
peer->flags |= WGPEER_HAS_PRESHARED_KEY;
|
peer->flags |= WGPEER_HAS_PRESHARED_KEY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -129,6 +129,7 @@ static int kernel_get_device(struct wgdevice **device, const char *iface)
|
||||||
|
|
||||||
if (wg_peer->p_flags & WG_PEER_HAS_PSK) {
|
if (wg_peer->p_flags & WG_PEER_HAS_PSK) {
|
||||||
memcpy(peer->preshared_key, wg_peer->p_psk, sizeof(peer->preshared_key));
|
memcpy(peer->preshared_key, wg_peer->p_psk, sizeof(peer->preshared_key));
|
||||||
|
if (!key_is_zero(peer->preshared_key))
|
||||||
peer->flags |= WGPEER_HAS_PRESHARED_KEY;
|
peer->flags |= WGPEER_HAS_PRESHARED_KEY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue