diff options
author | Nick Mathewson <nickm@torproject.org> | 2011-07-15 18:53:29 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2011-07-15 18:55:12 -0400 |
commit | b8943461c0d26074522f905eba862bd9caab591b (patch) | |
tree | 566983120773f63a4dc1e5aad17b56776487d268 | |
parent | 8157dcbdf87271feab1b610df4eb0c616b250197 (diff) | |
download | tor-b8943461c0d26074522f905eba862bd9caab591b.tar.gz tor-b8943461c0d26074522f905eba862bd9caab591b.zip |
Fix bug in upload/download of hsdesc with microdescs
Previously we were using router_get_by_id(foo) to test "do we have a
descriptor that will let us make an anonymous circuit to foo". But
that isn't right for microdescs: we should have been using node_t.
Fixes bug 3601; bugfix on 0.2.3.1-alpha.
-rw-r--r-- | changes/bug3601 | 4 | ||||
-rw-r--r-- | src/or/rendclient.c | 9 | ||||
-rw-r--r-- | src/or/rendservice.c | 4 |
3 files changed, 12 insertions, 5 deletions
diff --git a/changes/bug3601 b/changes/bug3601 new file mode 100644 index 0000000000..36686a45f4 --- /dev/null +++ b/changes/bug3601 @@ -0,0 +1,4 @@ + o Major bugfixes: + - Using microdescriptors no longer prevents Tor from uploading and + downloading hidden service descriptors. Fixes bug 3601; bugfix + on 0.2.3.1-alpha. diff --git a/src/or/rendclient.c b/src/or/rendclient.c index 516455983c..413d9b728a 100644 --- a/src/or/rendclient.c +++ b/src/or/rendclient.c @@ -510,10 +510,11 @@ directory_get_from_hs_dir(const char *desc_id, const rend_data_t *rend_query) directory_clean_last_hid_serv_requests(now); SMARTLIST_FOREACH(responsible_dirs, routerstatus_t *, dir, { - if (lookup_last_hid_serv_request(dir, desc_id_base32, 0, 0) + - REND_HID_SERV_DIR_REQUERY_PERIOD >= now || - !router_get_by_id_digest(dir->identity_digest)) - SMARTLIST_DEL_CURRENT(responsible_dirs, dir); + time_t last = lookup_last_hid_serv_request(dir, desc_id_base32, 0, 0); + const node_t *node = node_get_by_id(dir->identity_digest); + if (last + REND_HID_SERV_DIR_REQUERY_PERIOD >= now || + !node || !node_has_descriptor(node)) + SMARTLIST_DEL_CURRENT(responsible_dirs, dir); }); hs_dir = smartlist_choose(responsible_dirs); diff --git a/src/or/rendservice.c b/src/or/rendservice.c index 47a9fc7276..5888e390fc 100644 --- a/src/or/rendservice.c +++ b/src/or/rendservice.c @@ -1632,12 +1632,14 @@ directory_post_to_hs_dir(rend_service_descriptor_t *renddesc, for (j = 0; j < smartlist_len(responsible_dirs); j++) { char desc_id_base32[REND_DESC_ID_V2_LEN_BASE32 + 1]; char *hs_dir_ip; + const node_t *node; hs_dir = smartlist_get(responsible_dirs, j); if (smartlist_digest_isin(renddesc->successful_uploads, hs_dir->identity_digest)) /* Don't upload descriptor if we succeeded in doing so last time. */ continue; - if (!router_get_by_id_digest(hs_dir->identity_digest)) { + node = node_get_by_id(hs_dir->identity_digest); + if (!node || !node_has_descriptor(node)) { log_info(LD_REND, "Not sending publish request for v2 descriptor to " "hidden service directory %s; we don't have its " "router descriptor. Queuing for later upload.", |