mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-13 06:33:44 +01:00
Merge remote-tracking branch 'arma/bug1992'
This commit is contained in:
commit
41e0f7146a
11
changes/bug1992
Normal file
11
changes/bug1992
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
o Minor bugfixes:
|
||||||
|
- Stop trying to resolve our hostname so often (e.g. every time we
|
||||||
|
think about doing a directory fetch). Now we reuse the cached
|
||||||
|
answer in some cases. Fixes bugs 1992 (bugfix on 0.2.0.20-rc)
|
||||||
|
and 2410 (bugfix on 0.1.2.2-alpha).
|
||||||
|
|
||||||
|
o Minor features:
|
||||||
|
- Make bridge relays check once a minute for whether their IP
|
||||||
|
address has changed, rather than only every 15 minutes. Resolves
|
||||||
|
bugs 1913 and 1992.
|
||||||
|
|
@ -1893,6 +1893,13 @@ list_torrc_options(void)
|
|||||||
|
|
||||||
/** Last value actually set by resolve_my_address. */
|
/** Last value actually set by resolve_my_address. */
|
||||||
static uint32_t last_resolved_addr = 0;
|
static uint32_t last_resolved_addr = 0;
|
||||||
|
|
||||||
|
/** Accessor for last_resolved_addr from outside this file. */
|
||||||
|
uint32_t get_last_resolved_addr(void)
|
||||||
|
{
|
||||||
|
return last_resolved_addr;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use <b>options-\>Address</b> to guess our public IP address.
|
* Use <b>options-\>Address</b> to guess our public IP address.
|
||||||
*
|
*
|
||||||
|
@ -26,6 +26,7 @@ const char *get_short_version(void);
|
|||||||
setopt_err_t options_trial_assign(config_line_t *list, int use_defaults,
|
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);
|
||||||
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);
|
||||||
|
@ -1157,7 +1157,6 @@ run_scheduled_events(time_t now)
|
|||||||
static time_t time_to_check_v3_certificate = 0;
|
static time_t time_to_check_v3_certificate = 0;
|
||||||
static time_t time_to_check_listeners = 0;
|
static time_t time_to_check_listeners = 0;
|
||||||
static time_t time_to_check_descriptor = 0;
|
static time_t time_to_check_descriptor = 0;
|
||||||
static time_t time_to_check_ipaddress = 0;
|
|
||||||
static time_t time_to_shrink_memory = 0;
|
static time_t time_to_shrink_memory = 0;
|
||||||
static time_t time_to_try_getting_descriptors = 0;
|
static time_t time_to_try_getting_descriptors = 0;
|
||||||
static time_t time_to_reset_descriptor_failures = 0;
|
static time_t time_to_reset_descriptor_failures = 0;
|
||||||
@ -1403,11 +1402,10 @@ run_scheduled_events(time_t now)
|
|||||||
/** 2. Periodically, we consider force-uploading our descriptor
|
/** 2. Periodically, we consider force-uploading our descriptor
|
||||||
* (if we've passed our internal checks). */
|
* (if we've passed our internal checks). */
|
||||||
|
|
||||||
/** How often do we check whether part of our router info has changed in a way
|
/** How often do we check whether part of our router info has changed in a
|
||||||
* that would require an upload? */
|
* way that would require an upload? That includes checking whether our IP
|
||||||
|
* address has changed. */
|
||||||
#define CHECK_DESCRIPTOR_INTERVAL (60)
|
#define CHECK_DESCRIPTOR_INTERVAL (60)
|
||||||
/** How often do we (as a router) check whether our IP address has changed? */
|
|
||||||
#define CHECK_IPADDRESS_INTERVAL (15*60)
|
|
||||||
|
|
||||||
/* 2b. Once per minute, regenerate and upload the descriptor if the old
|
/* 2b. Once per minute, regenerate and upload the descriptor if the old
|
||||||
* one is inaccurate. */
|
* one is inaccurate. */
|
||||||
@ -1415,10 +1413,7 @@ run_scheduled_events(time_t now)
|
|||||||
static int dirport_reachability_count = 0;
|
static int dirport_reachability_count = 0;
|
||||||
time_to_check_descriptor = now + CHECK_DESCRIPTOR_INTERVAL;
|
time_to_check_descriptor = now + CHECK_DESCRIPTOR_INTERVAL;
|
||||||
check_descriptor_bandwidth_changed(now);
|
check_descriptor_bandwidth_changed(now);
|
||||||
if (time_to_check_ipaddress < now) {
|
check_descriptor_ipaddress_changed(now);
|
||||||
time_to_check_ipaddress = now + CHECK_IPADDRESS_INTERVAL;
|
|
||||||
check_descriptor_ipaddress_changed(now);
|
|
||||||
}
|
|
||||||
mark_my_descriptor_dirty_if_too_old(now);
|
mark_my_descriptor_dirty_if_too_old(now);
|
||||||
consider_publishable_server(0);
|
consider_publishable_server(0);
|
||||||
/* also, check religiously for reachability, if it's within the first
|
/* also, check religiously for reachability, if it's within the first
|
||||||
|
@ -1712,7 +1712,9 @@ static int router_guess_address_from_dir_headers(uint32_t *guess);
|
|||||||
int
|
int
|
||||||
router_pick_published_address(const or_options_t *options, uint32_t *addr)
|
router_pick_published_address(const or_options_t *options, uint32_t *addr)
|
||||||
{
|
{
|
||||||
if (resolve_my_address(LOG_INFO, options, addr, NULL, NULL) < 0) {
|
*addr = get_last_resolved_addr();
|
||||||
|
if (!*addr &&
|
||||||
|
resolve_my_address(LOG_INFO, options, addr, NULL, NULL) < 0) {
|
||||||
log_info(LD_CONFIG, "Could not determine our address locally. "
|
log_info(LD_CONFIG, "Could not determine our address locally. "
|
||||||
"Checking if directory headers provide any hints.");
|
"Checking if directory headers provide any hints.");
|
||||||
if (router_guess_address_from_dir_headers(addr) < 0) {
|
if (router_guess_address_from_dir_headers(addr) < 0) {
|
||||||
@ -2159,7 +2161,9 @@ router_new_address_suggestion(const char *suggestion,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* XXXX ipv6 */
|
/* XXXX ipv6 */
|
||||||
if (resolve_my_address(LOG_INFO, options, &cur, NULL, NULL) >= 0) {
|
cur = get_last_resolved_addr();
|
||||||
|
if (cur ||
|
||||||
|
resolve_my_address(LOG_INFO, options, &cur, NULL, NULL) >= 0) {
|
||||||
/* We're all set -- we already know our address. Great. */
|
/* We're all set -- we already know our address. Great. */
|
||||||
tor_addr_from_ipv4h(&last_guessed_ip, cur); /* store it in case we
|
tor_addr_from_ipv4h(&last_guessed_ip, cur); /* store it in case we
|
||||||
need it later */
|
need it later */
|
||||||
|
@ -3951,7 +3951,8 @@ trusted_dir_server_new(const char *nickname, const char *address,
|
|||||||
dir_server_t *result;
|
dir_server_t *result;
|
||||||
|
|
||||||
if (!address) { /* The address is us; we should guess. */
|
if (!address) { /* The address is us; we should guess. */
|
||||||
if (resolve_my_address(LOG_WARN, get_options(), &a, NULL, &hostname) < 0) {
|
if (resolve_my_address(LOG_WARN, get_options(),
|
||||||
|
&a, NULL, &hostname) < 0) {
|
||||||
log_warn(LD_CONFIG,
|
log_warn(LD_CONFIG,
|
||||||
"Couldn't find a suitable address when adding ourself as a "
|
"Couldn't find a suitable address when adding ourself as a "
|
||||||
"trusted directory server.");
|
"trusted directory server.");
|
||||||
|
Loading…
Reference in New Issue
Block a user