From dc08f8ac70e95b9a76f86a5e15dfcabd7ada25b9 Mon Sep 17 00:00:00 2001 From: teor Date: Fri, 23 Aug 2019 14:38:54 +1000 Subject: [PATCH 1/3] rendservice: Always use a 3-hop path when a v2 single onion rend fails 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 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/or/rendservice.c b/src/or/rendservice.c index 32b856452d..f145e9d694 100644 --- a/src/or/rendservice.c +++ b/src/or/rendservice.c @@ -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( From 144084d6facc3d688c7d423a8b5b8da5e26de84c Mon Sep 17 00:00:00 2001 From: teor Date: Fri, 23 Aug 2019 14:54:15 +1000 Subject: [PATCH 2/3] rendservice: Always use a 3-hop path when a v2 single onion intro fails Previously, we always used a 1-hop path, no matter how many times a v2 single onion intro failed. Fixes bug 23818; bugfix on 0.2.9.3-alpha. --- src/or/rendservice.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/or/rendservice.c b/src/or/rendservice.c index f145e9d694..ca1be5e5de 100644 --- a/src/or/rendservice.c +++ b/src/or/rendservice.c @@ -3041,8 +3041,15 @@ rend_service_launch_establish_intro(rend_service_t *service, extend_info_t *launch_ei = intro->extend_info; extend_info_t *direct_ei = NULL; - /* Are we in single onion mode? */ - if (rend_service_allow_non_anonymous_connection(options)) { + /* Are we in single onion mode? + * + * 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. + * (Unlike v3, retries is incremented by the caller after it calls this + * function.) + */ + if (rend_service_allow_non_anonymous_connection(options) && + intro->circuit_retries == 0) { /* Do we have a descriptor for the node? * We've either just chosen it from the consensus, or we've just reviewed * our intro points to see which ones are still valid, and deleted the ones From 231a74363fa9ccd1769b61229dc70a72e1e5807b Mon Sep 17 00:00:00 2001 From: teor Date: Fri, 23 Aug 2019 15:08:43 +1000 Subject: [PATCH 3/3] changes: file for 23818, v2 onion service fix --- changes/bug23818_v2 | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 changes/bug23818_v2 diff --git a/changes/bug23818_v2 b/changes/bug23818_v2 new file mode 100644 index 0000000000..0219a20f49 --- /dev/null +++ b/changes/bug23818_v2 @@ -0,0 +1,6 @@ + o Minor bugfixes (v2 single onion services): + - Always retry v2 single onion service intro and rend circuits with a + 3-hop path. Previously, v2 single onion services used a 3-hop path + when rend circuits were retried after a remote or delayed failure, + but a 1-hop path for immediate retries. Fixes bug 23818; + bugfix on 0.2.9.3-alpha.