aboutsummaryrefslogtreecommitdiff
path: root/src/or/nodelist.c
diff options
context:
space:
mode:
authorLinus Nordberg <linus@torproject.org>2012-08-31 23:02:19 +0200
committerNick Mathewson <nickm@torproject.org>2012-09-04 12:57:21 -0400
commit3746215350f4a25c5ec619a8fbe25f3637bb626f (patch)
tree4eb7293b82cb9487f8d2bea8112a92fea45ad2ac /src/or/nodelist.c
parent0f45dbefed1ddca4772bf66afb268bc20aefa1d1 (diff)
downloadtor-3746215350f4a25c5ec619a8fbe25f3637bb626f.tar
tor-3746215350f4a25c5ec619a8fbe25f3637bb626f.tar.gz
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.
Diffstat (limited to 'src/or/nodelist.c')
-rw-r--r--src/or/nodelist.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/or/nodelist.c b/src/or/nodelist.c
index 1d1bbfc02..9ee114bd7 100644
--- a/src/or/nodelist.c
+++ b/src/or/nodelist.c
@@ -206,6 +206,7 @@ nodelist_set_consensus(networkstatus_t *ns)
{
const or_options_t *options = get_options();
int authdir = authdir_mode_v2(options) || authdir_mode_v3(options);
+ int client = !server_mode(options);
init_nodelist();
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_exit = rs->is_bad_exit;
node->is_hs_dir = rs->is_hs_dir;
- if (options->ClientPreferIPv6ORPort == 1)
- node->ipv6_preferred = !tor_addr_is_null(&rs->ipv6_addr);
+ node->ipv6_preferred = 0;
+ 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);