From 032d0526c9b52d1391fc14fa532ef5162e4c1822 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Thu, 10 Nov 2016 23:28:35 +0100 Subject: socket: keep track of src address in sending packets Signed-off-by: Jason A. Donenfeld --- src/peer.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/peer.h') diff --git a/src/peer.h b/src/peer.h index 895eb77..07c4d16 100644 --- a/src/peer.h +++ b/src/peer.h @@ -16,9 +16,21 @@ struct wireguard_device; +struct endpoint { + union { + struct sockaddr_storage addr_storage; + struct sockaddr_in addr4; + struct sockaddr_in6 addr6; + }; + union { + struct in_addr src4; + struct in6_addr src6; + }; +}; + struct wireguard_peer { struct wireguard_device *device; - struct sockaddr_storage endpoint_addr; + struct endpoint endpoint; struct dst_cache endpoint_cache; rwlock_t endpoint_lock; struct noise_handshake handshake; -- cgit v1.2.3