diff options
author | George Kadianakis <desnacked@riseup.net> | 2017-08-12 13:05:25 +0300 |
---|---|---|
committer | George Kadianakis <desnacked@riseup.net> | 2017-08-19 16:28:43 +0300 |
commit | 43343ec019e24cb3b1d5802d1369ab75ec0e8776 (patch) | |
tree | 80ecef893a1d67518c5bc5afb147e2963a26ceb4 /src/or | |
parent | 5750f18bc7efacc2405918d08bc3f47e4c6a7ae9 (diff) | |
download | tor-43343ec019e24cb3b1d5802d1369ab75ec0e8776.tar.gz tor-43343ec019e24cb3b1d5802d1369ab75ec0e8776.zip |
prop224: Improve our checks for unset HSDir index.
We used to not check next hsdir index.
Diffstat (limited to 'src/or')
-rw-r--r-- | src/or/hs_common.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/or/hs_common.c b/src/or/hs_common.c index 6c860b0cf0..0529c0cdb0 100644 --- a/src/or/hs_common.c +++ b/src/or/hs_common.c @@ -1180,9 +1180,10 @@ hs_get_hsdir_spread_store(void) } /** <b>node</b> is an HSDir so make sure that we have assigned an hsdir index. + * If <b>is_for_next_period</b> is set, also check the next HSDir index field. * Return 0 if everything is as expected, else return -1. */ static int -node_has_hsdir_index(const node_t *node) +node_has_hsdir_index(const node_t *node, int is_for_next_period) { tor_assert(node_supports_v3_hsdir(node)); @@ -1200,6 +1201,12 @@ node_has_hsdir_index(const node_t *node) return 0; } + if (is_for_next_period && + BUG(tor_mem_is_zero((const char*)node->hsdir_index->next, + DIGEST256_LEN))) { + return 0; + } + return 1; } @@ -1244,7 +1251,7 @@ hs_get_responsible_hsdirs(const ed25519_public_key_t *blinded_pk, node_t *n = node_get_mutable_by_id(rs->identity_digest); tor_assert(n); if (node_supports_v3_hsdir(n) && rs->is_hs_dir) { - if (!node_has_hsdir_index(n)) { + if (!node_has_hsdir_index(n, is_next_period)) { log_info(LD_GENERAL, "Node %s was found without hsdir index.", node_describe(n)); continue; |