summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2016-10-14 17:44:49 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2016-10-14 17:44:49 +0200
commit28e98b867ba7eae2da1f61d0518a11cc7242faf9 (patch)
tree2f9fd1fb539562cb80b16d972d71918991c57d2a
parentdevice: show debug message when no peer has allowed-ips for packet (diff)
downloadwireguard-monolithic-historical-experimental-0.0.20161014.tar.xz
wireguard-monolithic-historical-experimental-0.0.20161014.zip
send: ensure that rekey retries are staggeredexperimental-0.0.20161014
Before: t+120: A sends rekey [packet dropped by network congestion] t+125: A sends rekey [packet dropped by network congestion] t+130: A sends rekey t+130: B sends rekey ! race ! After: t+120: A sends rekey [packet dropped by network congestion] t+125: A sends rekey [packet dropped by network congestion] t+130: A sends rekey [packet dropped by network congestion] T+132.5: B sends rekey [packet dropped by network congestion] T+135: A sends rekey [packet dropped by network congestion] T+137.5: B sends rekey ! success, eventually !
-rw-r--r--src/send.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/send.c b/src/send.c
index c8df288..cbff73d 100644
--- a/src/send.c
+++ b/src/send.c
@@ -101,7 +101,7 @@ static inline void keep_key_fresh(struct wireguard_peer *peer)
/* We don't want both peers initiating a new handshake at the same time */
if (!keypair->i_am_the_initiator)
- rekey_after_time += REKEY_TIMEOUT * 2;
+ rekey_after_time += REKEY_TIMEOUT / 2 + REKEY_TIMEOUT * 2;
if (atomic64_read(&keypair->sending.counter.counter) > REKEY_AFTER_MESSAGES ||
time_is_before_eq_jiffies64(keypair->sending.birthdate + rekey_after_time)) {