aboutsummaryrefslogtreecommitdiffstatshomepage
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
commit5dc2f9efb60026e2f434015ed1ab459f99eaaab2 (patch)
treee9f1d4c1549c28ccd81c5afaa0506b4a1c871d14 /src/timers.c
parenttimers: reinitialize state on init (diff)
downloadwireguard-monolithic-historical-5dc2f9efb60026e2f434015ed1ab459f99eaaab2.tar.xz
wireguard-monolithic-historical-5dc2f9efb60026e2f434015ed1ab459f99eaaab2.zip
timers: remove slack_time
It's already done implicitly by recent kernels and it's not adding much here.
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)