aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/timers.c
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2016-10-19 09:29:25 +0900
committerJason A. Donenfeld <Jason@zx2c4.com>2016-10-19 17:21:49 +0900
commit5a17573c776e5c4868177eceeaa4c794e0240502 (patch)
tree38982fbd15a5c2e2e57086117cfaa6026d464ac9 /src/timers.c
parenttimers: avoid thundering herd for simultaneous initiation (diff)
downloadwireguard-monolithic-historical-5a17573c776e5c4868177eceeaa4c794e0240502.tar.xz
wireguard-monolithic-historical-5a17573c776e5c4868177eceeaa4c794e0240502.zip
timers: kill half-open handshakes after a while
Diffstat (limited to 'src/timers.c')
-rw-r--r--src/timers.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/timers.c b/src/timers.c
index c37b294..f85054b 100644
--- a/src/timers.c
+++ b/src/timers.c
@@ -34,6 +34,10 @@ static void expired_retransmit_handshake(unsigned long ptr)
/* We remove all existing packets and don't try again,
* if we try unsuccessfully for too long to make a handshake. */
skb_queue_purge(&peer->tx_packet_queue);
+ /* We set a timer for destroying any residue that might be left
+ * of a partial exchange. */
+ if (likely(peer->timer_kill_ephemerals.data))
+ mod_timer(&peer->timer_kill_ephemerals, jiffies + (REJECT_AFTER_TIME * 3));
return;
}
packet_queue_send_handshake_initiation(peer);