aboutsummaryrefslogtreecommitdiff
path: root/src/feature/client/transports.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2020-07-20 16:50:32 -0400
committerNick Mathewson <nickm@torproject.org>2020-07-20 16:50:32 -0400
commitf5d773c600e9902f053d03f47b7812bd1f4796b7 (patch)
treec8d370a54d4711cd2363551f8405dfb3f7bb0086 /src/feature/client/transports.c
parentd6570eaf5d8690799a1b698552315372fae2e1f0 (diff)
parenta576f37cfeff9f6b0a13a9475b5eed424ee44db9 (diff)
downloadtor-f5d773c600e9902f053d03f47b7812bd1f4796b7.tar.gz
tor-f5d773c600e9902f053d03f47b7812bd1f4796b7.zip
Merge remote-tracking branch 'tor-gitlab/mr/51'
Diffstat (limited to 'src/feature/client/transports.c')
-rw-r--r--src/feature/client/transports.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/feature/client/transports.c b/src/feature/client/transports.c
index 2bdc0ae151..2eb05d6a67 100644
--- a/src/feature/client/transports.c
+++ b/src/feature/client/transports.c
@@ -1643,17 +1643,26 @@ pt_get_extra_info_descriptor_string(void)
SMARTLIST_FOREACH_BEGIN(mp->transports, const transport_t *, t) {
char *transport_args = NULL;
+ const char *addrport = NULL;
/* If the transport proxy returned "0.0.0.0" as its address, and
* we know our external IP address, use it. Otherwise, use the
* returned address. */
- const char *addrport = NULL;
- uint32_t external_ip_address = 0;
- if (tor_addr_is_null(&t->addr) &&
- router_pick_published_address(get_options(),
- &external_ip_address, 0) >= 0) {
+ if (tor_addr_is_null(&t->addr)) {
tor_addr_t addr;
- tor_addr_from_ipv4h(&addr, external_ip_address);
+ /* Attempt to find the IPv4 and then attempt to find the IPv6 if we
+ * can't find it. */
+ bool found = relay_find_addr_to_publish(get_options(), AF_INET,
+ RELAY_FIND_ADDR_NO_FLAG,
+ &addr);
+ if (!found) {
+ found = relay_find_addr_to_publish(get_options(), AF_INET6,
+ RELAY_FIND_ADDR_NO_FLAG, &addr);
+ }
+ if (!found) {
+ log_err(LD_PT, "Unable to find address for transport %s", t->name);
+ continue;
+ }
addrport = fmt_addrport(&addr, t->port);
} else {
addrport = fmt_addrport(&t->addr, t->port);