mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-28 14:23:30 +01:00
Clear the cached address from resolve_my_address() when our IP changes
Closes 11582; patch from "ra".
This commit is contained in:
parent
e440993f95
commit
b448ec195d
5
changes/ticket11582
Normal file
5
changes/ticket11582
Normal file
@ -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".
|
@ -2037,6 +2037,13 @@ get_last_resolved_addr(void)
|
|||||||
return last_resolved_addr;
|
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.
|
* 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);
|
int clear_first, char **msg);
|
||||||
|
|
||||||
uint32_t get_last_resolved_addr(void);
|
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,
|
int resolve_my_address(int warn_severity, const or_options_t *options,
|
||||||
uint32_t *addr_out,
|
uint32_t *addr_out,
|
||||||
const char **method_out, char **hostname_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_FOREACH(outgoing_addrs, tor_addr_t*, a_ptr, tor_free(a_ptr));
|
||||||
smartlist_clear(outgoing_addrs);
|
smartlist_clear(outgoing_addrs);
|
||||||
smartlist_add(outgoing_addrs, tor_memdup(&out_addr, sizeof(tor_addr_t)));
|
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. */
|
/* Okay, now change our keys. */
|
||||||
ip_address_changed(1);
|
ip_address_changed(1);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user