]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Build circuits more readily when DisableNetwork goes to 0
authorRoger Dingledine <arma@torproject.org>
Tue, 5 Aug 2014 20:54:46 +0000 (16:54 -0400)
committerRoger Dingledine <arma@torproject.org>
Wed, 6 Aug 2014 22:30:14 +0000 (18:30 -0400)
When Tor starts with DisabledNetwork set, it would correctly
conclude that it shouldn't try making circuits, but it would
mistakenly cache this conclusion and continue believing it even
when DisableNetwork is set to 0. Fixes the bug introduced by the
fix for bug 11200; bugfix on 0.2.5.4-alpha.

changes/bug11200-caching [new file with mode: 0644]
src/or/nodelist.c

diff --git a/changes/bug11200-caching b/changes/bug11200-caching
new file mode 100644 (file)
index 0000000..e3fbaec
--- /dev/null
@@ -0,0 +1,7 @@
+  o Major bugfixes:
+    - When Tor starts with DisabledNetwork set, it would correctly
+      conclude that it shouldn't try making circuits, but it would
+      mistakenly cache this conclusion and continue believing it even
+      when DisableNetwork is set to 0. Fixes the bug introduced by the
+      fix for bug 11200; bugfix on 0.2.5.4-alpha.
+
index 8f870816d26a63cc85c7c8a2fb4822c4e212bab0..7b1f338bd475e394fcfcc8ba4b8647d5ffd10820 100644 (file)
@@ -1275,10 +1275,21 @@ static char dir_info_status[256] = "";
 int
 router_have_minimum_dir_info(void)
 {
+  static int logged_delay=0;
+  const char *delay_fetches_msg = NULL;
+  if (should_delay_dir_fetches(get_options(), &delay_fetches_msg)) {
+    if (!logged_delay)
+      log_notice(LD_DIR, "Delaying directory fetches: %s", delay_fetches_msg);
+    logged_delay=1;
+    strlcpy(dir_info_status, delay_fetches_msg,  sizeof(dir_info_status));
+    return 0;
+  }
+  logged_delay = 0; /* reset it if we get this far */
+
   if (PREDICT_UNLIKELY(need_to_update_have_min_dir_info)) {
     update_router_have_minimum_dir_info();
-    need_to_update_have_min_dir_info = 0;
   }
+
   return have_min_dir_info;
 }
 
@@ -1498,7 +1509,6 @@ update_router_have_minimum_dir_info(void)
   const networkstatus_t *consensus =
     networkstatus_get_reasonably_live_consensus(now,usable_consensus_flavor());
   int using_md;
-  const char *delay_fetches_msg = NULL;
 
   if (!consensus) {
     if (!networkstatus_get_latest_consensus())
@@ -1511,13 +1521,6 @@ update_router_have_minimum_dir_info(void)
     goto done;
   }
 
-  if (should_delay_dir_fetches(get_options(), &delay_fetches_msg)) {
-    log_notice(LD_DIR, "Delaying directory fetches: %s", delay_fetches_msg);
-    strlcpy(dir_info_status, delay_fetches_msg,  sizeof(dir_info_status));
-    res = 0;
-    goto done;
-  }
-
   using_md = consensus->flavor == FLAV_MICRODESC;
 
   {