[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor/master] prop224: Improve our checks for unset HSDir index.
commit 43343ec019e24cb3b1d5802d1369ab75ec0e8776
Author: George Kadianakis <desnacked@xxxxxxxxxx>
Date: Sat Aug 12 13:05:25 2017 +0300
prop224: Improve our checks for unset HSDir index.
We used to not check next hsdir index.
---
src/or/hs_common.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/or/hs_common.c b/src/or/hs_common.c
index 6c860b0cf..0529c0cdb 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;
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits