summaryrefslogtreecommitdiffhomepage
path: root/src/send.c
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-09-04 10:44:42 -0600
committerJason A. Donenfeld <Jason@zx2c4.com>2018-09-04 11:08:29 -0600
commit4ed60c09ee40f22f99afd59f3ff94866b7aa0cc4 (patch)
treedf5d7df445df552374ea62771c9ec2e3c6c511aa /src/send.c
parent93b6e83e4faa8de6247e0e46d5060ec543befef8 (diff)
global: prefer sizeof(*pointer) when possible
Suggested-by: Sultan Alsawaf <sultanxda@gmail.com> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'src/send.c')
-rw-r--r--src/send.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/send.c b/src/send.c
index 38718c6..5b6d0fe 100644
--- a/src/send.c
+++ b/src/send.c
@@ -38,10 +38,8 @@ static void packet_send_handshake_initiation(struct wireguard_peer *peer)
timers_any_authenticated_packet_sent(peer);
atomic64_set(&peer->last_sent_handshake,
ktime_get_boot_fast_ns());
- socket_send_buffer_to_peer(
- peer, &packet,
- sizeof(struct message_handshake_initiation),
- HANDSHAKE_DSCP);
+ socket_send_buffer_to_peer(peer, &packet, sizeof(packet),
+ HANDSHAKE_DSCP);
timers_handshake_initiated(peer);
}
}
@@ -102,10 +100,9 @@ void packet_send_handshake_response(struct wireguard_peer *peer)
timers_any_authenticated_packet_sent(peer);
atomic64_set(&peer->last_sent_handshake,
ktime_get_boot_fast_ns());
- socket_send_buffer_to_peer(
- peer, &packet,
- sizeof(struct message_handshake_response),
- HANDSHAKE_DSCP);
+ socket_send_buffer_to_peer(peer, &packet,
+ sizeof(packet),
+ HANDSHAKE_DSCP);
}
}
}
@@ -200,8 +197,7 @@ static inline bool skb_encrypt(struct sk_buff *skb,
* and the header.
*/
skb_set_inner_network_header(skb, 0);
- header = (struct message_data *)skb_push(skb,
- sizeof(struct message_data));
+ header = (struct message_data *)skb_push(skb, sizeof(*header));
header->header.type = cpu_to_le32(MESSAGE_DATA);
header->key_idx = keypair->remote_index;
header->counter = cpu_to_le64(PACKET_CB(skb)->nonce);