commit ca19a95d5402e2f74e027761223f6d7605534c2c Merge: 2264172fb 22295759a Author: Nick Mathewson nickm@torproject.org Date: Fri Sep 8 12:13:48 2017 -0400
Merge remote-tracking branch 'dgoulet/ticket23355_032_01'
src/or/connection.c | 19 +++++++++++++++---- src/or/connection.h | 1 + src/or/hs_cache.c | 31 +++++++++++++++++++++++++++++++ src/or/hs_cache.h | 2 ++ src/or/hs_client.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ src/or/hs_client.h | 2 ++ src/or/main.c | 3 ++- src/or/rendcache.c | 4 ++-- 8 files changed, 100 insertions(+), 7 deletions(-)
diff --cc src/or/hs_client.c index e7d316b74,0015a9016..f85ebc847 --- a/src/or/hs_client.c +++ b/src/or/hs_client.c @@@ -31,8 -28,31 +31,32 @@@ #include "connection.h" #include "hs_ntor.h" #include "circuitbuild.h" +#include "networkstatus.h"
+ /* Cancel all descriptor fetches currently in progress. */ + static void + cancel_descriptor_fetches(void) + { + smartlist_t *conns = + connection_list_by_type_state(CONN_TYPE_DIR, DIR_PURPOSE_FETCH_HSDESC); + SMARTLIST_FOREACH_BEGIN(conns, connection_t *, conn) { + const hs_ident_dir_conn_t *ident = TO_DIR_CONN(conn)->hs_ident; + if (BUG(ident == NULL)) { + /* A directory connection fetching a service descriptor can't have an + * empty hidden service identifier. */ + continue; + } + log_debug(LD_REND, "Marking for close a directory connection fetching " + "a hidden service descriptor for service %s.", + safe_str_client(ed25519_fmt(&ident->identity_pk))); + connection_mark_for_close(conn); + } SMARTLIST_FOREACH_END(conn); + + /* No ownership of the objects in this list. */ + smartlist_free(conns); + log_info(LD_REND, "Hidden service client descriptor fetches cancelled."); + } + /* Get all connections that are waiting on a circuit and flag them back to * waiting for a hidden service descriptor for the given service key * service_identity_pk. */ @@@ -1267,11 -1275,24 +1291,32 @@@ hs_client_reextend_intro_circuit(origin return ret; }
+/* Release all the storage held by the client subsystem. */ +void +hs_client_free_all(void) +{ + /* Purge the hidden service request cache. */ + hs_purge_last_hid_serv_requests(); +} + + /* Purge all potentially remotely-detectable state held in the hidden + * service client code. Called on SIGNAL NEWNYM. */ + void + hs_client_purge_state(void) + { + /* v2 subsystem. */ + rend_client_purge_state(); + + /* Cancel all descriptor fetches. Do this first so once done we are sure + * that our descriptor cache won't modified. */ + cancel_descriptor_fetches(); + /* Purge the introduction point state cache. */ + hs_cache_client_intro_state_purge(); + /* Purge the descriptor cache. */ + hs_cache_purge_as_client(); + /* Purge the last hidden service request cache. */ + hs_purge_last_hid_serv_requests(); + + log_info(LD_REND, "Hidden service client state has been purged."); + } + diff --cc src/or/hs_client.h index d8b8acf75,a0f7c6b46..522770450 --- a/src/or/hs_client.h +++ b/src/or/hs_client.h @@@ -46,14 -46,7 +46,16 @@@ extend_info_t *hs_client_get_random_int
int hs_client_reextend_intro_circuit(origin_circuit_t *circ);
+ void hs_client_purge_state(void); + +void hs_client_free_all(void); + +#ifdef HS_CLIENT_PRIVATE + +STATIC routerstatus_t * +pick_hsdir_v3(const ed25519_public_key_t *onion_identity_pk); + +#endif + #endif /* TOR_HS_CLIENT_H */
tor-commits@lists.torproject.org