diff options
author | Mikael Magnusson <mikma@users.sourceforge.net> | 2023-11-22 23:26:25 +0100 |
---|---|---|
committer | Mikael Magnusson <mikma@users.sourceforge.net> | 2023-11-22 23:26:32 +0100 |
commit | b920fb734f2b7dffead3610b835c3ceb518b835f (patch) | |
tree | f1caf7dc444de3a07818ea86053856bfc8103523 | |
parent | c029afef4c6bffa9f142fb3e3e29f28a1854b80e (diff) |
Wg-user: conditionally add some keys
Conditionally add replace_peers and replace_allowed_ips.
-rw-r--r-- | sysdep/unix/wg_user.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sysdep/unix/wg_user.c b/sysdep/unix/wg_user.c index 73ca0e20..a929b989 100644 --- a/sysdep/unix/wg_user.c +++ b/sysdep/unix/wg_user.c @@ -225,14 +225,16 @@ user_put_device(wg_device *dev, byte **buf, uint *size) 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); + if (dev->flags & WGDEVICE_REPLACE_PEERS) + wg_put_bool("replace_peers", true, buf, size); wg_peer *peer = NULL; wg_for_each_peer(dev, peer) { wg_put_key("public_key", peer->public_key, buf, size); wg_put_endpoint(&peer->endpoint, buf, size); - wg_put_bool("replace_allowed_ips", peer->flags & WGPEER_REPLACE_ALLOWEDIPS, buf, size); + if (peer->flags & WGPEER_REPLACE_ALLOWEDIPS) + wg_put_bool("replace_allowed_ips", true, buf, size); wg_allowedip *allowedip = NULL; wg_for_each_allowedip(peer, allowedip) |