summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--changes/bug173577
-rw-r--r--src/feature/rend/rendservice.c26
2 files changed, 31 insertions, 2 deletions
diff --git a/changes/bug17357 b/changes/bug17357
new file mode 100644
index 0000000000..1188b65fd7
--- /dev/null
+++ b/changes/bug17357
@@ -0,0 +1,7 @@
+ o Minor bugfixes (onion services):
+ - If we are relaunching a circuit to a rendevous service in
+ rend_service_relaunch_rendezvous() and hs_service_requires_uptime_circ()
+ is true, the CIRCLAUNCH_NEED_UPTIME flag is added to the circuit.
+ Previously, we only set this flag when we received a INTRODUCE2
+ cell in rend_service_receive_introduction(). Fixes bug 17357;
+ bugfix on 0.4.0.2-alpha. Patch by Neel Chauhan
diff --git a/src/feature/rend/rendservice.c b/src/feature/rend/rendservice.c
index 5ee084b0b7..73edcaccf5 100644
--- a/src/feature/rend/rendservice.c
+++ b/src/feature/rend/rendservice.c
@@ -3012,6 +3012,10 @@ rend_service_relaunch_rendezvous(origin_circuit_t *oldcirc)
{
origin_circuit_t *newcirc;
cpath_build_state_t *newstate, *oldstate;
+ const char *rend_pk_digest;
+ rend_service_t *service = NULL;
+
+ int flags = CIRCLAUNCH_NEED_CAPACITY | CIRCLAUNCH_IS_INTERNAL;
tor_assert(oldcirc->base_.purpose == CIRCUIT_PURPOSE_S_CONNECT_REND);
oldstate = oldcirc->build_state;
@@ -3026,13 +3030,31 @@ rend_service_relaunch_rendezvous(origin_circuit_t *oldcirc)
log_info(LD_REND,"Reattempting rendezvous circuit to '%s'",
safe_str(extend_info_describe(oldstate->chosen_exit)));
+ /* Look up the service. */
+ rend_pk_digest = (char *) rend_data_get_pk_digest(oldcirc->rend_data, NULL);
+ service = rend_service_get_by_pk_digest(rend_pk_digest);
+
+ if (!service) {
+ char serviceid[REND_SERVICE_ID_LEN_BASE32+1];
+ base32_encode(serviceid, REND_SERVICE_ID_LEN_BASE32+1,
+ rend_pk_digest, REND_SERVICE_ID_LEN);
+
+ log_warn(LD_BUG, "Internal error: Trying to relaunch a rendezvous circ "
+ "for an unrecognized service %s.",
+ safe_str_client(serviceid));
+ return;
+ }
+
+ if (hs_service_requires_uptime_circ(service->ports)) {
+ flags |= CIRCLAUNCH_NEED_UPTIME;
+ }
+
/* You'd think Single Onion Services would want to retry the rendezvous
* using a direct connection. But if it's blocked by a firewall, or the
* service is IPv6-only, or the rend point avoiding becoming a one-hop
* proxy, we need a 3-hop connection. */
newcirc = circuit_launch_by_extend_info(CIRCUIT_PURPOSE_S_CONNECT_REND,
- oldstate->chosen_exit,
- CIRCLAUNCH_NEED_CAPACITY|CIRCLAUNCH_IS_INTERNAL);
+ oldstate->chosen_exit, flags);
if (!newcirc) {
log_warn(LD_REND,"Couldn't relaunch rendezvous circuit to '%s'.",