summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2011-05-20 03:03:46 -0400
committerRoger Dingledine <arma@torproject.org>2011-05-20 03:03:46 -0400
commit0a4649e6576cacc07c215c481fd1c500cd563a3b (patch)
treecc16d185370864236316f3ce9d8db4bc702a3217
parenteecf8835fd8758a3f7a0837ff6c71d9e65d2dd5d (diff)
parentb8ffb00cf1ddf4ff1b64335f8677d600a948fffc (diff)
downloadtor-0a4649e6576cacc07c215c481fd1c500cd563a3b.tar.gz
tor-0a4649e6576cacc07c215c481fd1c500cd563a3b.zip
Merge branch 'maint-0.2.2'
-rw-r--r--changes/bug32524
-rw-r--r--src/or/config.c2
-rw-r--r--src/or/connection.c2
-rw-r--r--src/or/dns.c9
-rw-r--r--src/or/main.c2
-rw-r--r--src/or/router.c21
-rw-r--r--src/or/router.h2
7 files changed, 28 insertions, 14 deletions
diff --git a/changes/bug3252 b/changes/bug3252
new file mode 100644
index 0000000000..f85f633fbd
--- /dev/null
+++ b/changes/bug3252
@@ -0,0 +1,4 @@
+ o Minor features:
+ - Relays now log the reason for publishing a new relay descriptor,
+ so we have a better chance of hunting down the root cause of bug
+ 1810. Resolves ticket 3252.
diff --git a/src/or/config.c b/src/or/config.c
index 4fcbd625d3..016f831b83 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -1493,7 +1493,7 @@ options_act(or_options_t *old_options)
*/
if (!old_options ||
options_transition_affects_descriptor(old_options, options))
- mark_my_descriptor_dirty();
+ mark_my_descriptor_dirty("config change");
/* We may need to reschedule some directory stuff if our status changed. */
if (old_options) {
diff --git a/src/or/connection.c b/src/or/connection.c
index 4877a3cbf4..0a5bb8ccdd 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -3646,7 +3646,7 @@ alloc_http_authenticator(const char *authenticator)
tor_free(base64_authenticator); /* free and set to null */
} else {
int i = 0, j = 0;
- int len = strlen(base64_authenticator);
+ ssize_t len = strlen(base64_authenticator);
/* remove all newline occurrences within the string */
for (i=0; i < len; ++i) {
diff --git a/src/or/dns.c b/src/or/dns.c
index c8e1012524..a7fad3d690 100644
--- a/src/or/dns.c
+++ b/src/or/dns.c
@@ -1295,14 +1295,17 @@ configure_nameservers(int force)
nameservers_configured = 1;
if (nameserver_config_failed) {
nameserver_config_failed = 0;
- mark_my_descriptor_dirty();
+ /* XXX the three calls to republish the descriptor might be producing
+ * descriptors that are only cosmetically different, especially on
+ * non-exit relays! -RD */
+ mark_my_descriptor_dirty("dns resolvers back");
}
return 0;
err:
nameservers_configured = 0;
if (! nameserver_config_failed) {
nameserver_config_failed = 1;
- mark_my_descriptor_dirty();
+ mark_my_descriptor_dirty("dns resolvers failed");
}
return -1;
}
@@ -1522,7 +1525,7 @@ add_wildcarded_test_address(const char *address)
"broken.", address, n);
if (!dns_is_completely_invalid) {
dns_is_completely_invalid = 1;
- mark_my_descriptor_dirty();
+ mark_my_descriptor_dirty("dns hijacking confirmed");
}
if (!dns_wildcarded_test_address_notice_given)
control_event_server_status(LOG_WARN, "DNS_USELESS");
diff --git a/src/or/main.c b/src/or/main.c
index 1554e812cf..93fe2fd6c6 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -1603,7 +1603,7 @@ ip_address_changed(int at_interface)
reset_bandwidth_test();
stats_n_seconds_working = 0;
router_reset_reachability();
- mark_my_descriptor_dirty();
+ mark_my_descriptor_dirty("IP address changed");
}
}
diff --git a/src/or/router.c b/src/or/router.c
index e2791c1c64..8b2c797bb6 100644
--- a/src/or/router.c
+++ b/src/or/router.c
@@ -89,7 +89,7 @@ set_onion_key(crypto_pk_env_t *k)
onionkey = k;
onionkey_set_at = time(NULL);
tor_mutex_release(key_lock);
- mark_my_descriptor_dirty();
+ mark_my_descriptor_dirty("set onion key");
}
/** Return the current onion key. Requires that the onion key has been
@@ -276,7 +276,7 @@ rotate_onion_key(void)
now = time(NULL);
state->LastRotatedOnionKey = onionkey_set_at = now;
tor_mutex_release(key_lock);
- mark_my_descriptor_dirty();
+ mark_my_descriptor_dirty("rotated onion key");
or_state_mark_dirty(state, get_options()->AvoidDiskWrites ? now+3600 : 0);
goto done;
error:
@@ -914,7 +914,7 @@ router_orport_found_reachable(void)
get_options()->_PublishServerDescriptor != NO_DIRINFO ?
" Publishing server descriptor." : "");
can_reach_or_port = 1;
- mark_my_descriptor_dirty();
+ mark_my_descriptor_dirty("ORPort found reachable");
control_event_server_status(LOG_NOTICE,
"REACHABILITY_SUCCEEDED ORADDRESS=%s:%d",
me->address, me->or_port);
@@ -931,7 +931,7 @@ router_dirport_found_reachable(void)
"from the outside. Excellent.");
can_reach_dir_port = 1;
if (decide_to_advertise_dirport(get_options(), me->dir_port))
- mark_my_descriptor_dirty();
+ mark_my_descriptor_dirty("DirPort found reachable");
control_event_server_status(LOG_NOTICE,
"REACHABILITY_SUCCEEDED DIRADDRESS=%s:%d",
me->address, me->dir_port);
@@ -1238,6 +1238,10 @@ router_upload_dir_desc_to_dirservers(int force)
return;
if (!force && !desc_needs_upload)
return;
+
+ log_info(LD_OR, "Uploading relay descriptor to directory authorities%s",
+ force ? " (forced)" : "");
+
desc_needs_upload = 0;
desc_len = ri->cache_info.signed_descriptor_len;
@@ -1425,6 +1429,8 @@ router_rebuild_descriptor(int force)
return -1;
}
+ log_info(LD_OR, "Rebuilding relay descriptor%s", force ? " (forced)" : "");
+
ri = tor_malloc_zero(sizeof(routerinfo_t));
ri->cache_info.routerlist_index = -1;
ri->address = tor_dup_ip(addr);
@@ -1597,14 +1603,15 @@ void
mark_my_descriptor_dirty_if_older_than(time_t when)
{
if (desc_clean_since < when)
- mark_my_descriptor_dirty();
+ mark_my_descriptor_dirty("time for new descriptor");
}
/** Call when the current descriptor is out of date. */
void
-mark_my_descriptor_dirty(void)
+mark_my_descriptor_dirty(const char *reason)
{
desc_clean_since = 0;
+ log_info(LD_OR, "Decided to publish new relay descriptor: %s", reason);
}
/** How frequently will we republish our descriptor because of large (factor
@@ -1629,7 +1636,7 @@ check_descriptor_bandwidth_changed(time_t now)
if (last_changed+MAX_BANDWIDTH_CHANGE_FREQ < now) {
log_info(LD_GENERAL,
"Measured bandwidth has changed; rebuilding descriptor.");
- mark_my_descriptor_dirty();
+ mark_my_descriptor_dirty("bandwidth has changed");
last_changed = now;
}
}
diff --git a/src/or/router.h b/src/or/router.h
index d126ac9850..2e5d44f356 100644
--- a/src/or/router.h
+++ b/src/or/router.h
@@ -62,7 +62,7 @@ int should_refuse_unknown_exits(or_options_t *options);
void router_upload_dir_desc_to_dirservers(int force);
void mark_my_descriptor_dirty_if_older_than(time_t when);
-void mark_my_descriptor_dirty(void);
+void mark_my_descriptor_dirty(const char *reason);
void check_descriptor_bandwidth_changed(time_t now);
void check_descriptor_ipaddress_changed(time_t now);
void router_new_address_suggestion(const char *suggestion,