summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Perry <mikeperry-git@torproject.org>2018-01-20 03:16:24 +0000
committerMike Perry <mikeperry-git@torproject.org>2018-01-20 03:18:31 +0000
commitdb5b670d85febc6e3011932f8f0c7d383d4b9bea (patch)
tree185ec7f70716c45f44bd24e7b8414596d07f7acd
parent48a51c5f8b80a359da31bc5aaac8ecd25890fe0d (diff)
downloadtor-db5b670d85febc6e3011932f8f0c7d383d4b9bea.tar.gz
tor-db5b670d85febc6e3011932f8f0c7d383d4b9bea.zip
Bug 24946: Fix a warning message caused by a missed purpose check.
Also fix three other checks (found by inspection of all CIRCUIT_PURPOSE_C_GENERAL occurrences).
-rw-r--r--changes/bug249465
-rw-r--r--src/or/circuituse.c2
-rw-r--r--src/or/connection_edge.c3
-rw-r--r--src/or/hs_circuit.c6
-rw-r--r--src/or/rendservice.c7
5 files changed, 21 insertions, 2 deletions
diff --git a/changes/bug24946 b/changes/bug24946
new file mode 100644
index 0000000000..7f8acfe5d0
--- /dev/null
+++ b/changes/bug24946
@@ -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.
diff --git a/src/or/circuituse.c b/src/or/circuituse.c
index 5f9567ea16..41ef088252 100644
--- a/src/or/circuituse.c
+++ b/src/or/circuituse.c
@@ -134,6 +134,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 &&
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c
index 4021ca9e0c..a47f044e08 100644
--- a/src/or/connection_edge.c
+++ b/src/or/connection_edge.c
@@ -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. "
diff --git a/src/or/hs_circuit.c b/src/or/hs_circuit.c
index 753c0fcd6a..2a41c1cccf 100644
--- a/src/or/hs_circuit.c
+++ b/src/or/hs_circuit.c
@@ -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
diff --git a/src/or/rendservice.c b/src/or/rendservice.c
index 52bd6683fd..f38895d5f1 100644
--- a/src/or/rendservice.c
+++ b/src/or/rendservice.c
@@ -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);