[or-cvs] r17179: {tor} Fix an assertion failure on double-marked circuits, and a do (in tor/trunk: . src/or)

nickm at seul.org nickm at seul.org
Sat Nov 1 20:27:41 UTC 2008


Author: nickm
Date: 2008-11-01 16:27:41 -0400 (Sat, 01 Nov 2008)
New Revision: 17179

Modified:
   tor/trunk/ChangeLog
   tor/trunk/src/or/circuitlist.c
   tor/trunk/src/or/circuituse.c
Log:
Fix an assertion failure on double-marked circuits, and a double-mark.

Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog	2008-11-01 14:25:57 UTC (rev 17178)
+++ tor/trunk/ChangeLog	2008-11-01 20:27:41 UTC (rev 17179)
@@ -1,4 +1,4 @@
-Changes in version 0.2.1.7-alpha - 2008-10-xx
+Changes in version 0.2.1.7-alpha - 2008-11-xx
   o Security fixes:
     - The "ClientDNSRejectInternalAddresses" config option wasn't being
       consistently obeyed: if an exit relay refuses a stream because its
@@ -120,6 +120,8 @@
     - Make TrackHostExit mappings expire a while after their last use, not
       after their creation.  Patch from Robert Hogan.
     - Provide circuit purposes along with circuit events to the controller.
+    - Make the assert_circuit_ok() function work correctly on circuits that
+      have already been marked for close.
 
   o Minor bugfixes:
     - Fix compile on OpenBSD 4.4-current. Bugfix on 0.2.1.5-alpha.

Modified: tor/trunk/src/or/circuitlist.c
===================================================================
--- tor/trunk/src/or/circuitlist.c	2008-11-01 14:25:57 UTC (rev 17178)
+++ tor/trunk/src/or/circuitlist.c	2008-11-01 20:27:41 UTC (rev 17179)
@@ -1208,13 +1208,21 @@
   if (c->n_conn) {
     tor_assert(!c->n_hop);
 
-    if (c->n_circ_id)
-      tor_assert(c == circuit_get_by_circid_orconn(c->n_circ_id, c->n_conn));
+    if (c->n_circ_id) {
+      /* We use the _impl variant here to make sure we don't fail on marked
+       * circuits, which would not be returned by the regular function. */
+      circuit_t *c2 = circuit_get_by_circid_orconn_impl(c->n_circ_id,
+                                                        c->n_conn);
+      tor_assert(c == c2);
+    }
   }
   if (or_circ && or_circ->p_conn) {
-    if (or_circ->p_circ_id)
-      tor_assert(c == circuit_get_by_circid_orconn(or_circ->p_circ_id,
-                                                   or_circ->p_conn));
+    if (or_circ->p_circ_id) {
+      /* ibid */
+      circuit_t *c2 = circuit_get_by_circid_orconn_impl(or_circ->p_circ_id,
+                                                        or_circ->p_conn);
+      tor_assert(c == c2);
+    }
   }
 #if 0 /* false now that rendezvous exits are attached to p_streams */
   if (origin_circ)

Modified: tor/trunk/src/or/circuituse.c
===================================================================
--- tor/trunk/src/or/circuituse.c	2008-11-01 14:25:57 UTC (rev 17178)
+++ tor/trunk/src/or/circuituse.c	2008-11-01 20:27:41 UTC (rev 17179)
@@ -1495,7 +1495,7 @@
       /* abort parallel intro circs, if any */
       for (c = global_circuitlist; c; c = c->next) {
         if (c->purpose == CIRCUIT_PURPOSE_C_INTRODUCING &&
-            CIRCUIT_IS_ORIGIN(c)) {
+            !c->marked_for_close && CIRCUIT_IS_ORIGIN(c)) {
           origin_circuit_t *oc = TO_ORIGIN_CIRCUIT(c);
           if (oc->rend_data &&
               !rend_cmp_service_ids(conn->rend_data->onion_address,



More information about the tor-commits mailing list