X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fprotocol.c;h=3539ca7c81783dd4bee50728b9b0fc15974cc0bb;hb=28b7a53b693f6b4e70218a926e68a36ece54cda1;hp=7de75b931a868690861d355e194e58e46801f5b7;hpb=3a149f7521dfff67e6a790c1a830afc649ae083e;p=tinc diff --git a/src/protocol.c b/src/protocol.c index 7de75b93..3539ca7c 100644 --- a/src/protocol.c +++ b/src/protocol.c @@ -1,7 +1,7 @@ /* protocol.c -- handle the meta-protocol, basic functions Copyright (C) 1999-2005 Ivo Timmermans, - 2000-2013 Guus Sliepen + 2000-2022 Guus Sliepen This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,9 +22,11 @@ #include "conf.h" #include "connection.h" +#include "crypto.h" #include "logger.h" #include "meta.h" #include "protocol.h" +#include "utils.h" #include "xalloc.h" bool tunnelserver = false; @@ -47,7 +49,7 @@ static bool (*request_handlers[])(connection_t *, const char *) = { /* Request names */ -static char (*request_name[]) = { +static const char (*request_name[]) = { "ID", "METAKEY", "CHALLENGE", "CHAL_REPLY", "ACK", "STATUS", "ERROR", "TERMREQ", "PING", "PONG", @@ -191,7 +193,7 @@ static void age_past_requests(void *data) { if(left) timeout_set(&past_request_timeout, &(struct timeval) { - 10, rand() % 100000 + 10, jitter() }); } @@ -209,7 +211,7 @@ bool seen_request(const char *request) { new->firstseen = now.tv_sec; splay_insert(&past_request_tree, new); timeout_add(&past_request_timeout, age_past_requests, NULL, &(struct timeval) { - 10, rand() % 100000 + 10, jitter() }); return false; }