diff options
author | David Fifield <david@bamsoftware.com> | 2012-10-10 17:08:07 -0700 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2012-10-10 22:25:30 -0400 |
commit | 8b3f3fb86ed5208c4ac295c52696a347d8cf9170 (patch) | |
tree | f9c6b6f2ef82085bcd4d96c710a3db90be4d3804 | |
parent | 8419d184411e8cd9457346a7a3d5f9734211a8b2 (diff) | |
download | tor-8b3f3fb86ed5208c4ac295c52696a347d8cf9170.tar.gz tor-8b3f3fb86ed5208c4ac295c52696a347d8cf9170.zip |
Use fmt_addrport in pt_get_extra_info_descriptor_string.
This patch is by asn.
https://trac.torproject.org/projects/tor/ticket/7011#comment:11
-rw-r--r-- | src/or/transports.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/or/transports.c b/src/or/transports.c index 56ab6005f0..1586213367 100644 --- a/src/or/transports.c +++ b/src/or/transports.c @@ -1384,19 +1384,21 @@ pt_get_extra_info_descriptor_string(void) /* 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 *addr_str = fmt_and_decorate_addr(&t->addr); + 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) { - /* returned addr was 0.0.0.0 and we found our external IP - address: use it. */ - addr_str = fmt_addr32(external_ip_address); + tor_addr_t addr; + tor_addr_from_ipv4h(&addr, external_ip_address); + addrport = fmt_addrport(&addr, t->port); + } else { + addrport = fmt_addrport(&t->addr, t->port); } smartlist_add_asprintf(string_chunks, - "transport %s %s:%u", - t->name, addr_str, t->port); + "transport %s %s", + t->name, addrport); } SMARTLIST_FOREACH_END(t); } SMARTLIST_FOREACH_END(mp); |