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/feature/relay | |
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/feature/relay')
-rw-r--r-- | src/feature/relay/circuitbuild_relay.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/feature/relay/circuitbuild_relay.c b/src/feature/relay/circuitbuild_relay.c index 7d3d589777..a926a1d81d 100644 --- a/src/feature/relay/circuitbuild_relay.c +++ b/src/feature/relay/circuitbuild_relay.c @@ -330,9 +330,20 @@ circuit_extend(struct cell_t *cell, struct circuit_t *circ) if (circuit_extend_lspec_valid_helper(&ec, circ) < 0) return -1; + /* Check the addresses, without logging */ + const int ipv4_valid = + (circuit_extend_addr_port_helper(&ec.orport_ipv4, false, false, 0) == 0); + const int ipv6_valid = + (circuit_extend_addr_port_helper(&ec.orport_ipv6, false, false, 0) == 0); + IF_BUG_ONCE(!ipv4_valid && !ipv6_valid) { + /* circuit_extend_lspec_valid_helper() should have caught this */ + return -1; + } + n_chan = channel_get_for_extend((const char*)ec.node_id, &ec.ed_pubkey, - &ec.orport_ipv4.addr, + ipv4_valid ? &ec.orport_ipv4.addr : NULL, + ipv6_valid ? &ec.orport_ipv6.addr : NULL, &msg, &should_launch); |