tor

The Tor anonymity network
git clone https://git.dasho.dev/tor.git
Log | Files | Refs | README | LICENSE

commit 2b98df3c7478b03c82f2d284dad18ba33fe8c41c
parent 284e9459b8840bdf9865e756a0bb0e63e56bae77
Author: Nick Mathewson <nickm@torproject.org>
Date:   Thu,  4 Jun 2020 10:33:36 -0400

Merge remote-tracking branch 'tor-github/pr/1910/head'

Diffstat:
Msrc/app/config/resolve_addr.c | 6++++++
Msrc/lib/net/address.c | 6+++++-
2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/app/config/resolve_addr.c b/src/app/config/resolve_addr.c @@ -110,6 +110,8 @@ resolve_my_address(int warn_severity, const or_options_t *options, if (address && *address) { strlcpy(hostname, address, sizeof(hostname)); + log_debug(LD_CONFIG, "Trying configured Address '%s' as local hostname", + hostname); } else { /* then we need to guess our address */ explicit_ip = 0; /* it's implicit */ explicit_hostname = 0; /* it's implicit */ @@ -129,6 +131,8 @@ resolve_my_address(int warn_severity, const or_options_t *options, if (tor_inet_aton(hostname, &in) == 0) { /* then we have to resolve it */ + log_debug(LD_CONFIG, "Local hostname '%s' is DNS address. " + "Trying to resolve to IP address.", hostname); explicit_ip = 0; if (tor_lookup_hostname(hostname, &addr)) { /* failed to resolve */ uint32_t interface_ip; /* host order */ @@ -180,6 +184,8 @@ resolve_my_address(int warn_severity, const or_options_t *options, } } } else { + log_debug(LD_CONFIG, "Local hostname '%s' is already IP address, " + "skipping DNS resolution", hostname); addr = ntohl(in.s_addr); /* set addr so that addr_string is not * illformed */ } diff --git a/src/lib/net/address.c b/src/lib/net/address.c @@ -1694,11 +1694,15 @@ get_interface_address6,(int severity, sa_family_t family, tor_addr_t *addr)) * Ideally, we want the default route, see #12377 for details */ SMARTLIST_FOREACH_BEGIN(addrs, tor_addr_t *, a) { tor_addr_copy(addr, a); + const bool is_internal = tor_addr_is_internal(a, 0); rv = 0; + log_debug(LD_NET, "Found %s interface address '%s'", + (is_internal ? "internal" : "external"), fmt_addr(addr)); + /* If we found a non-internal address, declare success. Otherwise, * keep looking. */ - if (!tor_addr_is_internal(a, 0)) + if (!is_internal) break; } SMARTLIST_FOREACH_END(a);