summaryrefslogtreecommitdiffhomepage
path: root/src/config.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/config.c')
-rw-r--r--src/config.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/config.c b/src/config.c
index a98ecd9..829c0aa 100644
--- a/src/config.c
+++ b/src/config.c
@@ -76,7 +76,7 @@ static int set_peer(struct wireguard_device *wg, void __user *user_peer, size_t
if (netdev_pub(wg)->flags & IFF_UP)
timers_init_peer(peer);
} else
- pr_debug("Peer %Lu (%pISpfsc) modified\n", peer->internal_id, &peer->endpoint_addr);
+ pr_debug("Peer %Lu (%pISpfsc) modified\n", peer->internal_id, &peer->endpoint.addr_storage);
if (in_peer.remove_me) {
peer_put(peer);
@@ -84,8 +84,10 @@ static int set_peer(struct wireguard_device *wg, void __user *user_peer, size_t
return 0;
}
- if (in_peer.endpoint.ss_family == AF_INET || in_peer.endpoint.ss_family == AF_INET6)
- socket_set_peer_addr(peer, &in_peer.endpoint);
+ if (in_peer.endpoint.ss_family == AF_INET || in_peer.endpoint.ss_family == AF_INET6) {
+ struct endpoint endpoint = { .addr_storage = in_peer.endpoint };
+ socket_set_peer_endpoint(peer, &endpoint);
+ }
if (in_peer.replace_ipmasks)
routing_table_remove_by_peer(&wg->peer_routing_table, peer);
@@ -235,7 +237,7 @@ static int populate_peer(struct wireguard_peer *peer, void *ctx)
memcpy(out_peer.public_key, peer->handshake.remote_static, NOISE_PUBLIC_KEY_LEN);
read_lock_bh(&peer->endpoint_lock);
- out_peer.endpoint = peer->endpoint_addr;
+ out_peer.endpoint = peer->endpoint.addr_storage;
read_unlock_bh(&peer->endpoint_lock);
out_peer.last_handshake_time = peer->walltime_last_handshake;
out_peer.tx_bytes = peer->tx_bytes;