diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2017-08-04 19:46:14 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2017-08-04 20:29:48 +0200 |
commit | e6165820f4f87da7f1b25aa105ccce5d00c623eb (patch) | |
tree | 9141e69f2d5610ffefa6392305ec06c789b05cb8 | |
parent | c168c2aca158b379258a787304879cc634f47234 (diff) |
receive: move lastminute guard into timer event
Suggested-by: Mathias Hall-Andersen <mathias@hall-andersen.dk>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-rw-r--r-- | src/receive.c | 4 | ||||
-rw-r--r-- | src/timers.c | 1 |
2 files changed, 2 insertions, 3 deletions
diff --git a/src/receive.c b/src/receive.c index 59d2630..67ad584 100644 --- a/src/receive.c +++ b/src/receive.c @@ -124,7 +124,6 @@ static void receive_handshake_packet(struct wireguard_device *wg, struct sk_buff if (noise_handshake_begin_session(&peer->handshake, &peer->keypairs, true)) { timers_ephemeral_key_created(peer); timers_handshake_complete(peer); - peer->sent_lastminute_handshake = false; /* Calling this function will either send any existing packets in the queue * and not send a keepalive, which is the best case, Or, if there's nothing * in the queue, it will send a keepalive, in order to give immediate @@ -187,9 +186,8 @@ void packet_consume_data_done(struct sk_buff *skb, struct wireguard_peer *peer, socket_set_peer_endpoint(peer, endpoint); if (unlikely(used_new_key)) { - peer->sent_lastminute_handshake = false; - packet_send_queue(peer); timers_handshake_complete(peer); + packet_send_queue(peer); } keep_key_fresh(peer); diff --git a/src/timers.c b/src/timers.c index 9a7b593..9dc4ae0 100644 --- a/src/timers.c +++ b/src/timers.c @@ -136,6 +136,7 @@ void timers_handshake_complete(struct wireguard_peer *peer) if (likely(peer->timers_enabled)) del_timer(&peer->timer_retransmit_handshake); peer->timer_handshake_attempts = 0; + peer->sent_lastminute_handshake = false; do_gettimeofday(&peer->walltime_last_handshake); } |