aboutsummaryrefslogtreecommitdiff
path: root/src/core/or/circuituse.c
diff options
context:
space:
mode:
authorMike Perry <mikeperry-git@torproject.org>2019-06-05 11:50:44 -0700
committerMike Perry <mikeperry-git@torproject.org>2019-06-05 12:56:49 -0700
commita6399da598101d8046cbf7ab2d80051fd8820e2f (patch)
tree557d5617f4b096c18e02baeb9e4f6cfae28d9b0a /src/core/or/circuituse.c
parente5deb2bbc73d8830ae6c479a4532e72112f5484a (diff)
downloadtor-a6399da598101d8046cbf7ab2d80051fd8820e2f.tar.gz
tor-a6399da598101d8046cbf7ab2d80051fd8820e2f.zip
Bug 29034: Cleanup hs circuitmap when purpose changes.
Leave the other rend and hs_ident data around until circuit free, since code may still try to inspect it after marking the circuit for close. The circuitmap is the important thing to clean up, since repurposed intropoints must be removed from this map to ensure validity.
Diffstat (limited to 'src/core/or/circuituse.c')
-rw-r--r--src/core/or/circuituse.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/core/or/circuituse.c b/src/core/or/circuituse.c
index 02bfa15fb3..000a7c36da 100644
--- a/src/core/or/circuituse.c
+++ b/src/core/or/circuituse.c
@@ -3066,6 +3066,12 @@ circuit_change_purpose(circuit_t *circ, uint8_t new_purpose)
circ->purpose,
circuit_purpose_to_string(new_purpose),
new_purpose);
+
+ /* Take specific actions if we are repurposing a hidden service circuit. */
+ if (circuit_purpose_is_hidden_service(circ->purpose) &&
+ !circuit_purpose_is_hidden_service(new_purpose)) {
+ hs_circ_cleanup(circ);
+ }
}
old_purpose = circ->purpose;