]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
rendservice: Always use a 3-hop path when a v2 single onion rend fails
authorteor <teor@torproject.org>
Fri, 23 Aug 2019 04:38:54 +0000 (14:38 +1000)
committerteor <teor@torproject.org>
Fri, 23 Aug 2019 05:01:48 +0000 (15:01 +1000)
Previously, we used a 1-hop path when a single onion rend failed
immediately, and a 3-hop path when it failed after trying to build
a circuit.

Fixes bug 23818; bugfix on 0.2.9.3-alpha.

src/or/rendservice.c

index 32b856452d27d3cfa57b18ecccc6d9969cae77f5..f145e9d694ec139f40583f7135cae1254cbb28b1 100644 (file)
@@ -2073,8 +2073,12 @@ rend_service_receive_introduction(origin_circuit_t *circuit,
     int flags = CIRCLAUNCH_NEED_CAPACITY | CIRCLAUNCH_IS_INTERNAL;
     if (circ_needs_uptime) flags |= CIRCLAUNCH_NEED_UPTIME;
     /* A Single Onion Service only uses a direct connection if its
-     * firewall rules permit direct connections to the address. */
-    if (rend_service_use_direct_connection(options, rp)) {
+     * firewall rules permit direct connections to the address.
+     *
+     * We only use a one-hop path on the first attempt. If the first attempt
+     * fails, we use a 3-hop path for reachability / reliability.
+     * See the comment in rend_service_relauch_rendezvous() for details. */
+    if (rend_service_use_direct_connection(options, rp) && i == 0) {
       flags = flags | CIRCLAUNCH_ONEHOP_TUNNEL;
     }
     launched = circuit_launch_by_extend_info(