summaryrefslogtreecommitdiffstats
path: root/sys/net/if_wg.c
diff options
context:
space:
mode:
authorMatt Dunwoodie <ncon@noconroy.net>2021-03-28 09:18:02 +1100
committerMatt Dunwoodie <ncon@noconroy.net>2021-04-13 15:47:30 +1000
commit5e02e86c4dadfaaa32f38195531cfab113e79c7f (patch)
treec1b70334bcc1e4203e45323f9c14595554feb97b /sys/net/if_wg.c
parentRework encap/decap routines (diff)
downloadwireguard-openbsd-5e02e86c4dadfaaa32f38195531cfab113e79c7f.tar.xz
wireguard-openbsd-5e02e86c4dadfaaa32f38195531cfab113e79c7f.zip
Allow setting keepalive while interface is down
Diffstat (limited to '')
-rw-r--r--sys/net/if_wg.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/net/if_wg.c b/sys/net/if_wg.c
index 0d60b37b6b8..3de52a588cb 100644
--- a/sys/net/if_wg.c
+++ b/sys/net/if_wg.c
@@ -964,9 +964,10 @@ void
wg_timers_set_persistent_keepalive(struct wg_timers *t, uint16_t interval)
{
rw_enter_read(&t->t_lock);
- if (!t->t_disabled) {
+ if (interval != t->t_persistent_keepalive_interval) {
t->t_persistent_keepalive_interval = interval;
- wg_timers_run_persistent_keepalive(t);
+ if (!t->t_disabled)
+ wg_timers_run_persistent_keepalive(t);
}
rw_exit_read(&t->t_lock);
}
@@ -1203,7 +1204,7 @@ wg_timers_run_persistent_keepalive(void *_t)
{
struct wg_timers *t = _t;
struct wg_peer *peer = CONTAINER_OF(t, struct wg_peer, p_timers);
- if (t->t_persistent_keepalive_interval != 0)
+ if (t->t_persistent_keepalive_interval > 0)
task_add(wg_crypt_taskq, &peer->p_send_keepalive);
}