diff options
author | teor <teor@torproject.org> | 2020-04-15 13:04:33 +1000 |
---|---|---|
committer | teor <teor@torproject.org> | 2020-04-29 22:43:09 +1000 |
commit | 16f3f6a1afe5dcd75536039029f51392d05ce153 (patch) | |
tree | 7cd61d102c36ad8461fa6aad3b3b2a1e97039cb7 /src/core/or/circuitbuild.c | |
parent | ec5f4f3c5a5aa4d69b2867ba41bc83ba1e6c888a (diff) | |
download | tor-16f3f6a1afe5dcd75536039029f51392d05ce153.tar.gz tor-16f3f6a1afe5dcd75536039029f51392d05ce153.zip |
relay/circuitbuild: Re-use IPv6 connections for circuits
Search for existing connections using the remote IPv4 and IPv6
addresses.
Part of 33817.
Diffstat (limited to 'src/core/or/circuitbuild.c')
-rw-r--r-- | src/core/or/circuitbuild.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/core/or/circuitbuild.c b/src/core/or/circuitbuild.c index ce0f9618fe..0381a4dc35 100644 --- a/src/core/or/circuitbuild.c +++ b/src/core/or/circuitbuild.c @@ -559,11 +559,17 @@ circuit_handle_first_hop(origin_circuit_t *circ) fmt_addrport(&firsthop->extend_info->addr, firsthop->extend_info->port)); - n_chan = channel_get_for_extend(firsthop->extend_info->identity_digest, - &firsthop->extend_info->ed_identity, - &firsthop->extend_info->addr, - &msg, - &should_launch); + /* We'll cleanup this code in #33220, when we add an IPv6 address to + * extend_info_t. */ + const bool addr_is_ipv4 = + (tor_addr_family(&firsthop->extend_info->addr) == AF_INET); + n_chan = channel_get_for_extend( + firsthop->extend_info->identity_digest, + &firsthop->extend_info->ed_identity, + addr_is_ipv4 ? &firsthop->extend_info->addr : NULL, + addr_is_ipv4 ? NULL : &firsthop->extend_info->addr, + &msg, + &should_launch); if (!n_chan) { /* not currently connected in a useful way. */ |