summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2017-10-12 14:25:52 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2017-10-17 19:26:07 +0200
commit0de5b802d6ba0cd7582a5f0cbe149774d3dccb64 (patch)
treec3a64f530fe4c82f194c977d43d0b7281567edcc /src
parent9e5079f001b719927aa80ba58558d92020d9382e (diff)
receive: improve control flow
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'src')
-rw-r--r--src/receive.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/receive.c b/src/receive.c
index 6efbc08..0f896ee 100644
--- a/src/receive.c
+++ b/src/receive.c
@@ -407,10 +407,8 @@ void packet_decrypt_worker(struct work_struct *work)
struct sk_buff *skb;
while ((skb = ptr_ring_consume_bh(&queue->ring)) != NULL) {
- if (likely(skb_decrypt(skb, &PACKET_CB(skb)->keypair->receiving)))
- queue_enqueue_per_peer(&PACKET_PEER(skb)->rx_queue, skb, PACKET_STATE_CRYPTED);
- else
- queue_enqueue_per_peer(&PACKET_PEER(skb)->rx_queue, skb, PACKET_STATE_DEAD);
+ enum packet_state state = likely(skb_decrypt(skb, &PACKET_CB(skb)->keypair->receiving)) ? PACKET_STATE_CRYPTED : PACKET_STATE_DEAD;
+ queue_enqueue_per_peer(&PACKET_PEER(skb)->rx_queue, skb, state);
}
}