Skip to content
Snippets Groups Projects
Commit b448ec19 authored by Nick Mathewson's avatar Nick Mathewson :game_die:
Browse files

Clear the cached address from resolve_my_address() when our IP changes

Closes 11582; patch from "ra".
parent e440993f
No related branches found
No related tags found
No related merge requests found
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
......@@ -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.
*
......
......@@ -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);
......
......@@ -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);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment