From: Guus Sliepen Date: Sun, 29 Mar 2020 22:24:30 +0000 (+0200) Subject: Renew SPTPS keys every hour. X-Git-Url: http://git.meshlink.io/?p=meshlink;a=commitdiff_plain;h=6a0c9818677d1c5507bd8fa9d4378dbb324f6fbc Renew SPTPS keys every hour. We did do this in the past, but in some commit we stopped automatically renewing keys every hour. --- 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) {