summaryrefslogtreecommitdiffhomepage
path: root/src/send.c
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2017-05-31 05:32:36 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2017-05-31 14:23:13 +0200
commitfab890e613df4e8814b78b6548c9d9f60d5909f4 (patch)
tree0e1288bcc6d28f55f11147f7658cef8c8c2156d8 /src/send.c
parent4061a818b2af5a4522eedf46b4e756e1a785f79c (diff)
timers: reset retry-attempt counter when not retrying
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'src/send.c')
-rw-r--r--src/send.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/send.c b/src/send.c
index b45f221..8ff2b11 100644
--- a/src/send.c
+++ b/src/send.c
@@ -44,8 +44,11 @@ void packet_send_queued_handshakes(struct work_struct *work)
peer_put(peer);
}
-void packet_queue_handshake_initiation(struct wireguard_peer *peer)
+void packet_queue_handshake_initiation(struct wireguard_peer *peer, bool is_retry)
{
+ if (!is_retry)
+ peer->timer_handshake_attempts = 0;
+
/* First checking the timestamp here is just an optimization; it will
* be caught while properly locked inside the actual work queue. */
if (!time_is_before_jiffies64(peer->last_sent_handshake + REKEY_TIMEOUT))
@@ -100,7 +103,7 @@ static inline void keep_key_fresh(struct wireguard_peer *peer)
rcu_read_unlock_bh();
if (send)
- packet_queue_handshake_initiation(peer);
+ packet_queue_handshake_initiation(peer, false);
}
void packet_send_keepalive(struct wireguard_peer *peer)
@@ -183,7 +186,7 @@ void packet_send_queue(struct wireguard_peer *peer)
skb_queue_splice(&queue, &peer->tx_packet_queue);
spin_unlock_bh(&peer->tx_packet_queue.lock);
- packet_queue_handshake_initiation(peer);
+ packet_queue_handshake_initiation(peer, false);
break;
default:
/* If we failed for any other reason, we want to just free the packets and