summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2020-06-04 10:33:36 -0400
committerNick Mathewson <nickm@torproject.org>2020-06-04 10:33:36 -0400
commit2b98df3c7478b03c82f2d284dad18ba33fe8c41c (patch)
tree32dd47b691d022ba5d5c0add5995211c6983494d
parent284e9459b8840bdf9865e756a0bb0e63e56bae77 (diff)
parent8b568b50a5054f5e94d7085682e717b4eab58ce5 (diff)
downloadtor-2b98df3c7478b03c82f2d284dad18ba33fe8c41c.tar.gz
tor-2b98df3c7478b03c82f2d284dad18ba33fe8c41c.zip
Merge remote-tracking branch 'tor-github/pr/1910/head'
-rw-r--r--src/app/config/resolve_addr.c6
-rw-r--r--src/lib/net/address.c6
2 files changed, 11 insertions, 1 deletions
diff --git a/src/app/config/resolve_addr.c b/src/app/config/resolve_addr.c
index b551615c02..52f4efc992 100644
--- 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
index b8f5f37747..b09c9115c4 100644
--- 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);