summaryrefslogtreecommitdiffhomepage
path: root/src/timers.c
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-05-19 00:54:20 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2018-05-19 00:54:20 +0200
commitafff97a1ab7663167e6479e9261f737b403822b4 (patch)
tree93432ae350db79ccfa1781d8fb53995892658570 /src/timers.c
parentbed9b893142e1ea296c4eb16f9a9ab34408acbba (diff)
timers: remove slack_time
It's already done implicitly by recent kernels and it's not adding much here. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'src/timers.c')
-rw-r--r--src/timers.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/src/timers.c b/src/timers.c
index 327a0c1..a9096c8 100644
--- a/src/timers.c
+++ b/src/timers.c
@@ -17,12 +17,6 @@
* Timer for, if enabled, sending an empty authenticated packet every user-specified seconds
*/
-/* This rounds the time up to the closest power of two of the closest tenth second. */
-static inline unsigned long slack_time(unsigned long time)
-{
- return time | roundup_pow_of_two(HZ / 10);
-}
-
#define peer_get_from_timer(timer_name) \
struct wireguard_peer *peer = peer_rcu_get(from_timer(peer, timer, timer_name)); \
if (unlikely(!peer)) \
@@ -150,7 +144,7 @@ void timers_handshake_initiated(struct wireguard_peer *peer)
{
if (likely(timers_active(peer))) {
del_timer(&peer->timer_send_keepalive);
- mod_timer(&peer->timer_retransmit_handshake, slack_time(jiffies + REKEY_TIMEOUT + prandom_u32_max(REKEY_TIMEOUT_JITTER_MAX)));
+ mod_timer(&peer->timer_retransmit_handshake, jiffies + REKEY_TIMEOUT + prandom_u32_max(REKEY_TIMEOUT_JITTER_MAX));
}
}
@@ -175,7 +169,7 @@ void timers_session_derived(struct wireguard_peer *peer)
void timers_any_authenticated_packet_traversal(struct wireguard_peer *peer)
{
if (peer->persistent_keepalive_interval && likely(timers_active(peer)))
- mod_timer(&peer->timer_persistent_keepalive, slack_time(jiffies + peer->persistent_keepalive_interval));
+ mod_timer(&peer->timer_persistent_keepalive, jiffies + peer->persistent_keepalive_interval);
}
void timers_init(struct wireguard_peer *peer)