Skip to content

Commit

Permalink
Merge remote-tracking branch 'mikeperry/bug24946'
Browse files Browse the repository at this point in the history
  • Loading branch information
nmathewson committed Jan 23, 2018
2 parents 58f4aee + db5b670 commit 6f4ee6e
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 2 deletions.
5 changes: 5 additions & 0 deletions changes/bug24946
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
o Minor bugfixes (hidden services):
- Fix a warning caused by differentiating hsdir circuits from general
circuits. Also address three similar checks in the codebase that
were related to reuse and rate limiting of circuits. Fixes bug 24946;
bugfix on 0.3.3.0-alpha-dev; not in any released version of tor.
2 changes: 2 additions & 0 deletions src/or/circuituse.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ circuit_is_acceptable(const origin_circuit_t *origin_circ,
}

if (purpose == CIRCUIT_PURPOSE_C_GENERAL ||
purpose == CIRCUIT_PURPOSE_C_HSDIR_GET ||
purpose == CIRCUIT_PURPOSE_S_HSDIR_POST ||
purpose == CIRCUIT_PURPOSE_HS_VANGUARDS ||
purpose == CIRCUIT_PURPOSE_C_REND_JOINED) {
if (circ->timestamp_dirty &&
Expand Down
3 changes: 3 additions & 0 deletions src/or/connection_edge.c
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,10 @@ connection_ap_expire_beginning(void)
}
continue;
}

if (circ->purpose != CIRCUIT_PURPOSE_C_GENERAL &&
circ->purpose != CIRCUIT_PURPOSE_C_HSDIR_GET &&
circ->purpose != CIRCUIT_PURPOSE_S_HSDIR_POST &&
circ->purpose != CIRCUIT_PURPOSE_C_MEASURE_TIMEOUT &&
circ->purpose != CIRCUIT_PURPOSE_PATH_BIAS_TESTING) {
log_warn(LD_BUG, "circuit->purpose == CIRCUIT_PURPOSE_C_GENERAL failed. "
Expand Down
6 changes: 5 additions & 1 deletion src/or/hs_circuit.c
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,11 @@ hs_circ_service_intro_has_opened(hs_service_t *service,
/* Cleaning up the hidden service identifier and repurpose. */
hs_ident_circuit_free(circ->hs_ident);
circ->hs_ident = NULL;
circuit_change_purpose(TO_CIRCUIT(circ), CIRCUIT_PURPOSE_C_GENERAL);
if (circuit_should_use_vanguards(TO_CIRCUIT(circ)->purpose))
circuit_change_purpose(TO_CIRCUIT(circ), CIRCUIT_PURPOSE_HS_VANGUARDS);
else
circuit_change_purpose(TO_CIRCUIT(circ), CIRCUIT_PURPOSE_C_GENERAL);

/* Inform that this circuit just opened for this new purpose. */
circuit_has_opened(circ);
/* This return value indicate to the caller that the IP object should be
Expand Down
7 changes: 6 additions & 1 deletion src/or/rendservice.c
Original file line number Diff line number Diff line change
Expand Up @@ -3222,7 +3222,12 @@ rend_service_intro_has_opened(origin_circuit_t *circuit)
"circuit, but we already have enough. Redefining purpose to "
"general; leaving as internal.");

circuit_change_purpose(TO_CIRCUIT(circuit), CIRCUIT_PURPOSE_C_GENERAL);
if (circuit_should_use_vanguards(TO_CIRCUIT(circuit)->purpose)) {
circuit_change_purpose(TO_CIRCUIT(circuit),
CIRCUIT_PURPOSE_HS_VANGUARDS);
} else {
circuit_change_purpose(TO_CIRCUIT(circuit), CIRCUIT_PURPOSE_C_GENERAL);
}

{
rend_data_free(circuit->rend_data);
Expand Down

0 comments on commit 6f4ee6e

Please sign in to comment.