mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-28 06:13:31 +01:00
Take microdesc IPv6 address into account when setting node->ipv6_preferred.
Also, do this only for clients, explicitly. Also, give the flag a value every time we set consensus. We used to touch it only when ClientPreferIPv6ORPort was set, which was wrong.
This commit is contained in:
parent
0f45dbefed
commit
3746215350
@ -206,6 +206,7 @@ nodelist_set_consensus(networkstatus_t *ns)
|
|||||||
{
|
{
|
||||||
const or_options_t *options = get_options();
|
const or_options_t *options = get_options();
|
||||||
int authdir = authdir_mode_v2(options) || authdir_mode_v3(options);
|
int authdir = authdir_mode_v2(options) || authdir_mode_v3(options);
|
||||||
|
int client = !server_mode(options);
|
||||||
|
|
||||||
init_nodelist();
|
init_nodelist();
|
||||||
if (ns->flavor == FLAV_MICRODESC)
|
if (ns->flavor == FLAV_MICRODESC)
|
||||||
@ -242,8 +243,11 @@ nodelist_set_consensus(networkstatus_t *ns)
|
|||||||
node->is_bad_directory = rs->is_bad_directory;
|
node->is_bad_directory = rs->is_bad_directory;
|
||||||
node->is_bad_exit = rs->is_bad_exit;
|
node->is_bad_exit = rs->is_bad_exit;
|
||||||
node->is_hs_dir = rs->is_hs_dir;
|
node->is_hs_dir = rs->is_hs_dir;
|
||||||
if (options->ClientPreferIPv6ORPort == 1)
|
node->ipv6_preferred = 0;
|
||||||
node->ipv6_preferred = !tor_addr_is_null(&rs->ipv6_addr);
|
if (client && options->ClientPreferIPv6ORPort == 1 &&
|
||||||
|
(tor_addr_is_null(&rs->ipv6_addr) == 0 ||
|
||||||
|
(node->md && tor_addr_is_null(&node->md->ipv6_addr) == 0)))
|
||||||
|
node->ipv6_preferred = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
} SMARTLIST_FOREACH_END(rs);
|
} SMARTLIST_FOREACH_END(rs);
|
||||||
|
Loading…
Reference in New Issue
Block a user