[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] Move circuit-id-in-use check for CREATE cells to before all other checks



commit af53e4bd1c9aa655ce4faacb957ad7603b9c4825
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Tue Jun 10 22:41:13 2014 -0400

    Move circuit-id-in-use check for CREATE cells to before all other checks
    
    This means that we never send a DESTROY cell in response to an attempt
    to CREATE an existing circuit.  Fixes bug 12191.
---
 changes/bug12191 |    6 ++++++
 src/or/command.c |   34 +++++++++++++++++-----------------
 2 files changed, 23 insertions(+), 17 deletions(-)

diff --git a/changes/bug12191 b/changes/bug12191
new file mode 100644
index 0000000..7fe1c55
--- /dev/null
+++ b/changes/bug12191
@@ -0,0 +1,6 @@
+  o Minor bugfixes:
+
+    - We now drop CREATE cells for already-existent circuit IDs, regardless
+      of other factors that might otherwise have called for DESTROY cells.
+      Fixes bug 12191; bugfix on 0.2.???
+
diff --git a/src/or/command.c b/src/or/command.c
index 105bdc6..51fb640 100644
--- a/src/or/command.c
+++ b/src/or/command.c
@@ -227,6 +227,23 @@ command_process_create_cell(cell_t *cell, channel_t *chan)
             (unsigned)cell->circ_id,
             U64_PRINTF_ARG(chan->global_identifier), chan);
 
+  if (circuit_id_in_use_on_channel(cell->circ_id, chan)) {
+    const node_t *node = node_get_by_id(chan->identity_digest);
+    log_fn(LOG_PROTOCOL_WARN, LD_PROTOCOL,
+           "Received CREATE cell (circID %u) for known circ. "
+           "Dropping (age %d).",
+           (unsigned)cell->circ_id,
+           (int)(time(NULL) - channel_when_created(chan)));
+    if (node) {
+      char *p = esc_for_log(node_get_platform(node));
+      log_fn(LOG_PROTOCOL_WARN, LD_PROTOCOL,
+             "Details: router %s, platform %s.",
+             node_describe(node), p);
+      tor_free(p);
+    }
+    return;
+  }
+
   if (we_are_hibernating()) {
     log_info(LD_OR,
              "Received create cell but we're shutting down. Sending back "
@@ -274,23 +291,6 @@ command_process_create_cell(cell_t *cell, channel_t *chan)
     return;
   }
 
-  if (circuit_id_in_use_on_channel(cell->circ_id, chan)) {
-    const node_t *node = node_get_by_id(chan->identity_digest);
-    log_fn(LOG_PROTOCOL_WARN, LD_PROTOCOL,
-           "Received CREATE cell (circID %u) for known circ. "
-           "Dropping (age %d).",
-           (unsigned)cell->circ_id,
-           (int)(time(NULL) - channel_when_created(chan)));
-    if (node) {
-      char *p = esc_for_log(node_get_platform(node));
-      log_fn(LOG_PROTOCOL_WARN, LD_PROTOCOL,
-             "Details: router %s, platform %s.",
-             node_describe(node), p);
-      tor_free(p);
-    }
-    return;
-  }
-
   circ = or_circuit_new(cell->circ_id, chan);
   circ->base_.purpose = CIRCUIT_PURPOSE_OR;
   circuit_set_state(TO_CIRCUIT(circ), CIRCUIT_STATE_ONIONSKIN_PENDING);



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits