aboutsummaryrefslogtreecommitdiff
path: root/src/or/nodelist.c
diff options
context:
space:
mode:
authorLinus Nordberg <linus@torproject.org>2012-08-27 15:03:34 +0200
committerNick Mathewson <nickm@torproject.org>2012-09-04 12:57:21 -0400
commite04e1a2e7d67861881c9e237dcea344dda39e858 (patch)
treee5ca5d75af523b6bf1a93fd027a70b2bf4b186f4 /src/or/nodelist.c
parentd6ad00a01f703a79d9ca6d6edd958b4d05279b4e (diff)
downloadtor-e04e1a2e7d67861881c9e237dcea344dda39e858.tar
tor-e04e1a2e7d67861881c9e237dcea344dda39e858.tar.gz
Clients connect to public relays over IPv6.
Add ClientUseIPv6 and ClientPreferIPv6ORPort configuration options. Use "preferred OR port" for all entry nodes, not only for bridges. Mark bridges with "prefer IPv6 OR port" if an IPv6 address is configured in Bridge line and ClientPreferIPv6ORPort is set. Mark relays with "prefer IPv6 OR port" if an IPv6 address is found in descriptor and ClientPreferIPv6ORPort is set. Filter "preferred OR port" through the ClientUseIPv6 config option. We might want to move this test to where actual connection is being set up once we have a fall back mechanism in place. Have only non-servers pick an IPv6 address for the first hop: We don't want relays to connect over IPv6 yet. (IPv6 has never been used for second or third hops.) Implements ticket 5535.
Diffstat (limited to 'src/or/nodelist.c')
-rw-r--r--src/or/nodelist.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/or/nodelist.c b/src/or/nodelist.c
index 9d0247f4e..1d1bbfc02 100644
--- a/src/or/nodelist.c
+++ b/src/or/nodelist.c
@@ -242,6 +242,8 @@ 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);
}
} SMARTLIST_FOREACH_END(rs);
@@ -849,7 +851,13 @@ node_get_pref_orport(const node_t *node, tor_addr_port_t *ap_out)
{
tor_assert(ap_out);
- if (node_ipv6_preferred(node))
+ /* Cheap implementation of config option ClientUseIPv6 -- simply
+ don't prefer IPv6 when ClientUseIPv6 is not set. (See #4455 for
+ more on this subject.) Note that this filter is too strict since
+ we're hindering not only clients! Erring on the safe side
+ shouldn't be a problem though. XXX move this check to where
+ outgoing connections are made? -LN */
+ if (get_options()->ClientUseIPv6 == 1 && node_ipv6_preferred(node))
node_get_pref_ipv6_orport(node, ap_out);
else
node_get_prim_orport(node, ap_out);