[tor-commits] [tor/master] hs-v3: Several fixes after #32542 review

asn at torproject.org asn at torproject.org
Thu Apr 9 11:00:19 UTC 2020


commit cca9e1c803161e41df418498e267605d855b7ac5
Author: David Goulet <dgoulet at torproject.org>
Date:   Wed Apr 8 09:58:17 2020 -0400

    hs-v3: Several fixes after #32542 review
    
    asn: Accidentally left this commit out when merging #32542, so cherry-picking
    it now.
    
    Signed-off-by: David Goulet <dgoulet at torproject.org>
---
 src/feature/hs/hs_client.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/feature/hs/hs_client.c b/src/feature/hs/hs_client.c
index cf2f165c9..f7294447b 100644
--- a/src/feature/hs/hs_client.c
+++ b/src/feature/hs/hs_client.c
@@ -970,6 +970,12 @@ intro_points_all_timed_out(const ed25519_public_key_t *service_pk)
   tor_assert(service_pk);
 
   const hs_descriptor_t *desc = hs_cache_lookup_as_client(service_pk);
+  if (BUG(!desc)) {
+    /* We can't introduce without a descriptor so ending up here means somehow
+     * between the introduction failure and this, the cache entry was removed
+     * which shouldn't be possible in theory. */
+    goto end;
+  }
 
   SMARTLIST_FOREACH_BEGIN(desc->encrypted_data.intro_points,
                           const hs_desc_intro_point_t *, ip) {
@@ -997,7 +1003,7 @@ intro_points_all_timed_out(const ed25519_public_key_t *service_pk)
  * error code so if the connection to the rendezvous point ends up not
  * working, this code could be sent back as a reason. */
 static void
-socks_report_rend_circuit_timed_out(const origin_circuit_t *rend_circ)
+socks_mark_rend_circuit_timed_out(const origin_circuit_t *rend_circ)
 {
   tor_assert(rend_circ);
 
@@ -1021,7 +1027,7 @@ socks_report_rend_circuit_timed_out(const origin_circuit_t *rend_circ)
  * SOCKS5_HS_INTRO_TIMEDOUT (0xF7) if all intros have timed out. The caller
  * has to make sure to close the entry connections. */
 static void
-socks_report_introduction_failed(entry_connection_t *conn,
+socks_mark_introduction_failed(entry_connection_t *conn,
                                  const ed25519_public_key_t *identity_pk)
 {
   socks5_reply_status_t code = SOCKS5_HS_INTRO_FAILED;
@@ -1390,7 +1396,7 @@ client_desc_has_arrived(const smartlist_t *entry_conns)
                         "Closing streams.");
       /* Report the extended socks error code that we were unable to introduce
        * to the service. */
-      socks_report_introduction_failed(entry_conn, identity_pk);
+      socks_mark_introduction_failed(entry_conn, identity_pk);
 
       connection_mark_unattached_ap(entry_conn,
                                     END_STREAM_REASON_RESOLVEFAILED);
@@ -1863,7 +1869,7 @@ hs_client_circuit_cleanup_on_close(const circuit_t *circ)
      * connection would get closed before the circuit is freed and thus
      * would fail to report the error code. */
     if (has_timed_out) {
-      socks_report_rend_circuit_timed_out(CONST_TO_ORIGIN_CIRCUIT(circ));
+      socks_mark_rend_circuit_timed_out(CONST_TO_ORIGIN_CIRCUIT(circ));
     }
     break;
   default:



More information about the tor-commits mailing list