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-23 02:26:51 +0100 |
commit | cc6e0cabb6561b118fee827fedd917c029f13d34 (patch) | |
tree | d0f1fcbe63f753a73a1fd5eb24266eb4b184900f | |
parent | 3e6f2f6c9b18c15f77beb7f15b5f14b29f76af8a (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) |