aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2014-09-29 13:46:30 -0400
committerNick Mathewson <nickm@torproject.org>2014-09-29 13:47:58 -0400
commitb448ec195dd8687d2d5f363e12fec046eb2d1677 (patch)
treeb286291ff27b917acf8a12faf8160efca56dacd2 /src
parente440993f95fad6d5a049be83517c8586fff7ab21 (diff)
downloadtor-b448ec195dd8687d2d5f363e12fec046eb2d1677.tar.gz
tor-b448ec195dd8687d2d5f363e12fec046eb2d1677.zip
Clear the cached address from resolve_my_address() when our IP changes
Closes 11582; patch from "ra".
Diffstat (limited to 'src')
-rw-r--r--src/or/config.c7
-rw-r--r--src/or/config.h1
-rw-r--r--src/or/connection.c2
3 files changed, 10 insertions, 0 deletions
diff --git a/src/or/config.c b/src/or/config.c
index d620f585fe..921d032529 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -2037,6 +2037,13 @@ get_last_resolved_addr(void)
return last_resolved_addr;
}
+/** Reset last_resolved_addr from outside this file. */
+void
+reset_last_resolved_addr(void)
+{
+ last_resolved_addr = 0;
+}
+
/**
* Use <b>options-\>Address</b> to guess our public IP address.
*
diff --git a/src/or/config.h b/src/or/config.h
index 8a1919c2ed..fd95698144 100644
--- a/src/or/config.h
+++ b/src/or/config.h
@@ -29,6 +29,7 @@ setopt_err_t options_trial_assign(config_line_t *list, int use_defaults,
int clear_first, char **msg);
uint32_t get_last_resolved_addr(void);
+void reset_last_resolved_addr(void);
int resolve_my_address(int warn_severity, const or_options_t *options,
uint32_t *addr_out,
const char **method_out, char **hostname_out);
diff --git a/src/or/connection.c b/src/or/connection.c
index 4a3bd2cf03..5c1b6d9bba 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -4386,6 +4386,8 @@ client_check_address_changed(tor_socket_t sock)
SMARTLIST_FOREACH(outgoing_addrs, tor_addr_t*, a_ptr, tor_free(a_ptr));
smartlist_clear(outgoing_addrs);
smartlist_add(outgoing_addrs, tor_memdup(&out_addr, sizeof(tor_addr_t)));
+ /* We'll need to resolve ourselves again. */
+ reset_last_resolved_addr();
/* Okay, now change our keys. */
ip_address_changed(1);
}