Browse Source

Merge branch 'bug18982'

Nick Mathewson 6 years ago
parent
commit
a368cadf95
2 changed files with 11 additions and 5 deletions
  1. 6 0
      changes/bug18982
  2. 5 5
      src/or/circuitbuild.c

+ 6 - 0
changes/bug18982

@@ -0,0 +1,6 @@
+  o Minor bugfixes (circuit logging):
+    - torspec says hop counts are 1-based, so fix two log messages
+      that mistakenly logged 0-based hop counts.
+      Closes ticket 18982, bugfix on 0275b6876 in tor 0.2.6.2-alpha
+      and 907db008a in tor 0.2.4.5-alpha. Patch by teor.
+      Credit to Xiaofan Li for reporting this issue.

+ 5 - 5
src/or/circuitbuild.c

@@ -2442,8 +2442,8 @@ choose_good_middle_server(uint8_t purpose,
   tor_assert(CIRCUIT_PURPOSE_MIN_ <= purpose &&
              purpose <= CIRCUIT_PURPOSE_MAX_);
 
-  log_debug(LD_CIRC, "Contemplating intermediate hop %d: random choice.",
-            cur_len);
+  log_debug(LD_CIRC, "Contemplating intermediate hop #%d: random choice.",
+            cur_len+1);
   excluded = smartlist_new();
   if ((r = build_state_get_exit_node(state))) {
     nodelist_add_node_and_family(excluded, r);
@@ -2577,12 +2577,12 @@ onion_extend_cpath(origin_circuit_t *circ)
   }
 
   if (!info) {
-    log_warn(LD_CIRC,"Failed to find node for hop %d of our path. Discarding "
-             "this circuit.", cur_len);
+    log_warn(LD_CIRC,"Failed to find node for hop #%d of our path. Discarding "
+             "this circuit.", cur_len+1);
     return -1;
   }
 
-  log_debug(LD_CIRC,"Chose router %s for hop %d (exit is %s)",
+  log_debug(LD_CIRC,"Chose router %s for hop #%d (exit is %s)",
             extend_info_describe(info),
             cur_len+1, build_state_get_exit_nickname(state));