mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-14 07:03:44 +01:00
Merge remote-tracking branch 'tor-github/pr/1910/head'
This commit is contained in:
commit
2b98df3c74
@ -110,6 +110,8 @@ resolve_my_address(int warn_severity, const or_options_t *options,
|
|||||||
|
|
||||||
if (address && *address) {
|
if (address && *address) {
|
||||||
strlcpy(hostname, address, sizeof(hostname));
|
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 */
|
} else { /* then we need to guess our address */
|
||||||
explicit_ip = 0; /* it's implicit */
|
explicit_ip = 0; /* it's implicit */
|
||||||
explicit_hostname = 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) {
|
if (tor_inet_aton(hostname, &in) == 0) {
|
||||||
/* then we have to resolve it */
|
/* 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;
|
explicit_ip = 0;
|
||||||
if (tor_lookup_hostname(hostname, &addr)) { /* failed to resolve */
|
if (tor_lookup_hostname(hostname, &addr)) { /* failed to resolve */
|
||||||
uint32_t interface_ip; /* host order */
|
uint32_t interface_ip; /* host order */
|
||||||
@ -180,6 +184,8 @@ resolve_my_address(int warn_severity, const or_options_t *options,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} 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
|
addr = ntohl(in.s_addr); /* set addr so that addr_string is not
|
||||||
* illformed */
|
* illformed */
|
||||||
}
|
}
|
||||||
|
@ -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 */
|
* Ideally, we want the default route, see #12377 for details */
|
||||||
SMARTLIST_FOREACH_BEGIN(addrs, tor_addr_t *, a) {
|
SMARTLIST_FOREACH_BEGIN(addrs, tor_addr_t *, a) {
|
||||||
tor_addr_copy(addr, a);
|
tor_addr_copy(addr, a);
|
||||||
|
const bool is_internal = tor_addr_is_internal(a, 0);
|
||||||
rv = 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,
|
/* If we found a non-internal address, declare success. Otherwise,
|
||||||
* keep looking. */
|
* keep looking. */
|
||||||
if (!tor_addr_is_internal(a, 0))
|
if (!is_internal)
|
||||||
break;
|
break;
|
||||||
} SMARTLIST_FOREACH_END(a);
|
} SMARTLIST_FOREACH_END(a);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user