wg: stricter userspace ipc parsing
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
parent
1019175179
commit
bc9494f8b6
|
@ -314,13 +314,13 @@ static int userspace_get_device(struct wgdevice **out, const char *interface)
|
||||||
break;
|
break;
|
||||||
*value++ = key[--line_len] = '\0';
|
*value++ = key[--line_len] = '\0';
|
||||||
|
|
||||||
if (!strcmp(key, "private_key")) {
|
if (!peer && !strcmp(key, "private_key")) {
|
||||||
if (!key_from_hex(dev->private_key, value))
|
if (!key_from_hex(dev->private_key, value))
|
||||||
break;
|
break;
|
||||||
curve25519_generate_public(dev->public_key, dev->private_key);
|
curve25519_generate_public(dev->public_key, dev->private_key);
|
||||||
} else if (!strcmp(key, "listen_port"))
|
} else if (!peer && !strcmp(key, "listen_port"))
|
||||||
dev->port = NUM(0xffffU);
|
dev->port = NUM(0xffffU);
|
||||||
else if (!strcmp(key, "fwmark"))
|
else if (!peer && !strcmp(key, "fwmark"))
|
||||||
dev->fwmark = NUM(0xffffffffU);
|
dev->fwmark = NUM(0xffffffffU);
|
||||||
else if (!strcmp(key, "public_key")) {
|
else if (!strcmp(key, "public_key")) {
|
||||||
peer = ADD(sizeof(struct wgpeer));
|
peer = ADD(sizeof(struct wgpeer));
|
||||||
|
|
Loading…
Reference in New Issue