summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorteor <teor2345@gmail.com>2016-08-18 13:15:48 +1000
committerNick Mathewson <nickm@torproject.org>2016-09-13 10:13:55 -0400
commite5ad00330c7e4f63898a15ab6a4d833b732601a2 (patch)
tree1cd17f2ce043f403a11db4a01fee6b0678ad4225
parent75ebbed5576d402ef2929ee043ab2170bff5cc2b (diff)
downloadtor-e5ad00330c7e4f63898a15ab6a4d833b732601a2.tar.gz
tor-e5ad00330c7e4f63898a15ab6a4d833b732601a2.zip
Make Tor2web work with ReachableAddresses and CRN_DIRECT_CONN
The changes in #19973 fixed ReachableAddresses being applied too broadly, but they also broke Tor2web (somewhat unintentional) compatibility with ReachableAddresses. This patch restores that functionality, which makes intro and rend point selection is consistent between Tor2web and Single Onion Services.
-rw-r--r--changes/feature171785
-rw-r--r--src/or/circuitbuild.c23
2 files changed, 26 insertions, 2 deletions
diff --git a/changes/feature17178 b/changes/feature17178
index 465f491e85..2bd2049bc5 100644
--- a/changes/feature17178
+++ b/changes/feature17178
@@ -9,6 +9,11 @@
works on the current tor network without any changes to older relays or
clients.
Implements proposal #260, completes ticket #17178. Patch by teor & asn.
+ o Minor features (Tor2web):
+ - Make Tor2web clients respect ReachableAddresses.
+ This feature was inadvertently enabled in 0.2.8.6, then removed
+ by bugfix #19973 on 0.2.8.7.
+ Implements feature #20034. Patch by teor.
o Minor bug fixes (Tor2web):
- Prevent Tor2web clients running hidden services, these services are
not anonymous due to the one-hop client paths.
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index 69a8a9c5ec..060a544ec5 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -1856,13 +1856,32 @@ pick_rendezvous_node(router_crn_flags_t flags)
flags |= CRN_ALLOW_INVALID;
#ifdef ENABLE_TOR2WEB_MODE
+ /* We want to connect directly to the node if we can */
+ router_crn_flags_t direct_flags = flags;
+ direct_flags |= CRN_PREF_ADDR;
+ direct_flags |= CRN_DIRECT_CONN;
+
/* The user wants us to pick specific RPs. */
if (options->Tor2webRendezvousPoints) {
- const node_t *tor2web_rp = pick_tor2web_rendezvous_node(flags, options);
+ const node_t *tor2web_rp = pick_tor2web_rendezvous_node(direct_flags,
+ options);
if (tor2web_rp) {
return tor2web_rp;
}
- /* Else, if no tor2web RP was found, fall back to choosing a random node */
+ }
+
+ /* Else, if no direct, preferred tor2web RP was found, fall back to choosing
+ * a random direct node */
+ const node_t *node = router_choose_random_node(NULL, options->ExcludeNodes,
+ direct_flags);
+ /* Return the direct node (if found), or log a message and fall back to an
+ * indirect connection. */
+ if (node) {
+ return node;
+ } else {
+ log_info(LD_REND,
+ "Unable to find a random rendezvous point that is reachable via "
+ "a direct connection, falling back to a 3-hop path.");
}
#endif