diff options
author | Roger Dingledine <arma@torproject.org> | 2012-04-02 19:57:27 -0400 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2013-02-11 13:29:56 -0500 |
commit | dfbb12cabf958f0ff2a1004761c22fc093c73dd0 (patch) | |
tree | d901086ea46cddf8b80e9f0a6988ddb3797b501e /src | |
parent | 2b4d4ccb3d1ecf984012b39eb361307785b0c1c0 (diff) | |
download | tor-dfbb12cabf958f0ff2a1004761c22fc093c73dd0.tar tor-dfbb12cabf958f0ff2a1004761c22fc093c73dd0.tar.gz |
log the hostname that resolve_my_address() used to guess our IP
Diffstat (limited to 'src')
-rw-r--r-- | src/or/router.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/or/router.c b/src/or/router.c index 3fd8b3c07..6c05af917 100644 --- a/src/or/router.c +++ b/src/or/router.c @@ -2089,6 +2089,8 @@ check_descriptor_ipaddress_changed(time_t now) { uint32_t prev, cur; const or_options_t *options = get_options(); + char *hostname = NULL; + (void) now; if (!desc_routerinfo) @@ -2096,18 +2098,26 @@ check_descriptor_ipaddress_changed(time_t now) /* XXXX ipv6 */ prev = desc_routerinfo->addr; - if (resolve_my_address(LOG_INFO, options, &cur, NULL) < 0) { + if (resolve_my_address(LOG_INFO, options, &cur, &hostname) < 0) { log_info(LD_CONFIG,"options->Address didn't resolve into an IP."); return; } if (prev != cur) { + char *source; tor_addr_t tmp_prev, tmp_cur; + tor_addr_from_ipv4h(&tmp_prev, prev); tor_addr_from_ipv4h(&tmp_cur, cur); - log_addr_has_changed(LOG_NOTICE, &tmp_prev, &tmp_cur, "resolve"); + + tor_asprintf(&source, "resolved from %s", hostname); + log_addr_has_changed(LOG_NOTICE, &tmp_prev, &tmp_cur, source); + tor_free(source); + ip_address_changed(0); } + + tor_free(hostname); } /** The most recently guessed value of our IP address, based on directory |