summaryrefslogtreecommitdiff
path: root/src/or/circuitlist.c
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2017-07-21 17:48:18 -0400
committerDavid Goulet <dgoulet@torproject.org>2017-08-24 13:03:28 -0400
commitfca2f64e2f563c07e2d5467adc49914bc4545e36 (patch)
tree385863f5633c5b4f8f56b91c3877fa028ab0cf1b /src/or/circuitlist.c
parentcb336a7062f87c5c306549a4f4a26eab66c5b825 (diff)
downloadtor-fca2f64e2f563c07e2d5467adc49914bc4545e36.tar.gz
tor-fca2f64e2f563c07e2d5467adc49914bc4545e36.zip
prop224: Handle INTRODUCE_ACK cell
The client is now able to handle an INTRODUCE_ACK cell and do the appropriate actions. An intro point failure cache is missing and a way to close all intro point that were launched in parallel. Some notes are in the comment for that. Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/or/circuitlist.c')
-rw-r--r--src/or/circuitlist.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/or/circuitlist.c b/src/or/circuitlist.c
index d891c89f38..c2d947beae 100644
--- a/src/or/circuitlist.c
+++ b/src/or/circuitlist.c
@@ -1498,6 +1498,33 @@ 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,
+ &ocirc->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.