From 35217f0f61c633efe1f6e5ecab18d1700b9d570b Mon Sep 17 00:00:00 2001 From: "teor (Tim Wilson-Brown)" Date: Sat, 7 May 2016 21:03:31 +1000 Subject: [PATCH 1/2] Fix two log messages that mistakenly log 0-based hop counts (torspec says hop counts are 1-based.) Closes ticket 18982, bugfix on 0275b6876 in tor 0.2.6.2-alpha and 907db008a in tor 0.2.4.5-alpha. Credit to Xiaofan Li for reporting this issue. --- changes/bug18982 | 6 ++++++ src/or/circuitbuild.c | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 changes/bug18982 diff --git a/changes/bug18982 b/changes/bug18982 new file mode 100644 index 0000000000..bb0383d136 --- /dev/null +++ b/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. diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c index e6fe3f0c37..48e4b75ff9 100644 --- a/src/or/circuitbuild.c +++ b/src/or/circuitbuild.c @@ -2112,7 +2112,7 @@ choose_good_middle_server(uint8_t purpose, purpose <= CIRCUIT_PURPOSE_MAX_); log_debug(LD_CIRC, "Contemplating intermediate hop %d: random choice.", - cur_len); + cur_len+1); excluded = smartlist_new(); if ((r = build_state_get_exit_node(state))) { nodelist_add_node_and_family(excluded, r); @@ -2263,7 +2263,7 @@ 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); + "this circuit.", cur_len+1); return -1; } From c3a0cdeaab5aa4e4f60df7c6a798fd8c3a2f251d Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Fri, 11 Aug 2017 12:11:27 -0400 Subject: [PATCH 2/2] Add # to "hop N" messages to disambiguate from old messages. --- src/or/circuitbuild.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c index 48e4b75ff9..0c57b0b255 100644 --- a/src/or/circuitbuild.c +++ b/src/or/circuitbuild.c @@ -2111,7 +2111,7 @@ 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.", + log_debug(LD_CIRC, "Contemplating intermediate hop #%d: random choice.", cur_len+1); excluded = smartlist_new(); if ((r = build_state_get_exit_node(state))) { @@ -2262,12 +2262,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 " + 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));