diff options
-rw-r--r-- | changes/ticket11582 | 5 | ||||
-rw-r--r-- | src/or/config.c | 7 | ||||
-rw-r--r-- | src/or/config.h | 1 | ||||
-rw-r--r-- | src/or/connection.c | 2 |
4 files changed, 15 insertions, 0 deletions
diff --git a/changes/ticket11582 b/changes/ticket11582 new file mode 100644 index 0000000000..e54f77998e --- /dev/null +++ b/changes/ticket11582 @@ -0,0 +1,5 @@ + o Minor features: + - Re-check our address after we detect a changed IP address from + getsockname(). This ensures that the controller command "GETINFO + address" will report the correct value. Resolves ticket 11582. + Patch from "ra".
\ No newline at end of file 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); } |