aboutsummaryrefslogtreecommitdiff
path: root/src/or/routerlist.c
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2013-02-10 16:45:48 -0500
committerRoger Dingledine <arma@torproject.org>2013-02-11 13:29:56 -0500
commit92ea0b86de30dafe392a2dcd2eb12d9ab83114a7 (patch)
tree1cfb1df27350e7750914b3557ce1c811de4bb440 /src/or/routerlist.c
parentdfbb12cabf958f0ff2a1004761c22fc093c73dd0 (diff)
downloadtor-92ea0b86de30dafe392a2dcd2eb12d9ab83114a7.tar
tor-92ea0b86de30dafe392a2dcd2eb12d9ab83114a7.tar.gz
Refactor resolve_my_address() so logs are more accurate / helpful
It returns the method by which we decided our public IP address (explicitly configured, resolved from explicit hostname, guessed from interfaces, learned by gethostname). Now we can provide more helpful log messages when a relay guesses its IP address incorrectly (e.g. due to unexpected lines in /etc/hosts). Resolves ticket 2267. While we're at it, stop sending a stray "(null)" in some cases for the server status "EXTERNAL_ADDRESS" controller event. Resolves bug 8200.
Diffstat (limited to 'src/or/routerlist.c')
-rw-r--r--src/or/routerlist.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index 8f1994760..90b707bcd 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -3951,12 +3951,14 @@ trusted_dir_server_new(const char *nickname, const char *address,
dir_server_t *result;
if (!address) { /* The address is us; we should guess. */
- if (resolve_my_address(LOG_WARN, get_options(), &a, &hostname) < 0) {
+ if (resolve_my_address(LOG_WARN, get_options(), &a, NULL, &hostname) < 0) {
log_warn(LD_CONFIG,
"Couldn't find a suitable address when adding ourself as a "
"trusted directory server.");
return NULL;
}
+ if (!hostname)
+ hostname = tor_dup_ip(a);
} else {
if (tor_lookup_hostname(address, &a)) {
log_warn(LD_CONFIG,