[tor-commits] [tor/master] MAX_REND_FAILURES is 1, but we would try three times

nickm at torproject.org nickm at torproject.org
Fri Jan 19 21:32:22 UTC 2018


commit a15eb9ff439623f800de813c1a78eeb5d61f7f5a
Author: Roger Dingledine <arma at torproject.org>
Date:   Mon Jan 15 16:30:55 2018 -0500

    MAX_REND_FAILURES is 1, but we would try three times
    
    Fix an "off by 2" error in counting rendezvous failures on the onion
    service side.
    
    While we thought we would stop the rendezvous attempt after one failed
    circuit, we were actually making three circuit attempts before giving up.
    
    Fixes bug 24895; bugfix on 0.0.6.
---
 changes/bug24895     | 6 ++++++
 src/or/rendservice.c | 5 ++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/changes/bug24895 b/changes/bug24895
new file mode 100644
index 000000000..7b90f6d26
--- /dev/null
+++ b/changes/bug24895
@@ -0,0 +1,6 @@
+  o Major bugfixes (onion services):
+    - Fix an "off by 2" error in counting rendezvous failures on the
+      onion service side. While we thought we would stop the rendezvous
+      attempt after one failed circuit, we were actually making three
+      circuit attempts before giving up. Fixes bug 24895; bugfix on 0.0.6.
+
diff --git a/src/or/rendservice.c b/src/or/rendservice.c
index a8c383444..acc431a57 100644
--- a/src/or/rendservice.c
+++ b/src/or/rendservice.c
@@ -2930,8 +2930,11 @@ rend_service_relaunch_rendezvous(origin_circuit_t *oldcirc)
   }
   oldcirc->hs_service_side_rend_circ_has_been_relaunched = 1;
 
+  /* We check failure_count >= MAX_REND_FAILURES-1 below rather than
+   * failure_count >= MAX_REND_FAILURES, because we increment the failure
+   * count for our current failure *after* this clause. */
   if (!oldcirc->build_state ||
-      oldcirc->build_state->failure_count > MAX_REND_FAILURES ||
+      oldcirc->build_state->failure_count >= MAX_REND_FAILURES-1 ||
       oldcirc->build_state->expiry_time < time(NULL)) {
     log_info(LD_REND,
              "Attempt to build circuit to %s for rendezvous has failed "





More information about the tor-commits mailing list