summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2017-05-31 05:01:07 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2017-05-31 14:23:13 +0200
commit4061a818b2af5a4522eedf46b4e756e1a785f79c (patch)
tree60be4f25805303c0e00bb45941a9c7e381dfbd74 /src
parentc37516456eeca6404f2d61d16561101f84f8e790 (diff)
timers: the completion of a handshake also is on key confirmation
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'src')
-rw-r--r--src/receive.c1
-rw-r--r--src/timers.c4
2 files changed, 3 insertions, 2 deletions
diff --git a/src/receive.c b/src/receive.c
index fb057aa..6051c2c 100644
--- a/src/receive.c
+++ b/src/receive.c
@@ -216,6 +216,7 @@ void packet_consume_data_done(struct sk_buff *skb, struct wireguard_peer *peer,
if (unlikely(used_new_key)) {
peer->sent_lastminute_handshake = false;
packet_send_queue(peer);
+ timers_handshake_complete(peer);
}
keep_key_fresh(peer);
diff --git a/src/timers.c b/src/timers.c
index a8cd537..209fe5a 100644
--- a/src/timers.c
+++ b/src/timers.c
@@ -130,12 +130,13 @@ void timers_handshake_initiated(struct wireguard_peer *peer)
}
}
-/* Should be called after a handshake response message is received and processed. */
+/* Should be called after a handshake response message is received and processed or when getting key confirmation via the first data message. */
void timers_handshake_complete(struct wireguard_peer *peer)
{
if (likely(peer->timers_enabled))
del_timer(&peer->timer_retransmit_handshake);
peer->timer_handshake_attempts = 0;
+ do_gettimeofday(&peer->walltime_last_handshake);
}
/* Should be called after an ephemeral key is created, which is before sending a handshake response or after receiving a handshake response. */
@@ -143,7 +144,6 @@ void timers_ephemeral_key_created(struct wireguard_peer *peer)
{
if (likely(peer->timers_enabled))
mod_timer(&peer->timer_kill_ephemerals, jiffies + (REJECT_AFTER_TIME * 3));
- do_gettimeofday(&peer->walltime_last_handshake);
}
/* Should be called before a packet with authentication -- data, keepalive, either handshake -- is sent, or after one is received. */