mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-24 04:13:28 +01:00
Require live consensus to compute responsible HSDirs.
Here is how this changes the HSv3 client-side and service-side: For service side we already required live consensus to upload descriptors (see9e900d1db7
) so we should never get there without a live consensus. For the client-side we now require a live consensus to attempt to connect to HS. While this changes the client behavior in principle, it doesn't really change it, because we always required live consensus to set HSDir indices, so before this patch a client with no live consensus would try to compute responsible HSDirs without any HSDir indices and bug out. This makes the client behavior more consistent, by requiring a live consensus (and hence a semi-synced clock) for the client to connect to an HS entirely. The alternative would have been to allow setting HSDir indices with a non-live consensus, but this would cause the various problems outlined by commitb89d2fa1db
.
This commit is contained in:
parent
fa195626bd
commit
2520ee34c6
@ -1332,15 +1332,17 @@ hs_get_responsible_hsdirs(const ed25519_public_key_t *blinded_pk,
|
||||
|
||||
sorted_nodes = smartlist_new();
|
||||
|
||||
/* Make sure we actually have a live consensus */
|
||||
networkstatus_t *c = networkstatus_get_live_consensus(approx_time());
|
||||
if (!c || smartlist_len(c->routerstatus_list) == 0) {
|
||||
log_warn(LD_REND, "No live consensus so we can't get the responsible "
|
||||
"hidden service directories.");
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Add every node_t that support HSDir v3 for which we do have a valid
|
||||
* hsdir_index already computed for them for this consensus. */
|
||||
{
|
||||
networkstatus_t *c = networkstatus_get_latest_consensus();
|
||||
if (!c || smartlist_len(c->routerstatus_list) == 0) {
|
||||
log_warn(LD_REND, "No valid consensus so we can't get the responsible "
|
||||
"hidden service directories.");
|
||||
goto done;
|
||||
}
|
||||
SMARTLIST_FOREACH_BEGIN(c->routerstatus_list, const routerstatus_t *, rs) {
|
||||
/* Even though this node_t object won't be modified and should be const,
|
||||
* we can't add const object in a smartlist_t. */
|
||||
|
Loading…
Reference in New Issue
Block a user