Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug #29034: Cleanup hs circuit data when hs circs are repurposed. #931

wants to merge 1 commit into
base: maint-0.3.5
Changes from all commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.


Just for now

Bug #29034: Cleanup hs circuit data when hs circs are repurposed.

  • Loading branch information...
mikeperry-tor committed Apr 10, 2019
commit bee7979e87d51735d2d5f746d69761d89d7dd928
@@ -0,0 +1,5 @@
o Major bugfixes (Onion service reachability):
- Properly clean up the introduction point map and associated state when
circuits change purpose from onion service circuits to pathbias,
measurement, or other circuit types. This should fix some instances
of introduction point failure. Fixes bug 29034; bugfix on
@@ -3042,6 +3042,13 @@ circuit_change_purpose(circuit_t *circ, uint8_t new_purpose)

if (circ->purpose == new_purpose) return;

/* If our new circuit purpose is not an onion service one, free
* any onion service material.. otherwise just clean it up. */
if (circuit_purpose_is_hidden_service(circ->purpose) &&
!circuit_purpose_is_hidden_service(new_purpose)) {

if (CIRCUIT_IS_ORIGIN(circ)) {
char old_purpose_desc[80] = "";

@@ -1269,3 +1269,22 @@ hs_circ_cleanup(circuit_t *circ)

* We're about to destroy, free, or change the purpose of this circuit
* immedaitely. Make sure everything hs-related is cleaned up and freed.
hs_circ_free(circuit_t *circ)

if (CIRCUIT_IS_ORIGIN(circ)) {
origin_circuit_t *ocirc = TO_ORIGIN_CIRCUIT(circ);

ocirc->hs_ident = NULL;
@@ -17,6 +17,10 @@
/* Cleanup function when the circuit is closed or/and freed. */
void hs_circ_cleanup(circuit_t *circ);

/* Cleanup function when the circuit is immediately destroyed, freed, or
* changes purpose to something not controlled by HS code. */
void hs_circ_free(circuit_t *circ);

/* Circuit API. */
int hs_circ_service_intro_has_opened(hs_service_t *service,
hs_service_intro_point_t *ip,
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.