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
commita24f287e031ba40d0b097e12117e829d5bfef443 (patch)
tree346e34539ae343e123c73450e0cf7fc04c33c1f0 /src/timers.c
parenttimers: avoid thundering herd for simultaneous initiation (diff)
downloadwireguard-linux-compat-a24f287e031ba40d0b097e12117e829d5bfef443.tar.xz
wireguard-linux-compat-a24f287e031ba40d0b097e12117e829d5bfef443.zip
timers: kill half-open handshakes after a while
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
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);