diff options
author | David Goulet <dgoulet@torproject.org> | 2022-10-19 15:27:22 -0400 |
---|---|---|
committer | David Goulet <dgoulet@torproject.org> | 2022-10-19 16:39:10 -0400 |
commit | 04cccd70744a09492b70baf974b2953d6e5c6d0a (patch) | |
tree | 64e61e303c847d50db6bb4e83ac5da7a08e03d02 /src/feature/hs | |
parent | 921268d4ce3e55c87e1df91a17b96d8d1407fbb7 (diff) | |
download | tor-04cccd70744a09492b70baf974b2953d6e5c6d0a.tar.gz tor-04cccd70744a09492b70baf974b2953d6e5c6d0a.zip |
hs: Retry service rendezvous on circuit close
Move the retry from circuit_expire_building() to when the offending
circuit is being closed.
Fixes #40695
Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/feature/hs')
-rw-r--r-- | src/feature/hs/hs_circuit.c | 16 | ||||
-rw-r--r-- | src/feature/hs/hs_circuit.h | 2 | ||||
-rw-r--r-- | src/feature/hs/hs_service.c | 3 |
3 files changed, 5 insertions, 16 deletions
diff --git a/src/feature/hs/hs_circuit.c b/src/feature/hs/hs_circuit.c index 307557dc86..fa8f9e05cf 100644 --- a/src/feature/hs/hs_circuit.c +++ b/src/feature/hs/hs_circuit.c @@ -433,16 +433,6 @@ can_relaunch_service_rendezvous_point(const origin_circuit_t *circ) /* XXX: Retrying under certain condition. This is related to #22455. */ - /* Avoid to relaunch twice a circuit to the same rendezvous point at the - * same time. */ - if (circ->hs_service_side_rend_circ_has_been_relaunched) { - log_info(LD_REND, "Rendezvous circuit to %s has already been retried. " - "Skipping retry.", - safe_str_client( - extend_info_describe(circ->build_state->chosen_exit))); - goto disallow; - } - /* We check failure_count >= hs_get_service_max_rend_failures()-1 below, and * the -1 is because we increment the failure count for our current failure * *after* this clause. */ @@ -684,7 +674,7 @@ hs_circ_service_get_established_intro_circ(const hs_service_intro_point_t *ip) * - We've already retried this specific rendezvous circuit. */ void -hs_circ_retry_service_rendezvous_point(origin_circuit_t *circ) +hs_circ_retry_service_rendezvous_point(const origin_circuit_t *circ) { tor_assert(circ); tor_assert(TO_CIRCUIT(circ)->purpose == CIRCUIT_PURPOSE_S_CONNECT_REND); @@ -694,10 +684,6 @@ hs_circ_retry_service_rendezvous_point(origin_circuit_t *circ) goto done; } - /* Flag the circuit that we are relaunching, to avoid to relaunch twice a - * circuit to the same rendezvous point at the same time. */ - circ->hs_service_side_rend_circ_has_been_relaunched = 1; - /* Legacy services don't have a hidden service ident. */ if (circ->hs_ident) { retry_service_rendezvous_point(circ); diff --git a/src/feature/hs/hs_circuit.h b/src/feature/hs/hs_circuit.h index 808e648951..afbff7b894 100644 --- a/src/feature/hs/hs_circuit.h +++ b/src/feature/hs/hs_circuit.h @@ -33,7 +33,7 @@ int hs_circ_launch_intro_point(hs_service_t *service, int hs_circ_launch_rendezvous_point(const hs_service_t *service, const curve25519_public_key_t *onion_key, const uint8_t *rendezvous_cookie); -void hs_circ_retry_service_rendezvous_point(origin_circuit_t *circ); +void hs_circ_retry_service_rendezvous_point(const origin_circuit_t *circ); origin_circuit_t *hs_circ_service_get_intro_circ( const hs_service_intro_point_t *ip); diff --git a/src/feature/hs/hs_service.c b/src/feature/hs/hs_service.c index 716386408a..4e971233af 100644 --- a/src/feature/hs/hs_service.c +++ b/src/feature/hs/hs_service.c @@ -3675,6 +3675,9 @@ hs_service_circuit_cleanup_on_close(const circuit_t *circ) hs_metrics_close_established_rdv( &CONST_TO_ORIGIN_CIRCUIT(circ)->hs_ident->identity_pk); break; + case CIRCUIT_PURPOSE_S_CONNECT_REND: + hs_circ_retry_service_rendezvous_point(CONST_TO_ORIGIN_CIRCUIT(circ)); + break; default: break; } |