]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Do not replace a HS descriptor with a different replica of itself
authorRoger Dingledine <arma@torproject.org>
Sun, 18 Jan 2015 20:39:12 +0000 (15:39 -0500)
committerNick Mathewson <nickm@torproject.org>
Sun, 18 Jan 2015 20:39:12 +0000 (15:39 -0500)
This fixes a bug where we'd fetch different replicas of the same
descriptor for a down hidden service over and over, until we got lucky
and fetched the same replica twice in a row.

Fixes bug 14219; bugfix on 0.2.0.10-alpha.

(Patch from Roger; commit message and changes file by Nick.)

changes/bug14219 [new file with mode: 0644]
src/or/rendcommon.c

diff --git a/changes/bug14219 b/changes/bug14219
new file mode 100644 (file)
index 0000000..9d845db
--- /dev/null
@@ -0,0 +1,6 @@
+  o Minor bugfixes (hidden services):
+
+    - When fetching a hidden service descriptor for a down service that we
+      recently up, do not keep refetching until we try the same replica twice
+      in a row.  Fixes bug 14219; bugfix on 0.2.0.10-alpha.
+
index a664b5d5019633cbe34cee3d8a81664070af21c7..3d2b7061048ac5fea272d61c7b8f64c280f065e3 100644 (file)
@@ -1146,19 +1146,12 @@ rend_cache_store_v2_desc_as_client(const char *desc,
   /* Do we already have a newer descriptor? */
   tor_snprintf(key, sizeof(key), "2%s", service_id);
   e = (rend_cache_entry_t*) strmap_get_lc(rend_cache, key);
-  if (e && e->parsed->timestamp > parsed->timestamp) {
-    log_info(LD_REND, "We already have a newer service descriptor for "
+  if (e && e->parsed->timestamp >= parsed->timestamp) {
+    log_info(LD_REND, "We already have a new enough service descriptor for "
                       "service ID %s with the same desc ID and version.",
              safe_str_client(service_id));
     goto okay;
   }
-  /* Do we already have this descriptor? */
-  if (e && !strcmp(desc, e->desc)) {
-    log_info(LD_REND,"We already have this service descriptor %s.",
-             safe_str_client(service_id));
-    e->received = time(NULL);
-    goto okay;
-  }
   if (!e) {
     e = tor_malloc_zero(sizeof(rend_cache_entry_t));
     strmap_set_lc(rend_cache, key, e);