aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2017-10-04 05:04:39 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2017-10-05 15:22:00 +0200
commit42a3d3e5c325b00b03ec65a50c598badfc506d72 (patch)
tree6e9a14e24a96a5f60f788b3b75ef8224e1fcce86
parentsend: put keypair reference (diff)
downloadwireguard-monolithic-historical-42a3d3e5c325b00b03ec65a50c598badfc506d72.tar.xz
wireguard-monolithic-historical-42a3d3e5c325b00b03ec65a50c598badfc506d72.zip
receive: we're not planning on turning that into a while loop now
-rw-r--r--src/receive.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/receive.c b/src/receive.c
index 507022a..504eb55 100644
--- a/src/receive.c
+++ b/src/receive.c
@@ -351,19 +351,18 @@ void packet_rx_worker(struct work_struct *work)
{
struct crypt_ctx *ctx;
struct crypt_queue *queue = container_of(work, struct crypt_queue, work);
- struct sk_buff *skb;
local_bh_disable();
while ((ctx = queue_first_per_peer(queue)) != NULL && atomic_read(&ctx->is_finished)) {
queue_dequeue(queue);
- if (likely((skb = ctx->skb) != NULL)) {
- if (likely(counter_validate(&ctx->keypair->receiving.counter, PACKET_CB(skb)->nonce))) {
- skb_reset(skb);
- packet_consume_data_done(skb, ctx->peer, &ctx->endpoint, noise_received_with_keypair(&ctx->peer->keypairs, ctx->keypair));
+ if (likely(ctx->skb)) {
+ if (likely(counter_validate(&ctx->keypair->receiving.counter, PACKET_CB(ctx->skb)->nonce))) {
+ skb_reset(ctx->skb);
+ packet_consume_data_done(ctx->skb, ctx->peer, &ctx->endpoint, noise_received_with_keypair(&ctx->peer->keypairs, ctx->keypair));
}
else {
net_dbg_ratelimited("%s: Packet has invalid nonce %Lu (max %Lu)\n", ctx->peer->device->dev->name, PACKET_CB(ctx->skb)->nonce, ctx->keypair->receiving.counter.receive.counter);
- dev_kfree_skb(skb);
+ dev_kfree_skb(ctx->skb);
}
}
noise_keypair_put(ctx->keypair);