mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-30 15:43:32 +01:00
Better fix for 997.
This commit is contained in:
parent
20883f5e83
commit
f266ecbeec
@ -29,6 +29,11 @@ Changes in version 0.2.1.16-?? - 2009-??-??
|
|||||||
- Avoid crashing when we have a policy specified in a DirPolicy or
|
- Avoid crashing when we have a policy specified in a DirPolicy or
|
||||||
SocksPolicy or ReachableAddresses option with ports set on it, and we
|
SocksPolicy or ReachableAddresses option with ports set on it, and we
|
||||||
re-load the policy. May fix bug 996.
|
re-load the policy. May fix bug 996.
|
||||||
|
- Hidden service clients didn't use a cached service descriptor that
|
||||||
|
was older than 15 minutes, but wouldn't fetch a new one either,
|
||||||
|
because there was already one in the cache. Now, fetch a v2
|
||||||
|
descriptor unless the same descriptor was added to the cache within
|
||||||
|
the last 15 minutes. Fixes bug 997; reported by Marcus Griep.
|
||||||
|
|
||||||
o Minor bugfixes (on 0.2.1.x):
|
o Minor bugfixes (on 0.2.1.x):
|
||||||
- When switching back and forth between bridge mode, do not start
|
- When switching back and forth between bridge mode, do not start
|
||||||
|
@ -1683,9 +1683,6 @@ connection_ap_handshake_rewrite_and_attach(edge_connection_t *conn,
|
|||||||
if (conn->rend_data->auth_type == REND_NO_AUTH)
|
if (conn->rend_data->auth_type == REND_NO_AUTH)
|
||||||
rend_client_refetch_renddesc(conn->rend_data->onion_address);
|
rend_client_refetch_renddesc(conn->rend_data->onion_address);
|
||||||
} else { /* r > 0 */
|
} else { /* r > 0 */
|
||||||
/** How long after we receive a hidden service descriptor do we consider
|
|
||||||
* it valid? */
|
|
||||||
#define NUM_SECONDS_BEFORE_HS_REFETCH (60*15)
|
|
||||||
if (now - entry->received < NUM_SECONDS_BEFORE_HS_REFETCH) {
|
if (now - entry->received < NUM_SECONDS_BEFORE_HS_REFETCH) {
|
||||||
conn->_base.state = AP_CONN_STATE_CIRCUIT_WAIT;
|
conn->_base.state = AP_CONN_STATE_CIRCUIT_WAIT;
|
||||||
log_info(LD_REND, "Descriptor is here and fresh enough. Great.");
|
log_info(LD_REND, "Descriptor is here and fresh enough. Great.");
|
||||||
|
@ -636,6 +636,10 @@ typedef enum {
|
|||||||
/** Length of a binary-encoded rendezvous service ID. */
|
/** Length of a binary-encoded rendezvous service ID. */
|
||||||
#define REND_SERVICE_ID_LEN 10
|
#define REND_SERVICE_ID_LEN 10
|
||||||
|
|
||||||
|
/** How long after we receive a hidden service descriptor do we consider
|
||||||
|
* it fresh? */
|
||||||
|
#define NUM_SECONDS_BEFORE_HS_REFETCH (60*15)
|
||||||
|
|
||||||
/** Time period for which a v2 descriptor will be valid. */
|
/** Time period for which a v2 descriptor will be valid. */
|
||||||
#define REND_TIME_PERIOD_V2_DESC_VALIDITY (24*60*60)
|
#define REND_TIME_PERIOD_V2_DESC_VALIDITY (24*60*60)
|
||||||
|
|
||||||
|
@ -482,8 +482,9 @@ rend_client_refetch_v2_renddesc(const rend_data_t *rend_query)
|
|||||||
{
|
{
|
||||||
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];
|
||||||
int i, tries_left;
|
int i, tries_left, r;
|
||||||
rend_cache_entry_t *e = NULL;
|
rend_cache_entry_t *e = NULL;
|
||||||
|
time_t now = time(NULL);
|
||||||
tor_assert(rend_query);
|
tor_assert(rend_query);
|
||||||
/* Are we configured to fetch descriptors? */
|
/* Are we configured to fetch descriptors? */
|
||||||
if (!get_options()->FetchHidServDescriptors) {
|
if (!get_options()->FetchHidServDescriptors) {
|
||||||
@ -492,9 +493,11 @@ rend_client_refetch_v2_renddesc(const rend_data_t *rend_query)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* Before fetching, check if we already have the descriptor here. */
|
/* Before fetching, check if we already have the descriptor here. */
|
||||||
if (rend_cache_lookup_entry(rend_query->onion_address, -1, &e) > 0) {
|
r = rend_cache_lookup_entry(rend_query->onion_address, -1, &e);
|
||||||
|
if (r > 0 && now - e->received < NUM_SECONDS_BEFORE_HS_REFETCH) {
|
||||||
log_info(LD_REND, "We would fetch a v2 rendezvous descriptor, but we "
|
log_info(LD_REND, "We would fetch a v2 rendezvous descriptor, but we "
|
||||||
"already have that descriptor here. Not fetching.");
|
"already have a fresh copy of that descriptor here. "
|
||||||
|
"Not fetching.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
log_debug(LD_REND, "Fetching v2 rendezvous descriptor for service %s",
|
log_debug(LD_REND, "Fetching v2 rendezvous descriptor for service %s",
|
||||||
|
Loading…
Reference in New Issue
Block a user