summaryrefslogtreecommitdiffhomepage
path: root/src/config.c
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2016-08-08 13:53:00 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2016-08-08 14:05:37 +0200
commit50de526e796ec66f03086d660dcb81a385340eb0 (patch)
treef93412abcd14bdc9abcdbb166f690999fedf5d2c /src/config.c
parentfdd99220e92e7ca59a38ee6ff6a87ba157000556 (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.c11
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)