From: Schanzenbach, Martin Date: Tue, 31 Dec 2019 03:55:22 +0000 (+0900) Subject: add configurable rekey interval X-Git-Tag: v0.12.2~42 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=a91090c6625ba08b6b1ae040a48823bdb0e00609;p=oweals%2Fgnunet.git add configurable rekey interval --- diff --git a/src/transport/gnunet-communicator-tcp.c b/src/transport/gnunet-communicator-tcp.c index 63e980204..045a57d0f 100644 --- a/src/transport/gnunet-communicator-tcp.c +++ b/src/transport/gnunet-communicator-tcp.c @@ -68,7 +68,7 @@ /** * How often do we rekey based on time (at least) */ -#define REKEY_TIME_INTERVAL GNUNET_TIME_UNIT_DAYS +#define DEFAULT_REKEY_INTERVAL GNUNET_TIME_UNIT_DAYS /** * How long do we wait until we must have received the initial KX? @@ -521,6 +521,11 @@ static struct GNUNET_NETWORK_Handle *listen_sock; */ static struct GNUNET_PeerIdentity my_identity; +/** + * The rekey interval + */ +static struct GNUNET_TIME_Relative rekey_interval; + /** * Our private key. */ @@ -1246,7 +1251,7 @@ setup_out_cipher (struct Queue *queue) /* we don't need the private key anymore, drop it! */ memset (&queue->ephemeral, 0, sizeof(queue->ephemeral)); setup_cipher (&dh, &queue->target, &queue->out_cipher, &queue->out_hmac); - queue->rekey_time = GNUNET_TIME_relative_to_absolute (REKEY_TIME_INTERVAL); + queue->rekey_time = GNUNET_TIME_relative_to_absolute (rekey_interval); queue->rekey_left_bytes = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, REKEY_MAX_BYTES); } @@ -2148,6 +2153,12 @@ run (void *cls, "MAX_QUEUE_LENGTH", &max_queue_length)) max_queue_length = DEFAULT_MAX_QUEUE_LENGTH; + if (GNUNET_OK != + GNUNET_CONFIGURATION_get_value_time (cfg, + COMMUNICATOR_CONFIG_SECTION, + "REKEY_INTERVAL", + &rekey_interval)) + rekey_interval = DEFAULT_REKEY_INTERVAL; in = tcp_address_to_sockaddr (bindto, &in_len); if (NULL == in)