[tor-commits] [tor/release-0.4.4] Handle a failure edge-case when a client-side intro circ opens.

dgoulet at torproject.org dgoulet at torproject.org
Thu Jul 9 11:29:22 UTC 2020


commit e0da64fd27a8c1a34668dfa337877c0aeb398022
Author: George Kadianakis <desnacked at riseup.net>
Date:   Fri Jul 3 16:06:17 2020 +0300

    Handle a failure edge-case when a client-side intro circ opens.
---
 changes/bug34084           |  3 +++
 src/feature/hs/hs_client.c | 17 ++++++++++++-----
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/changes/bug34084 b/changes/bug34084
new file mode 100644
index 000000000..524c4cf68
--- /dev/null
+++ b/changes/bug34084
@@ -0,0 +1,3 @@
+  o Minor bugfixes (onion services v3):
+    - Avoid a non-fatal assert log in an edge-case of opening an intro circuit
+      as a client. Fixes bug 34084; bugfix on 0.3.2.1-alpha.
diff --git a/src/feature/hs/hs_client.c b/src/feature/hs/hs_client.c
index c3697d0c1..a49999d7d 100644
--- a/src/feature/hs/hs_client.c
+++ b/src/feature/hs/hs_client.c
@@ -704,8 +704,11 @@ send_introduce1(origin_circuit_t *intro_circ,
 }
 
 /** Using the introduction circuit circ, setup the authentication key of the
- * intro point this circuit has extended to. */
-static void
+ * intro point this circuit has extended to.
+ *
+ * Return 0 if everything went well, otherwise return -1 in the case of errors.
+ */
+static int
 setup_intro_circ_auth_key(origin_circuit_t *circ)
 {
   const hs_descriptor_t *desc;
@@ -736,10 +739,12 @@ setup_intro_circ_auth_key(origin_circuit_t *circ)
 
   /* Reaching this point means we didn't find any intro point for this circuit
    * which is not supposed to happen. */
-  tor_assert_nonfatal_unreached();
+  circuit_mark_for_close(TO_CIRCUIT(circ), END_CIRC_REASON_INTERNAL);
+  log_info(LD_REND, "Could not match opened intro circuit with intro point.");
+  return -1;
 
  end:
-  return;
+  return 0;
 }
 
 /** Called when an introduction circuit has opened. */
@@ -754,7 +759,9 @@ client_intro_circ_has_opened(origin_circuit_t *circ)
   /* This is an introduction circuit so we'll attach the correct
    * authentication key to the circuit identifier so it can be identified
    * properly later on. */
-  setup_intro_circ_auth_key(circ);
+  if (setup_intro_circ_auth_key(circ) < 0) {
+    return;
+  }
 
   connection_ap_attach_pending(1);
 }





More information about the tor-commits mailing list