r9396@totoro: nickm | 2006-11-26 13:36:29 -0500

Fix router_new_address_suggestion() so it only changes last_guessed_ip() when it actually calls resolve_my_address(). (bug found by dev-girl)


svn:r8996
This commit is contained in:
Nick Mathewson 2006-11-26 18:36:51 +00:00
parent 80cc941c2d
commit 68142b18cd
2 changed files with 7 additions and 3 deletions

View File

@ -33,6 +33,8 @@ Changes in version 0.1.2.4-alpha - 2006-11-??
correctly in the Windows installer. correctly in the Windows installer.
- Avoid assert failure when our cached-routers file is empty on - Avoid assert failure when our cached-routers file is empty on
startup. startup.
- Don't corrupt last_guesssed_ip in router_new_address_suggestion() when
we're running as a client.
Changes in version 0.1.2.3-alpha - 2006-10-29 Changes in version 0.1.2.3-alpha - 2006-10-29

View File

@ -1009,7 +1009,7 @@ static uint32_t last_guessed_ip = 0;
void void
router_new_address_suggestion(const char *suggestion) router_new_address_suggestion(const char *suggestion)
{ {
uint32_t addr, cur; uint32_t addr, cur = 0;
struct in_addr in; struct in_addr in;
or_options_t *options = get_options(); or_options_t *options = get_options();
@ -1022,8 +1022,10 @@ router_new_address_suggestion(const char *suggestion)
log_debug(LD_DIR, "Got X-Your-Address-Is: %s.", suggestion); log_debug(LD_DIR, "Got X-Your-Address-Is: %s.", suggestion);
if (!server_mode(options) || if (!server_mode(options))
resolve_my_address(LOG_INFO, options, &cur, NULL) >= 0) { return;
if (resolve_my_address(LOG_INFO, options, &cur, NULL) >= 0) {
/* We're all set -- we already know our address. Great. */ /* We're all set -- we already know our address. Great. */
last_guessed_ip = cur; /* store it in case we need it later */ last_guessed_ip = cur; /* store it in case we need it later */
return; return;