mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-10 21:23:58 +01:00
Update descriptor ID when it changes in rend_data
When we have a new descriptor ID for an onion address request, change it in the rend_data_t object and purge the old one from the last hid serv request cache. Signed-off-by: David Goulet <dgoulet@ev0ke.net>
This commit is contained in:
parent
d33327ec22
commit
a9b9f6d90f
@ -792,8 +792,7 @@ end:
|
|||||||
* On success, 1 is returned. If no hidden service is left to ask, return 0.
|
* On success, 1 is returned. If no hidden service is left to ask, return 0.
|
||||||
* On error, -1 is returned. */
|
* On error, -1 is returned. */
|
||||||
static int
|
static int
|
||||||
fetch_v2_desc_by_addr(const rend_data_t *query,
|
fetch_v2_desc_by_addr(rend_data_t *query, smartlist_t *hsdirs)
|
||||||
smartlist_t *hsdirs)
|
|
||||||
{
|
{
|
||||||
char descriptor_id[DIGEST_LEN];
|
char descriptor_id[DIGEST_LEN];
|
||||||
int replicas_left_to_try[REND_NUMBER_OF_NON_CONSECUTIVE_REPLICAS];
|
int replicas_left_to_try[REND_NUMBER_OF_NON_CONSECUTIVE_REPLICAS];
|
||||||
@ -823,6 +822,16 @@ fetch_v2_desc_by_addr(const rend_data_t *query,
|
|||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (tor_memcmp(descriptor_id, query->descriptor_id[chosen_replica],
|
||||||
|
sizeof(descriptor_id)) != 0) {
|
||||||
|
/* Not equal from what we currently have so purge the last hid serv
|
||||||
|
* request cache and update the descriptor ID with the new value. */
|
||||||
|
purge_hid_serv_from_last_hid_serv_requests(
|
||||||
|
query->descriptor_id[chosen_replica]);
|
||||||
|
memcpy(query->descriptor_id[chosen_replica], descriptor_id,
|
||||||
|
sizeof(query->descriptor_id[chosen_replica]));
|
||||||
|
}
|
||||||
|
|
||||||
/* Trigger the fetch with the computed descriptor ID. */
|
/* Trigger the fetch with the computed descriptor ID. */
|
||||||
ret = fetch_v2_desc_by_descid(descriptor_id, query, hsdirs);
|
ret = fetch_v2_desc_by_descid(descriptor_id, query, hsdirs);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
@ -849,8 +858,7 @@ end:
|
|||||||
* On success, 1 is returned. If no hidden service is left to ask, return 0.
|
* On success, 1 is returned. If no hidden service is left to ask, return 0.
|
||||||
* On error, -1 is returned. */
|
* On error, -1 is returned. */
|
||||||
int
|
int
|
||||||
rend_client_fetch_v2_desc(const rend_data_t *query,
|
rend_client_fetch_v2_desc(rend_data_t *query, smartlist_t *hsdirs)
|
||||||
smartlist_t *hsdirs)
|
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@ -877,7 +885,7 @@ error:
|
|||||||
* one (possibly) working introduction point in it, start a connection to a
|
* one (possibly) working introduction point in it, start a connection to a
|
||||||
* hidden service directory to fetch a v2 rendezvous service descriptor. */
|
* hidden service directory to fetch a v2 rendezvous service descriptor. */
|
||||||
void
|
void
|
||||||
rend_client_refetch_v2_renddesc(const rend_data_t *rend_query)
|
rend_client_refetch_v2_renddesc(rend_data_t *rend_query)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
rend_cache_entry_t *e = NULL;
|
rend_cache_entry_t *e = NULL;
|
||||||
@ -964,7 +972,7 @@ rend_client_cancel_descriptor_fetches(void)
|
|||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
rend_client_report_intro_point_failure(extend_info_t *failed_intro,
|
rend_client_report_intro_point_failure(extend_info_t *failed_intro,
|
||||||
const rend_data_t *rend_query,
|
rend_data_t *rend_query,
|
||||||
unsigned int failure_type)
|
unsigned int failure_type)
|
||||||
{
|
{
|
||||||
int i, r;
|
int i, r;
|
||||||
|
@ -19,9 +19,8 @@ void rend_client_rendcirc_has_opened(origin_circuit_t *circ);
|
|||||||
int rend_client_introduction_acked(origin_circuit_t *circ,
|
int rend_client_introduction_acked(origin_circuit_t *circ,
|
||||||
const uint8_t *request,
|
const uint8_t *request,
|
||||||
size_t request_len);
|
size_t request_len);
|
||||||
void rend_client_refetch_v2_renddesc(const rend_data_t *rend_query);
|
void rend_client_refetch_v2_renddesc(rend_data_t *rend_query);
|
||||||
int rend_client_fetch_v2_desc(const rend_data_t *query,
|
int rend_client_fetch_v2_desc(rend_data_t *query, smartlist_t *hsdirs);
|
||||||
smartlist_t *hsdirs);
|
|
||||||
void rend_client_cancel_descriptor_fetches(void);
|
void rend_client_cancel_descriptor_fetches(void);
|
||||||
void rend_client_purge_last_hid_serv_requests(void);
|
void rend_client_purge_last_hid_serv_requests(void);
|
||||||
|
|
||||||
@ -30,7 +29,7 @@ void rend_client_purge_last_hid_serv_requests(void);
|
|||||||
#define INTRO_POINT_FAILURE_UNREACHABLE 2
|
#define INTRO_POINT_FAILURE_UNREACHABLE 2
|
||||||
|
|
||||||
int rend_client_report_intro_point_failure(extend_info_t *failed_intro,
|
int rend_client_report_intro_point_failure(extend_info_t *failed_intro,
|
||||||
const rend_data_t *rend_query,
|
rend_data_t *rend_query,
|
||||||
unsigned int failure_type);
|
unsigned int failure_type);
|
||||||
|
|
||||||
int rend_client_rendezvous_acked(origin_circuit_t *circ,
|
int rend_client_rendezvous_acked(origin_circuit_t *circ,
|
||||||
|
Loading…
Reference in New Issue
Block a user