[tor-commits] [tor/master] Fix Reachability self-tests in test networks

nickm at torproject.org nickm at torproject.org
Tue Dec 30 14:08:00 UTC 2014


commit 2b8e1f91336db7297803f4e7d2f324d6960a676c
Author: teor <teor2345 at gmail.com>
Date:   Sat Dec 20 21:44:16 2014 +1100

    Fix Reachability self-tests in test networks
    
    Stop assuming that private addresses are local when checking
    reachability in a TestingTorNetwork. Instead, when testing, assume
    all OR connections are remote. (This is necessary due to many test
    scenarios running all nodes on localhost.)
    
    This assists in bootstrapping a testing Tor network.
    
    Fixes bugs 13718 & 13924.
---
 changes/bug13924-fix-testing-reachability |    7 +++++++
 src/or/circuitbuild.c                     |    6 ++++--
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/changes/bug13924-fix-testing-reachability b/changes/bug13924-fix-testing-reachability
new file mode 100644
index 0000000..914a159
--- /dev/null
+++ b/changes/bug13924-fix-testing-reachability
@@ -0,0 +1,7 @@
+  o Minor bugfixes:
+    - Stop assuming that private addresses are local when checking
+      reachability in a TestingTorNetwork. Instead, when testing, assume
+      all OR connections are remote. (This is necessary due to many test
+      scenarios running all nodes on localhost.)
+      This assists in bootstrapping a testing Tor network.
+      Fixes bugs 13718 & 13924.
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index a834e7b..7061ab0 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -1378,8 +1378,10 @@ onionskin_answer(or_circuit_t *circ,
   log_debug(LD_CIRC,"Finished sending '%s' cell.",
             circ->is_first_hop ? "created_fast" : "created");
 
-  if (!channel_is_local(circ->p_chan) &&
-      !channel_is_outgoing(circ->p_chan)) {
+  /* Ignore the local bit when testing - many test networks run on local
+   * addresses */
+  if ((!channel_is_local(circ->p_chan) || get_options()->TestingTorNetwork)
+      && !channel_is_outgoing(circ->p_chan)) {
     /* record that we could process create cells from a non-local conn
      * that we didn't initiate; presumably this means that create cells
      * can reach us too. */





More information about the tor-commits mailing list