summaryrefslogtreecommitdiffhomepage
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
commit48d7390a2ed1c615d56d426ed8e7a2f31d4542fd (patch)
treeceabed9332524d5a7305ed06ddddb6f26c359a53
parent38b722ccee5c68fc49aa2d59172a08148d01f7df (diff)
receive: we're not planning on turning that into a while loop now
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-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);