diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2016-08-08 13:53:00 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2016-08-08 14:05:37 +0200 |
commit | 50de526e796ec66f03086d660dcb81a385340eb0 (patch) | |
tree | f93412abcd14bdc9abcdbb166f690999fedf5d2c /src/config.c | |
parent | fdd99220e92e7ca59a38ee6ff6a87ba157000556 (diff) |
persistent-keepalive: change range to [1,65535]
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'src/config.c')
-rw-r--r-- | src/config.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/config.c b/src/config.c index 3ca23f3..b065e0c 100644 --- a/src/config.c +++ b/src/config.c @@ -104,13 +104,10 @@ static int set_peer(struct wireguard_device *wg, void __user *user_peer, size_t } if (in_peer.persistent_keepalive_interval != (uint16_t)-1) { - if (in_peer.persistent_keepalive_interval && (in_peer.persistent_keepalive_interval < 10 || in_peer.persistent_keepalive_interval > 3600)) - ret = -EINVAL; - 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 = (unsigned long)in_peer.persistent_keepalive_interval * HZ; - } + const bool send_keepalive = !peer->persistent_keepalive_interval && in_peer.persistent_keepalive_interval && netdev_pub(wg)->flags & IFF_UP; + peer->persistent_keepalive_interval = (unsigned long)in_peer.persistent_keepalive_interval * HZ; + if (send_keepalive) + packet_send_keepalive(peer); } if (netdev_pub(wg)->flags & IFF_UP) |