summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikael Magnusson <mikma@users.sourceforge.net>2020-05-13 17:34:23 +0200
committerMikael Magnusson <mikma@users.sourceforge.net>2021-11-06 00:07:40 +0100
commitc6752ba1ea511a51d1f4274854b84676d6f43f50 (patch)
treec512b0ee34e12368bba371460e0b32c4b7ec9f25
parentce0584d203553de2018c94ac1fb38bff9035057c (diff)
Wg-user: Work-around listen_port mutex dead lock
Problem with listen_port dead lock in wireguard-go.
-rw-r--r--sysdep/unix/wg_user.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sysdep/unix/wg_user.c b/sysdep/unix/wg_user.c
index a3a1067f..e7144d20 100644
--- a/sysdep/unix/wg_user.c
+++ b/sysdep/unix/wg_user.c
@@ -212,8 +212,13 @@ static int
user_put_device(wg_device *dev, byte **buf, uint *size)
{
wg_put_u16("set", 1, buf, size);
- wg_put_key("private_key", dev->private_key, buf, size);
- wg_put_u16("listen_port", dev->listen_port, buf, size);
+ if (dev->flags & WGDEVICE_HAS_PRIVATE_KEY)
+ wg_put_key("private_key", dev->private_key, buf, size);
+#if 0
+ /* Setting listen_port causes dead-lock in wireguard-go. */
+ if (dev->flags & WGDEVICE_HAS_LISTEN_PORT)
+ wg_put_u16("listen_port", dev->listen_port, buf, size);
+#endif
wg_put_bool("replace_peers", dev->flags & WGDEVICE_REPLACE_PEERS, buf, size);
wg_peer *peer = NULL;