[tor-commits] [tor/master] Don't call into the new guard algorithm when the old one is enabled.

nickm at torproject.org nickm at torproject.org
Fri Dec 16 16:26:18 UTC 2016


commit 8edd3d2b6c43bd5eb64d79177e6e4c44ca4fc618
Author: Nick Mathewson <nickm at torproject.org>
Date:   Wed Nov 23 08:02:48 2016 -0500

    Don't call into the new guard algorithm when the old one is enabled.
    
    (I'm surprised that these are the only bugs I ran into when I
    tested running with the old algorithm again!)
---
 src/or/circuitbuild.c | 5 ++++-
 src/or/circuituse.c   | 3 ++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index 2f4ce7a..16b53f6 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -965,7 +965,10 @@ circuit_send_next_onion_skin(origin_circuit_t *circ)
     if (!hop) {
       /* done building the circuit. whew. */
       int r;
-      if (! circ->guard_state) {
+      if (get_options()->UseDeprecatedGuardAlgorithm) {
+        // The circuit is usable; we already marked the guard as okay.
+        r = 1;
+      } else if (! circ->guard_state) {
         if (circuit_get_cpath_len(circ) != 1) {
           log_warn(LD_BUG, "%d-hop circuit %p with purpose %d has no "
                    "guard state",
diff --git a/src/or/circuituse.c b/src/or/circuituse.c
index d2a7f20..b9f94fb 100644
--- a/src/or/circuituse.c
+++ b/src/or/circuituse.c
@@ -1633,7 +1633,8 @@ circuit_build_failed(origin_circuit_t *circ)
                "Our circuit died before the first hop with no connection");
     }
     if (n_chan_id && !already_marked) {
-      entry_guard_failed(get_guard_selection_info(), &circ->guard_state);
+      if (circ->guard_state)
+        entry_guard_failed(get_guard_selection_info(), &circ->guard_state);
       /* XXXX prop271 -- old API */
       entry_guard_register_connect_status(n_chan_id, 0, 1, time(NULL));
       /* if there are any one-hop streams waiting on this circuit, fail





More information about the tor-commits mailing list