commit 4c3a23b283774f02fbc35f70c72256c6469071d3 Author: Robert Ransom rransom.8774@gmail.com Date: Thu Dec 22 07:15:24 2011 -0800
Look up the rend circ whose INTRODUCE1 is being ACKed correctly
This change cannibalizes circuit_get_by_rend_query_and_purpose because it had exactly one caller. --- changes/bug4759 | 14 ++++++++++++++ src/or/circuitlist.c | 22 +++++++++++++--------- src/or/circuitlist.h | 4 ++-- src/or/rendclient.c | 3 +-- 4 files changed, 30 insertions(+), 13 deletions(-)
diff --git a/changes/bug4759 b/changes/bug4759 new file mode 100644 index 0000000..19138ab --- /dev/null +++ b/changes/bug4759 @@ -0,0 +1,14 @@ + o Minor bugfixes: + + - Make sure we never mark the wrong rendezvous circuit as having + had its introduction cell acknowleged by the introduction-point + relay. Previously, when we received an INTRODUCE_ACK cell on a + client-side hidden-service introduction circuit, we might have + marked a rendezvous circuit other than the one we specified in + the INTRODUCE1 cell as INTRO_ACKED, which would have produced a + warning message and interfered with the hidden service + connection-establishment process. Bugfix on 0.2.3.3-alpha, when + the stream-isolation feature which might cause Tor to open + multiple rendezvous circuits for the same hidden service was + added. Fixes bug 4759. + diff --git a/src/or/circuitlist.c b/src/or/circuitlist.c index 25b80f1..350d8ed 100644 --- a/src/or/circuitlist.c +++ b/src/or/circuitlist.c @@ -873,26 +873,30 @@ circuit_unlink_all_from_or_conn(or_connection_t *conn, int reason) } }
-/** Return a circ such that: - * - circ->rend_data->onion_address is equal to <b>rend_query</b>, and - * - circ->purpose is equal to <b>purpose</b>. +/** Return a circ such that + * - circ->rend_data->onion_address is equal to + * <b>rend_data</b>->onion_address, + * - circ->rend_data->rend_cookie is equal to + * <b>rend_data</b>->rend_cookie, and + * - circ->purpose is equal to CIRCUIT_PURPOSE_C_REND_READY. * * Return NULL if no such circuit exists. */ origin_circuit_t * -circuit_get_by_rend_query_and_purpose(const char *rend_query, uint8_t purpose) +circuit_get_ready_rend_circ_by_rend_data(const rend_data_t *rend_data) { circuit_t *circ;
- tor_assert(CIRCUIT_PURPOSE_IS_ORIGIN(purpose)); - for (circ = global_circuitlist; circ; circ = circ->next) { if (!circ->marked_for_close && - circ->purpose == purpose) { + circ->purpose == CIRCUIT_PURPOSE_C_REND_READY) { origin_circuit_t *ocirc = TO_ORIGIN_CIRCUIT(circ); if (ocirc->rend_data && - !rend_cmp_service_ids(rend_query, - ocirc->rend_data->onion_address)) + !rend_cmp_service_ids(rend_data->onion_address, + ocirc->rend_data->onion_address) && + tor_memeq(ocirc->rend_data->rend_cookie, + rend_data->rend_cookie, + REND_COOKIE_LEN)) return ocirc; } } diff --git a/src/or/circuitlist.h b/src/or/circuitlist.h index 7b01ca3..dea2813 100644 --- a/src/or/circuitlist.h +++ b/src/or/circuitlist.h @@ -32,8 +32,8 @@ int circuit_id_in_use_on_orconn(circid_t circ_id, or_connection_t *conn); circuit_t *circuit_get_by_edge_conn(edge_connection_t *conn); void circuit_unlink_all_from_or_conn(or_connection_t *conn, int reason); origin_circuit_t *circuit_get_by_global_id(uint32_t id); -origin_circuit_t *circuit_get_by_rend_query_and_purpose(const char *rend_query, - uint8_t purpose); +origin_circuit_t *circuit_get_ready_rend_circ_by_rend_data( + const rend_data_t *rend_data); origin_circuit_t *circuit_get_next_by_pk_and_purpose(origin_circuit_t *start, const char *digest, uint8_t purpose); or_circuit_t *circuit_get_rendezvous(const char *cookie); diff --git a/src/or/rendclient.c b/src/or/rendclient.c index d9b210a..84a9d49 100644 --- a/src/or/rendclient.c +++ b/src/or/rendclient.c @@ -350,8 +350,7 @@ rend_client_introduction_acked(origin_circuit_t *circ, * and tell it. */ log_info(LD_REND,"Received ack. Telling rend circ..."); - rendcirc = circuit_get_by_rend_query_and_purpose( - circ->rend_data->onion_address, CIRCUIT_PURPOSE_C_REND_READY); + rendcirc = circuit_get_ready_rend_circ_by_rend_data(circ->rend_data); if (rendcirc) { /* remember the ack */ #ifndef NON_ANONYMOUS_MODE_ENABLED tor_assert(!(rendcirc->build_state->onehop_tunnel));