summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2008-04-22 21:11:00 +0000
committerNick Mathewson <nickm@torproject.org>2008-04-22 21:11:00 +0000
commitede6ac7c9d8fca76652c35122f863e6dd326b2a1 (patch)
treead99e8b30bbebe23723c993183d117c1106084b6
parent2e0bf9d8bf99f6e9959e9e3ec545600e968c62d0 (diff)
downloadtor-ede6ac7c9d8fca76652c35122f863e6dd326b2a1.tar.gz
tor-ede6ac7c9d8fca76652c35122f863e6dd326b2a1.zip
r15288@tombo: nickm | 2008-04-22 17:09:36 -0400
Backport: Periodically launch requests for server/authority.z when it might help us learn our IP. Fix for bug 652. svn:r14419
-rw-r--r--ChangeLog2
-rw-r--r--src/or/routerlist.c20
2 files changed, 22 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index b971fb6e10..5472ae6864 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -36,6 +36,8 @@ Changes in version 0.2.0.24-rc - 2008-04-0?
Patch from mwenge. Fixes bug 646.
- Correctly notify one-hop connections when a circuit build has
failed. Possible fix for bug 669. Found by lodger.
+ - Detect address changes correctly on non-directory mirror
+ servers. Fix for bug 652.
o Minor features (security):
- Reject requests for reverse-dns lookup of names in a private
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index 146b1457c1..891960d56a 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -3962,17 +3962,37 @@ update_consensus_router_descriptor_downloads(time_t now)
smartlist_free(no_longer_old);
}
+/** How often should we launch a server/authority request to be sure of getting
+ * a guess for our IP? */
+/*XXXX021 this info should come from netinfo cells or something, or we should
+ * do this only when we aren't seeing incoming data. see bug 652. */
+#define DUMMY_DOWNLOAD_INTERVAL (20*60)
+
/** Launch downloads for router status as needed. */
void
update_router_descriptor_downloads(time_t now)
{
or_options_t *options = get_options();
+ static time_t last_dummy_download = 0;
if (should_delay_dir_fetches(options))
return;
if (directory_fetches_dir_info_early(options)) {
update_router_descriptor_cache_downloads_v2(now);
}
update_consensus_router_descriptor_downloads(now);
+
+ /* XXXX021 we could be smarter here; see notes on bug 652. */
+ /* If we're a server that doesn't have a configured address, we rely on
+ * directory fetches to learn when our address changes. So if we haven't
+ * tried to get any routerdescs in a long time, try a dummy fetch now. */
+ if (!options->Address &&
+ server_mode(options) &&
+ last_routerdesc_download_attempted + DUMMY_DOWNLOAD_INTERVAL < now &&
+ last_dummy_download + DUMMY_DOWNLOAD_INTERVAL < now) {
+ last_dummy_download = now;
+ directory_get_from_dirserver(DIR_PURPOSE_FETCH_SERVERDESC,
+ ROUTER_PURPOSE_GENERAL, "authority.z", 1);
+ }
}
/** Launch extrainfo downloads as needed. */