[or-cvs] r9671: Backport: Fix a bug found by Udo van den Heuvel: avoid an as (in tor/branches/tor-0_1_1-patches: . src/or)

nickm at seul.org nickm at seul.org
Wed Feb 28 00:23:24 UTC 2007


Author: nickm
Date: 2007-02-27 19:23:22 -0500 (Tue, 27 Feb 2007)
New Revision: 9671

Modified:
   tor/branches/tor-0_1_1-patches/
   tor/branches/tor-0_1_1-patches/ChangeLog
   tor/branches/tor-0_1_1-patches/src/or/circuitbuild.c
Log:
 r11972 at catbus:  nickm | 2007-02-27 19:20:52 -0500
 Backport: Fix a bug found by Udo van den Heuvel: avoid an assertion failure when a controller sets and clears EntryNodes before the next call to choose_random_entry().



Property changes on: tor/branches/tor-0_1_1-patches
___________________________________________________________________
 svk:merge ticket from /tor/011 [r11972] on 8246c3cf-6607-4228-993b-4d95d33730f1

Modified: tor/branches/tor-0_1_1-patches/ChangeLog
===================================================================
--- tor/branches/tor-0_1_1-patches/ChangeLog	2007-02-28 00:23:17 UTC (rev 9670)
+++ tor/branches/tor-0_1_1-patches/ChangeLog	2007-02-28 00:23:22 UTC (rev 9671)
@@ -24,6 +24,8 @@
       and hup, stop triggering an assert based on an empty onion_key.
     - Downgrade the harmless "dropping unrecognized descriptor" message from
       WARN to INFO.
+    - Fix an assert that could trigger if a controller quickly set then
+      cleared EntryNodes.  (Bug found by Udo van den Heuvel.)
 
 
 Changes in version 0.1.1.26 - 2006-12-14

Modified: tor/branches/tor-0_1_1-patches/src/or/circuitbuild.c
===================================================================
--- tor/branches/tor-0_1_1-patches/src/or/circuitbuild.c	2007-02-28 00:23:17 UTC (rev 9670)
+++ tor/branches/tor-0_1_1-patches/src/or/circuitbuild.c	2007-02-28 00:23:22 UTC (rev 9671)
@@ -2170,8 +2170,16 @@
   smartlist_t *tmp = smartlist_create();
 
   tor_assert(entry_guards);
-  tor_assert(options->EntryNodes);
 
+  if (!options->EntryNodes) {
+    /* It's possible that a controller set EntryNodes, thus making
+     * should_add_entry_nodes set, then cleared it again, all before the
+     * call to choose_random_entry() that triggered us. If so, just return.
+     */
+    should_add_entry_nodes = 0;
+    return;
+  }
+
   if (options->StrictEntryNodes) {
     log_info(LD_CIRC,"Clearing old entry guards");
     SMARTLIST_FOREACH(entry_guards, entry_guard_t *, e, tor_free(e));



More information about the tor-commits mailing list