aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/send.c
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2019-06-12 15:05:50 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2019-06-25 16:42:42 +0200
commit21c6bb547d0d46a6ce36b7e1026b62548c6acfc1 (patch)
treebce4d65b9f48ec337f92172572767c25f43a3416 /src/send.c
parentcompat: unify custom function prefix/suffix (diff)
downloadwireguard-monolithic-historical-21c6bb547d0d46a6ce36b7e1026b62548c6acfc1.tar.xz
wireguard-monolithic-historical-21c6bb547d0d46a6ce36b7e1026b62548c6acfc1.zip
global: switch to coarse ktime
Coarse ktime is broken until [1] in 5.2 and kernels without the backport, so we use fallback code there. The fallback code has also been improved significantly. It now only uses slower clocks on kernels < 3.17, at the expense of some accuracy we're not overly concerned about. [1] https://lore.kernel.org/lkml/tip-e3ff9c3678b4d80e22d2557b68726174578eaf52@git.kernel.org/ Suggested-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'src/send.c')
-rw-r--r--src/send.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/send.c b/src/send.c
index b0df5c7..62f1a97 100644
--- a/src/send.c
+++ b/src/send.c
@@ -27,7 +27,7 @@ static void wg_packet_send_handshake_initiation(struct wg_peer *peer)
REKEY_TIMEOUT))
return; /* This function is rate limited. */
- atomic64_set(&peer->last_sent_handshake, ktime_get_boot_fast_ns());
+ atomic64_set(&peer->last_sent_handshake, ktime_get_coarse_boottime_ns());
net_dbg_ratelimited("%s: Sending handshake initiation to peer %llu (%pISpfsc)\n",
peer->device->dev->name, peer->internal_id,
&peer->endpoint.addr);
@@ -37,7 +37,7 @@ static void wg_packet_send_handshake_initiation(struct wg_peer *peer)
wg_timers_any_authenticated_packet_traversal(peer);
wg_timers_any_authenticated_packet_sent(peer);
atomic64_set(&peer->last_sent_handshake,
- ktime_get_boot_fast_ns());
+ ktime_get_coarse_boottime_ns());
wg_socket_send_buffer_to_peer(peer, &packet, sizeof(packet),
HANDSHAKE_DSCP);
wg_timers_handshake_initiated(peer);
@@ -87,7 +87,7 @@ void wg_packet_send_handshake_response(struct wg_peer *peer)
{
struct message_handshake_response packet;
- atomic64_set(&peer->last_sent_handshake, ktime_get_boot_fast_ns());
+ atomic64_set(&peer->last_sent_handshake, ktime_get_coarse_boottime_ns());
net_dbg_ratelimited("%s: Sending handshake response to peer %llu (%pISpfsc)\n",
peer->device->dev->name, peer->internal_id,
&peer->endpoint.addr);
@@ -100,7 +100,7 @@ void wg_packet_send_handshake_response(struct wg_peer *peer)
wg_timers_any_authenticated_packet_traversal(peer);
wg_timers_any_authenticated_packet_sent(peer);
atomic64_set(&peer->last_sent_handshake,
- ktime_get_boot_fast_ns());
+ ktime_get_coarse_boottime_ns());
wg_socket_send_buffer_to_peer(peer, &packet,
sizeof(packet),
HANDSHAKE_DSCP);