mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-24 12:23:32 +01:00
Use L2 vanguards during path selection
Co-authored-by: Mike Perry <mikeperry-git@torproject.org>
This commit is contained in:
parent
314a6b42c5
commit
e23947716e
@ -2259,8 +2259,9 @@ middle_node_must_be_vanguard(const or_options_t *options,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we have sticky L2 nodes, and this is an L2 pick, use vanguards */
|
/* If we are a hidden service circuit, always use either vanguards-lite
|
||||||
if (options->HSLayer2Nodes && cur_len == 1) {
|
* or HSLayer2Nodes for 2nd hop. */
|
||||||
|
if (cur_len == 1) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2284,7 +2285,8 @@ pick_vanguard_middle_node(const or_options_t *options,
|
|||||||
|
|
||||||
/* Pick the right routerset based on the current hop */
|
/* Pick the right routerset based on the current hop */
|
||||||
if (cur_len == 1) {
|
if (cur_len == 1) {
|
||||||
vanguard_routerset = options->HSLayer2Nodes;
|
vanguard_routerset = options->HSLayer2Nodes ?
|
||||||
|
options->HSLayer2Nodes : get_layer2_guards();
|
||||||
} else if (cur_len == 2) {
|
} else if (cur_len == 2) {
|
||||||
vanguard_routerset = options->HSLayer3Nodes;
|
vanguard_routerset = options->HSLayer3Nodes;
|
||||||
} else {
|
} else {
|
||||||
@ -2293,6 +2295,10 @@ pick_vanguard_middle_node(const or_options_t *options,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (BUG(!vanguard_routerset)) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
node = pick_restricted_middle_node(flags, vanguard_routerset,
|
node = pick_restricted_middle_node(flags, vanguard_routerset,
|
||||||
options->ExcludeNodes, excluded,
|
options->ExcludeNodes, excluded,
|
||||||
cur_len+1);
|
cur_len+1);
|
||||||
|
@ -2022,16 +2022,12 @@ circuit_is_hs_v3(const circuit_t *circ)
|
|||||||
int
|
int
|
||||||
circuit_should_use_vanguards(uint8_t purpose)
|
circuit_should_use_vanguards(uint8_t purpose)
|
||||||
{
|
{
|
||||||
const or_options_t *options = get_options();
|
/* All hidden service circuits use either vanguards or
|
||||||
|
* vanguards-lite. */
|
||||||
/* Only hidden service circuits use vanguards */
|
if (circuit_purpose_is_hidden_service(purpose))
|
||||||
if (!circuit_purpose_is_hidden_service(purpose))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
/* Pinned middles are effectively vanguards */
|
|
||||||
if (options->HSLayer2Nodes || options->HSLayer3Nodes)
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
/* Everything else is a normal circuit */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1699,6 +1699,9 @@ notify_after_networkstatus_changes(void)
|
|||||||
channelpadding_new_consensus_params(c);
|
channelpadding_new_consensus_params(c);
|
||||||
circpad_new_consensus_params(c);
|
circpad_new_consensus_params(c);
|
||||||
router_new_consensus_params(c);
|
router_new_consensus_params(c);
|
||||||
|
|
||||||
|
/* Maintenance of our L2 guard list */
|
||||||
|
maintain_layer2_guards();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Copy all the ancillary information (like router download status and so on)
|
/** Copy all the ancillary information (like router download status and so on)
|
||||||
|
Loading…
Reference in New Issue
Block a user