aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/send.c
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2017-03-15 19:20:58 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2017-03-20 01:02:06 +0100
commite16ba338168e00b0c2702ec5529280301c514d67 (patch)
tree8e92e5f428f263cee69f42a922047c234984f03a /src/send.c
parentcurve25519: add AVX implementation (diff)
downloadwireguard-monolithic-historical-e16ba338168e00b0c2702ec5529280301c514d67.tar.xz
wireguard-monolithic-historical-e16ba338168e00b0c2702ec5529280301c514d67.zip
data: big refactoring
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 e04a245..f5414e1 100644
--- a/src/send.c
+++ b/src/send.c
@@ -77,12 +77,12 @@ void packet_send_handshake_response(struct wireguard_peer *peer)
}
}
-void packet_send_handshake_cookie(struct wireguard_device *wg, struct sk_buff *initiating_skb, void *data, size_t data_len, __le32 sender_index)
+void packet_send_handshake_cookie(struct wireguard_device *wg, struct sk_buff *initiating_skb, __le32 sender_index)
{
struct message_handshake_cookie packet;
net_dbg_skb_ratelimited("Sending cookie response for denied handshake message for %pISpfsc\n", initiating_skb);
- cookie_message_create(&packet, initiating_skb, data, data_len, sender_index, &wg->cookie_checker);
+ cookie_message_create(&packet, initiating_skb, sender_index, &wg->cookie_checker);
socket_send_buffer_as_reply_to_skb(wg, initiating_skb, &packet, sizeof(packet));
}
@@ -123,10 +123,13 @@ static void message_create_data_done(struct sk_buff_head *queue, struct wireguar
struct sk_buff *skb, *tmp;
bool is_keepalive, data_sent = false;
+ if (unlikely(!skb_queue_len(queue)))
+ return;
+
timers_any_authenticated_packet_traversal(peer);
skb_queue_walk_safe(queue, skb, tmp) {
is_keepalive = skb->len == message_data_len(0);
- if (likely(!socket_send_skb_to_peer(peer, skb, *(u8 *)skb->cb) && !is_keepalive))
+ if (likely(!socket_send_skb_to_peer(peer, skb, PACKET_CB(skb)->ds) && !is_keepalive))
data_sent = true;
}
if (likely(data_sent))