]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
circuit: Don't timeout opened C_INTRODUCING circuit
authorDavid Goulet <dgoulet@torproject.org>
Tue, 14 Nov 2017 14:01:21 +0000 (09:01 -0500)
committerNick Mathewson <nickm@torproject.org>
Mon, 20 Nov 2017 13:33:44 +0000 (08:33 -0500)
A circuit with purpose C_INTRODUCING means that its state is opened but the
INTRODUCE1 cell hasn't been sent yet. We shouldn't consider that circuit when
looking for timing out "building circuit". We have to wait on the rendezvous
circuit to be opened before sending that cell so the intro circuit needs to be
kept alive for at least that period of time.

This patch makes that the purpose C_INTRODUCING is ignored in the
circuit_expire_building() which means that we let the circuit idle timeout
take care of it if we end up never using it.

Fixes #23681

Signed-off-by: David Goulet <dgoulet@torproject.org>
changes/bug23681 [new file with mode: 0644]
src/or/circuituse.c

diff --git a/changes/bug23681 b/changes/bug23681
new file mode 100644 (file)
index 0000000..e317f36
--- /dev/null
@@ -0,0 +1,5 @@
+  o Minor bugfixes (hidden service client):
+    - The introduction circuit was being timed out too quickly while waiting
+      for the rendezvous circuit to complete. Keep the intro circuit around
+      longer instead of timing out and reopening new ones constantly. Fixes
+      bug 23681; bugfix on 0.2.4.8-alpha.
index 84574cd5b94396d46b116b489e5dc07548f88f0a..311142a7040dba6e03fe4037329deac4d8ca71b0 100644 (file)
@@ -494,8 +494,7 @@ circuit_expire_building(void)
       cutoff = begindir_cutoff;
     else if (victim->purpose == CIRCUIT_PURPOSE_C_MEASURE_TIMEOUT)
       cutoff = close_cutoff;
-    else if (victim->purpose == CIRCUIT_PURPOSE_C_INTRODUCING ||
-             victim->purpose == CIRCUIT_PURPOSE_C_INTRODUCE_ACK_WAIT)
+    else if (victim->purpose == CIRCUIT_PURPOSE_C_INTRODUCE_ACK_WAIT)
       cutoff = c_intro_cutoff;
     else if (victim->purpose == CIRCUIT_PURPOSE_S_ESTABLISH_INTRO)
       cutoff = s_intro_cutoff;
@@ -614,12 +613,13 @@ circuit_expire_building(void)
           TO_ORIGIN_CIRCUIT(victim)->path_state = PATH_STATE_USE_FAILED;
           break;
         case CIRCUIT_PURPOSE_C_INTRODUCING:
-          /* We keep old introducing circuits around for
-           * a while in parallel, and they can end up "opened".
-           * We decide below if we're going to mark them timed
-           * out and eventually close them.
-           */
-          break;
+          /* That purpose means that the intro point circuit has been opened
+           * succesfully but the INTRODUCE1 cell hasn't been sent yet because
+           * the client is waiting for the rendezvous point circuit to open.
+           * Keep this circuit open while waiting for the rendezvous circuit.
+           * We let the circuit idle timeout take care of cleaning this
+           * circuit if it never used. */
+          continue;
         case CIRCUIT_PURPOSE_C_ESTABLISH_REND:
         case CIRCUIT_PURPOSE_C_REND_READY_INTRO_ACKED:
         case CIRCUIT_PURPOSE_C_INTRODUCE_ACK_WAIT:
@@ -713,8 +713,6 @@ circuit_expire_building(void)
             NULL)
           break;
         /* fallthrough! */
-      case CIRCUIT_PURPOSE_C_INTRODUCING:
-        /* connection_ap_handshake_attach_circuit() will relaunch for us */
       case CIRCUIT_PURPOSE_C_INTRODUCE_ACK_WAIT:
       case CIRCUIT_PURPOSE_C_REND_READY_INTRO_ACKED:
         /* If we have reached this line, we want to spare the circ for now. */