From 6a0c9818677d1c5507bd8fa9d4378dbb324f6fbc Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Mon, 30 Mar 2020 00:24:30 +0200 Subject: [PATCH] Renew SPTPS keys every hour. We did do this in the past, but in some commit we stopped automatically renewing keys every hour. --- src/net.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/net.c b/src/net.c index 3c1ad3e6..020ffd4f 100644 --- a/src/net.c +++ b/src/net.c @@ -29,6 +29,7 @@ #include "net.h" #include "netutl.h" #include "protocol.h" +#include "sptps.h" #include "xalloc.h" #include @@ -615,6 +616,18 @@ static void periodic_handler(event_loop_t *loop, void *data) { n->status.dirty = false; } + + if(n->status.validkey && n->last_req_key + 3600 < mesh->loop.now.tv_sec) { + logger(mesh, MESHLINK_DEBUG, "SPTPS key renewal for node %s", n->name); + + if(!sptps_force_kex(&n->sptps)) { + logger(mesh, MESHLINK_ERROR, "SPTPS key renewal for node %s failed", n->name); + n->status.validkey = false; + sptps_stop(&n->sptps); + n->status.waitingforkey = false; + n->last_req_key = 0; + } + } } timeout_set(&mesh->loop, data, &(struct timespec) { -- 2.39.5