aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2017-08-04 21:12:26 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2017-08-05 14:47:59 +0200
commitcd9534dae19f54710987aa848db3ca2a2e08c3d7 (patch)
tree71f6473c427650e9cd0ba96f5efee01c3309bc17 /src
parentnoise: infer initiator or not from handshake state (diff)
downloadwireguard-monolithic-historical-cd9534dae19f54710987aa848db3ca2a2e08c3d7.tar.xz
wireguard-monolithic-historical-cd9534dae19f54710987aa848db3ca2a2e08c3d7.zip
timers: do not send out double keepalive
It's possible that a persistent keepalive that comes before a normal keepalive will not invalidate the normal keepalive, and then we'll needlessly send two keepalives.
Diffstat (limited to 'src')
-rw-r--r--src/timers.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/timers.c b/src/timers.c
index d515265..ca34e7d 100644
--- a/src/timers.c
+++ b/src/timers.c
@@ -90,8 +90,11 @@ static void queued_expired_zero_key_material(struct work_struct *work)
static void expired_send_persistent_keepalive(unsigned long ptr)
{
peer_get_from_ptr(ptr);
- if (likely(peer->persistent_keepalive_interval))
+ if (likely(peer->persistent_keepalive_interval)) {
+ if (likely(peer->timers_enabled))
+ del_timer(&peer->timer_send_keepalive);
packet_send_keepalive(peer);
+ }
peer_put(peer);
}