aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2017-10-11 00:16:24 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2017-10-11 15:50:29 +0200
commit66d52d287094174a2f5edaea84ecccdc54f459b4 (patch)
tree773ef1661c9ff04928ea771ff46512f3fa13b7c7
parentcompat: move version logic to compat.h and out of main .c (diff)
downloadwireguard-monolithic-historical-66d52d287094174a2f5edaea84ecccdc54f459b4.tar.xz
wireguard-monolithic-historical-66d52d287094174a2f5edaea84ecccdc54f459b4.zip
send: do not requeue if packet is dead
-rw-r--r--src/send.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/send.c b/src/send.c
index ed19e58..6a77a25 100644
--- a/src/send.c
+++ b/src/send.c
@@ -237,14 +237,19 @@ void packet_encrypt_worker(struct work_struct *work)
bool have_simd = chacha20poly1305_init_simd();
while ((first = ptr_ring_consume_bh(&queue->ring)) != NULL) {
+ bool dead = false;
+
skb_walk_null_queue_safe (first, skb, next) {
if (likely(skb_encrypt(skb, PACKET_CB(first)->keypair, have_simd)))
skb_reset(skb);
else {
queue_enqueue_per_peer(&PACKET_PEER(first)->tx_queue, first, PACKET_STATE_DEAD);
- continue;
+ dead = true;
+ break;
}
}
+ if (unlikely(dead))
+ continue;
queue_enqueue_per_peer(&PACKET_PEER(first)->tx_queue, first, PACKET_STATE_CRYPTED);
}
chacha20poly1305_deinit_simd(have_simd);