Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Mike Perry
Tor
Commits
e42c5562
Commit
e42c5562
authored
Aug 02, 2017
by
George Kadianakis
Committed by
Nick Mathewson
Aug 08, 2017
Browse files
prop224: Don't use nodes as HSDirs if they don't have an HSDir index.
parent
74981d1f
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/or/hs_common.c
View file @
e42c5562
...
...
@@ -1121,6 +1121,30 @@ hs_get_hsdir_spread_store(void)
HS_DEFAULT_HSDIR_SPREAD_STORE
,
1
,
128
);
}
/** <b>node</b> is an HSDir so make sure that we have assigned an hsdir index.
* Return 0 if everything is as expected, else return -1. */
static
int
node_has_hsdir_index
(
const
node_t
*
node
)
{
tor_assert
(
node_supports_v3_hsdir
(
node
));
/* A node can't have an HSDir index without a descriptor since we need desc
* to get its ed25519 key */
if
(
!
node_has_descriptor
(
node
))
{
return
0
;
}
/* At this point, since the node has a desc, this node must also have an
* hsdir index. If not, something went wrong, so BUG out. */
if
(
BUG
(
node
->
hsdir_index
==
NULL
)
||
BUG
(
tor_mem_is_zero
((
const
char
*
)
node
->
hsdir_index
->
current
,
DIGEST256_LEN
)))
{
return
0
;
}
return
1
;
}
/* For a given blinded key and time period number, get the responsible HSDir
* and put their routerstatus_t object in the responsible_dirs list. If
* is_next_period is true, the next hsdir_index of the node_t is used. If
...
...
@@ -1162,7 +1186,9 @@ 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
(
BUG
(
n
->
hsdir_index
==
NULL
))
{
if
(
!
node_has_hsdir_index
(
n
))
{
log_info
(
LD_GENERAL
,
"Node %s was found without hsdir index."
,
node_describe
(
n
));
continue
;
}
smartlist_add
(
sorted_nodes
,
n
);
...
...
src/or/nodelist.c
View file @
e42c5562
...
...
@@ -189,9 +189,9 @@ node_set_hsdir_index(node_t *node, const networkstatus_t *ns)
node_identity_pk
=
node_get_ed25519_id
(
node
);
if
(
node_identity_pk
==
NULL
)
{
log_
warn
(
LD_BUG
,
"ed25519 identity public key not found when "
"trying to build the hsdir indexes for node %s"
,
node_describe
(
node
));
log_
debug
(
LD_GENERAL
,
"ed25519 identity public key not found when "
"trying to build the hsdir indexes for node %s"
,
node_describe
(
node
));
goto
done
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment