mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-14 07:03:44 +01:00
prop224: Make intro point min/max lifetime a consensus param
Signed-off-by: David Goulet <dgoulet@torproject.org>
This commit is contained in:
parent
670cecaf66
commit
f0e02e3a14
@ -227,6 +227,30 @@ get_intro_point_max_introduce2(void)
|
|||||||
0, INT32_MAX);
|
0, INT32_MAX);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Return the minimum lifetime of an introduction point defined by a consensus
|
||||||
|
* parameter or the default value. */
|
||||||
|
static int32_t
|
||||||
|
get_intro_point_min_lifetime(void)
|
||||||
|
{
|
||||||
|
/* The [0, 2147483647] range is quite large to accomodate anything we decide
|
||||||
|
* in the future. */
|
||||||
|
return networkstatus_get_param(NULL, "hs_intro_min_lifetime",
|
||||||
|
INTRO_POINT_LIFETIME_MIN_SECONDS,
|
||||||
|
0, INT32_MAX);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Return the maximum lifetime of an introduction point defined by a consensus
|
||||||
|
* parameter or the default value. */
|
||||||
|
static int32_t
|
||||||
|
get_intro_point_max_lifetime(void)
|
||||||
|
{
|
||||||
|
/* The [0, 2147483647] range is quite large to accomodate anything we decide
|
||||||
|
* in the future. */
|
||||||
|
return networkstatus_get_param(NULL, "hs_intro_max_lifetime",
|
||||||
|
INTRO_POINT_LIFETIME_MAX_SECONDS,
|
||||||
|
0, INT32_MAX);
|
||||||
|
}
|
||||||
|
|
||||||
/* Helper: Function that needs to return 1 for the HT for each loop which
|
/* Helper: Function that needs to return 1 for the HT for each loop which
|
||||||
* frees every service in an hash map. */
|
* frees every service in an hash map. */
|
||||||
static int
|
static int
|
||||||
@ -301,10 +325,9 @@ service_intro_point_new(const extend_info_t *ei, unsigned int is_legacy)
|
|||||||
ip->introduce2_max =
|
ip->introduce2_max =
|
||||||
crypto_rand_int_range(get_intro_point_min_introduce2(),
|
crypto_rand_int_range(get_intro_point_min_introduce2(),
|
||||||
get_intro_point_max_introduce2());
|
get_intro_point_max_introduce2());
|
||||||
/* XXX: These will be controlled by consensus params. (#20961) */
|
|
||||||
ip->time_to_expire = time(NULL) +
|
ip->time_to_expire = time(NULL) +
|
||||||
crypto_rand_int_range(INTRO_POINT_LIFETIME_MIN_SECONDS,
|
crypto_rand_int_range(get_intro_point_min_lifetime(),
|
||||||
INTRO_POINT_LIFETIME_MAX_SECONDS);
|
get_intro_point_max_lifetime());
|
||||||
ip->replay_cache = replaycache_new(0, 0);
|
ip->replay_cache = replaycache_new(0, 0);
|
||||||
|
|
||||||
/* Initialize the base object. We don't need the certificate object. */
|
/* Initialize the base object. We don't need the certificate object. */
|
||||||
|
Loading…
Reference in New Issue
Block a user