summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2017-11-13 11:18:02 -0500
committerNick Mathewson <nickm@torproject.org>2017-11-13 11:18:02 -0500
commitf5bd987c7563e024d68cb5e49c181ca8ef37a774 (patch)
treed4af79075caaed5b9dd59517815dc5a0a61ce615
parent100ff4a9284379e8f49e52a80275d3281163afb4 (diff)
parent16bdb9e365ff43885a4d3b3478ebb224f5a26a33 (diff)
downloadtor-f5bd987c7563e024d68cb5e49c181ca8ef37a774.tar.gz
tor-f5bd987c7563e024d68cb5e49c181ca8ef37a774.zip
Merge branch 'maint-0.3.0' into release-0.3.0
-rw-r--r--changes/bug234706
-rw-r--r--src/or/directory.c22
2 files changed, 17 insertions, 11 deletions
diff --git a/changes/bug23470 b/changes/bug23470
new file mode 100644
index 0000000000..33367b3a30
--- /dev/null
+++ b/changes/bug23470
@@ -0,0 +1,6 @@
+ o Minor bugfix (relay address resolution):
+ - Avoid unnecessary calls to directory_fetches_from_authorities()
+ on relays. This avoids spurious address resolutions and
+ descriptor rebuilds. This is a mitigation for 21789. The original
+ bug was introduced in commit 35bbf2e as part of prop210.
+ Fixes 23470 in 0.2.8.1-alpha.
diff --git a/src/or/directory.c b/src/or/directory.c
index edd07af95c..534e3d6102 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -3978,26 +3978,24 @@ connection_dir_finished_connecting(dir_connection_t *conn)
STATIC const smartlist_t *
find_dl_schedule(download_status_t *dls, const or_options_t *options)
{
- const int dir_server = dir_server_mode(options);
- const int multi_d = networkstatus_consensus_can_use_multiple_directories(
- options);
- const int we_are_bootstrapping = networkstatus_consensus_is_bootstrapping(
- time(NULL));
- const int use_fallbacks = networkstatus_consensus_can_use_extra_fallbacks(
- options);
switch (dls->schedule) {
case DL_SCHED_GENERIC:
- if (dir_server) {
+ /* Any other directory document */
+ if (dir_server_mode(options)) {
+ /* A directory authority or directory mirror */
return options->TestingServerDownloadSchedule;
} else {
return options->TestingClientDownloadSchedule;
}
case DL_SCHED_CONSENSUS:
- if (!multi_d) {
+ if (!networkstatus_consensus_can_use_multiple_directories(options)) {
+ /* A public relay */
return options->TestingServerConsensusDownloadSchedule;
} else {
- if (we_are_bootstrapping) {
- if (!use_fallbacks) {
+ /* A client or bridge */
+ if (networkstatus_consensus_is_bootstrapping(time(NULL))) {
+ /* During bootstrapping */
+ if (!networkstatus_consensus_can_use_extra_fallbacks(options)) {
/* A bootstrapping client without extra fallback directories */
return
options->ClientBootstrapConsensusAuthorityOnlyDownloadSchedule;
@@ -4013,6 +4011,8 @@ find_dl_schedule(download_status_t *dls, const or_options_t *options)
options->ClientBootstrapConsensusFallbackDownloadSchedule;
}
} else {
+ /* A client with a reasonably live consensus, with or without
+ * certificates */
return options->TestingClientConsensusDownloadSchedule;
}
}