diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2016-07-10 02:46:37 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2016-07-10 03:46:56 +0200 |
commit | c4c3a558a1f476b3a49f33790c570a9a63b78d04 (patch) | |
tree | 031293468361b9520d7f54d870ec9ab0bc5f1298 /src/config.c | |
parent | 2e1bceea1388e2bd57b4ef17fb21190a8755d71e (diff) |
persistent keepalive: use unsigned long to avoid multiplication in hotpath
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'src/config.c')
-rw-r--r-- | src/config.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/config.c b/src/config.c index 9cf75b1..3ca23f3 100644 --- a/src/config.c +++ b/src/config.c @@ -109,7 +109,7 @@ static int set_peer(struct wireguard_device *wg, void __user *user_peer, size_t else { if (!peer->persistent_keepalive_interval && in_peer.persistent_keepalive_interval && netdev_pub(wg)->flags & IFF_UP) packet_send_keepalive(peer); - peer->persistent_keepalive_interval = in_peer.persistent_keepalive_interval; + peer->persistent_keepalive_interval = (unsigned long)in_peer.persistent_keepalive_interval * HZ; } } @@ -251,7 +251,7 @@ static int populate_peer(struct wireguard_peer *peer, void *ctx) out_peer.last_handshake_time = peer->walltime_last_handshake; out_peer.tx_bytes = peer->tx_bytes; out_peer.rx_bytes = peer->rx_bytes; - out_peer.persistent_keepalive_interval = peer->persistent_keepalive_interval; + out_peer.persistent_keepalive_interval = (uint16_t)(peer->persistent_keepalive_interval / HZ); ipmasks_data.out_len = data->out_len; ipmasks_data.data = data->data; |