aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/peer.h
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-08-04 02:50:51 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2018-08-04 05:14:15 +0200
commitb003c4e93d6e1ce0cae32901dc7b5d425453800d (patch)
tree1e6cdf7cd6e3cfdadf6cc86e58997e821d64bd1c /src/peer.h
parentversion: bump snapshot (diff)
downloadwireguard-monolithic-historical-b003c4e93d6e1ce0cae32901dc7b5d425453800d.tar.xz
wireguard-monolithic-historical-b003c4e93d6e1ce0cae32901dc7b5d425453800d.zip
send: switch handshake stamp to an atomic
Rather than abusing the handshake lock, we're much better off just using a boring atomic64 for this. It's simpler and performs better. Also, while we're at it, we set the handshake stamp both before and after the calculations, in case the calculations block for a really long time waiting for the RNG to initialize. Otherwise it's possible that when the RNG finally initializes, two handshakes are sent back to back, which isn't sensible.
Diffstat (limited to '')
-rw-r--r--src/peer.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/peer.h b/src/peer.h
index 8daa053..29d2e00 100644
--- a/src/peer.h
+++ b/src/peer.h
@@ -43,7 +43,7 @@ struct wireguard_peer {
struct dst_cache endpoint_cache;
rwlock_t endpoint_lock;
struct noise_handshake handshake;
- u64 last_sent_handshake;
+ atomic64_t last_sent_handshake;
struct work_struct transmit_handshake_work, clear_peer_work;
struct cookie latest_cookie;
struct hlist_node pubkey_hash;