commit 379ad6f6eb5393e74daba8ac71c252155c052a34 Author: George Kadianakis desnacked@riseup.net Date: Tue Jul 25 12:17:20 2017 +0300
prop224: Use the client-side circuitmap in hs_client.c
Signed-off-by: David Goulet dgoulet@torproject.org --- src/or/circuitlist.c | 27 --------------------------- src/or/circuitlist.h | 2 -- src/or/hs_circuit.c | 4 ++++ src/or/hs_client.c | 6 +++--- 4 files changed, 7 insertions(+), 32 deletions(-)
diff --git a/src/or/circuitlist.c b/src/or/circuitlist.c index c2d947bea..d891c89f3 100644 --- a/src/or/circuitlist.c +++ b/src/or/circuitlist.c @@ -1498,33 +1498,6 @@ circuit_get_ready_rend_circ_by_rend_data(const rend_data_t *rend_data) return NULL; }
-/* Return an origin circuit such that: - * - Identifier identity key matches, - * - Rendezvous cookie matches - * - Circuit is not marked for close - * - Circuit has purpose CIRCUIT_PURPOSE_C_REND_READY. - * - * Return NULL if no such circuit exits. */ -origin_circuit_t * -circuit_get_ready_rend_by_hs_ident(const hs_ident_circuit_t *ident) -{ - SMARTLIST_FOREACH_BEGIN(circuit_get_global_list(), circuit_t *, circ) { - if (!circ->marked_for_close && - circ->purpose == CIRCUIT_PURPOSE_C_REND_READY) { - origin_circuit_t *ocirc = TO_ORIGIN_CIRCUIT(circ); - if (ocirc->hs_ident && - ed25519_pubkey_eq(&ident->identity_pk, - ô->hs_ident->identity_pk) && - tor_memeq(ident->rendezvous_cookie, - ocirc->hs_ident->rendezvous_cookie, - HS_REND_COOKIE_LEN)) { - return ocirc; - } - } - } SMARTLIST_FOREACH_END(circ); - return NULL; -} - /** Return the first service introduction circuit originating from the global * circuit list after <b>start</b> or at the start of the list if <b>start</b> * is NULL. Return NULL if no circuit is found. diff --git a/src/or/circuitlist.h b/src/or/circuitlist.h index f2a3c4313..b882b2c6a 100644 --- a/src/or/circuitlist.h +++ b/src/or/circuitlist.h @@ -46,8 +46,6 @@ void circuit_unlink_all_from_channel(channel_t *chan, int reason); origin_circuit_t *circuit_get_by_global_id(uint32_t id); origin_circuit_t *circuit_get_ready_rend_circ_by_rend_data( const rend_data_t *rend_data); -origin_circuit_t *circuit_get_ready_rend_by_hs_ident( - const hs_ident_circuit_t *ident); origin_circuit_t *circuit_get_next_by_pk_and_purpose(origin_circuit_t *start, const uint8_t *digest, uint8_t purpose); origin_circuit_t *circuit_get_next_service_intro_circ(origin_circuit_t *start); diff --git a/src/or/hs_circuit.c b/src/or/hs_circuit.c index ee453d0d5..819d25432 100644 --- a/src/or/hs_circuit.c +++ b/src/or/hs_circuit.c @@ -1070,6 +1070,10 @@ hs_circ_send_introduce1(origin_circuit_t *intro_circ, goto done; }
+ /* Register rend circuit in circuitmap */ + hs_circuitmap_register_rend_circ_client_side(rend_circ, + rend_circ->hs_ident->rendezvous_cookie); + /* Success. */ ret = 0; goto done; diff --git a/src/or/hs_client.c b/src/or/hs_client.c index 337c7477d..562955076 100644 --- a/src/or/hs_client.c +++ b/src/or/hs_client.c @@ -503,9 +503,9 @@ handle_introduce_ack_success(origin_circuit_t *intro_circ)
log_info(LD_REND, "Received INTRODUCE_ACK ack! Informing rendezvous");
- /* Get the rendezvous circuit matching this intro point circuit. - * XXX Replace this by our hs circuitmap to support client? */ - rend_circ = circuit_get_ready_rend_by_hs_ident(intro_circ->hs_ident); + /* Get the rendezvous circuit for this rendezvous cookie. */ + uint8_t *rendezvous_cookie = intro_circ->hs_ident->rendezvous_cookie; + rend_circ = hs_circuitmap_get_rend_circ_client_side(rendezvous_cookie); if (rend_circ == NULL) { log_warn(LD_REND, "Can't find any rendezvous circuit. Stopping"); goto end;
tor-commits@lists.torproject.org