diff options
author | David Goulet <dgoulet@torproject.org> | 2019-10-30 15:56:17 -0400 |
---|---|---|
committer | George Kadianakis <desnacked@riseup.net> | 2019-11-27 14:52:09 +0200 |
commit | 7f83c43594dcf13fb04352f5faa8db2cd86354c1 (patch) | |
tree | dccdc243ee719cc7af94f29274d90f28a1268ac1 /src/feature/hs/hs_circuit.c | |
parent | 1aafe3376ea08fb31fcb7e0a8a390ff5edeb8602 (diff) | |
download | tor-7f83c43594dcf13fb04352f5faa8db2cd86354c1.tar.gz tor-7f83c43594dcf13fb04352f5faa8db2cd86354c1.zip |
hs-v3: Note client intro circuit failure
Report back to the v3 subsystem any introduction point client circuit failure
so they can be noted down in the failure cache.
Fixes #32020
Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/feature/hs/hs_circuit.c')
-rw-r--r-- | src/feature/hs/hs_circuit.c | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/src/feature/hs/hs_circuit.c b/src/feature/hs/hs_circuit.c index 1a3767ce62..8640129f3f 100644 --- a/src/feature/hs/hs_circuit.c +++ b/src/feature/hs/hs_circuit.c @@ -20,6 +20,7 @@ #include "feature/hs/hs_cell.h" #include "feature/hs/hs_circuit.h" #include "feature/hs/hs_circuitmap.h" +#include "feature/hs/hs_client.h" #include "feature/hs/hs_ident.h" #include "feature/hs/hs_service.h" #include "feature/nodelist/describe.h" @@ -619,6 +620,22 @@ setup_introduce1_data(const hs_desc_intro_point_t *ip, return ret; } +/** Helper: cleanup function for client circuit. This is for every HS version. + * It is called from hs_circ_cleanup() entry point. */ +static void +cleanup_client_circ(circuit_t *circ) +{ + tor_assert(circ); + + if (circuit_is_hs_v2(circ)) { + rend_client_circuit_cleanup(circ); + } else if (circuit_is_hs_v3(circ)) { + hs_client_circuit_cleanup(circ); + } + /* It is possible the circuit has an HS purpose but no identifier (rend_data + * or hs_ident). Thus possible that this passess through. */ +} + /* ========== */ /* Public API */ /* ========== */ @@ -1206,21 +1223,12 @@ hs_circ_cleanup(circuit_t *circ) { tor_assert(circ); - /* v2 specific circuits. */ - if (circuit_is_hs_v2(circ)) { - if (circuit_is_hs_client(circ)) { - rend_client_circuit_cleanup(circ); - } + if (circuit_purpose_is_hs_client(circ->purpose)) { + cleanup_client_circ(circ); } - /* From this point on, it is v3 specific. */ - - /* If it's a service-side intro circ, notify the HS subsystem for the intro - * point circuit closing so it can be dealt with cleanly. */ - if (circ->purpose == CIRCUIT_PURPOSE_S_ESTABLISH_INTRO || - circ->purpose == CIRCUIT_PURPOSE_S_INTRO) { - hs_service_intro_circ_has_closed(TO_ORIGIN_CIRCUIT(circ)); - } + /* Actions that MUST happen for every circuits regardless of what was done + * on it before. */ /* Clear HS circuitmap token for this circ (if any). Very important to be * done after the HS subsystem has been notified of the close else the |