summaryrefslogtreecommitdiffhomepage
path: root/src/socket.c
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2016-12-09 18:18:55 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2016-12-09 21:31:12 +0100
commiteb2513fdaa0f9b589e5b525cdf973b4751d91fe6 (patch)
tree00c76af7453dac7a9a40c57859f1dd8631d7771f /src/socket.c
parentcf167e019d88cd0e78858b8cf2cc6c8c32435594 (diff)
socket: clear src address when retrying handshake
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'src/socket.c')
-rw-r--r--src/socket.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/socket.c b/src/socket.c
index 0b97818..8506075 100644
--- a/src/socket.c
+++ b/src/socket.c
@@ -255,6 +255,14 @@ out:
read_unlock_bh(&peer->endpoint_lock);
}
+void socket_clear_peer_endpoint_src(struct wireguard_peer *peer)
+{
+ write_lock_bh(&peer->endpoint_lock);
+ memset(&peer->endpoint.src6, 0, sizeof(peer->endpoint.src6));
+ dst_cache_reset(&peer->endpoint_cache);
+ write_unlock_bh(&peer->endpoint_lock);
+}
+
static int receive(struct sock *sk, struct sk_buff *skb)
{
struct wireguard_device *wg;