aboutsummaryrefslogtreecommitdiff
path: root/src/or
diff options
context:
space:
mode:
authorKarsten Loesing <karsten.loesing@gmx.net>2008-06-24 20:39:47 +0000
committerKarsten Loesing <karsten.loesing@gmx.net>2008-06-24 20:39:47 +0000
commit706d1b31a942087c825b196316c3d192073c9629 (patch)
tree77bd633e25145411283a2ebf01e136ad6557bac3 /src/or
parent80f03b67ef39fe613ca662bb0cf7b0371abe535d (diff)
downloadtor-706d1b31a942087c825b196316c3d192073c9629.tar.gz
tor-706d1b31a942087c825b196316c3d192073c9629.zip
Enable cannibalization of circuits for introduction circuits (backport r14166) and actually use introduction circuits that originate from cannibalization afterwards (backports r15332/r15335).
svn:r15459
Diffstat (limited to 'src/or')
-rw-r--r--src/or/circuitlist.c6
-rw-r--r--src/or/rendservice.c16
2 files changed, 19 insertions, 3 deletions
diff --git a/src/or/circuitlist.c b/src/or/circuitlist.c
index f43579efbb..7bd3829f62 100644
--- a/src/or/circuitlist.c
+++ b/src/or/circuitlist.c
@@ -814,9 +814,9 @@ circuit_find_to_cannibalize(uint8_t purpose, extend_info_t *info,
circuit_t *_circ;
origin_circuit_t *best=NULL;
- int need_uptime = flags & CIRCLAUNCH_NEED_UPTIME;
- int need_capacity = flags & CIRCLAUNCH_NEED_CAPACITY;
- int internal = flags & CIRCLAUNCH_IS_INTERNAL;
+ int need_uptime = (flags & CIRCLAUNCH_NEED_UPTIME) != 0;
+ int need_capacity = (flags & CIRCLAUNCH_NEED_CAPACITY) != 0;
+ int internal = (flags & CIRCLAUNCH_IS_INTERNAL) != 0;
log_debug(LD_CIRC,
"Hunting for a circ to cannibalize: purpose %d, uptime %d, "
diff --git a/src/or/rendservice.c b/src/or/rendservice.c
index 01b73adceb..9c41f3c0bc 100644
--- a/src/or/rendservice.c
+++ b/src/or/rendservice.c
@@ -797,6 +797,22 @@ rend_service_launch_establish_intro(rend_service_t *service,
escaped_safe_str(intro->extend_info->nickname));
return -1;
}
+
+ if (memcmp(intro->extend_info->identity_digest,
+ launched->build_state->chosen_exit->identity_digest, DIGEST_LEN)) {
+ char cann[HEX_DIGEST_LEN+1], orig[HEX_DIGEST_LEN+1];
+ base16_encode(cann, sizeof(cann),
+ launched->build_state->chosen_exit->identity_digest,
+ DIGEST_LEN);
+ base16_encode(orig, sizeof(orig),
+ intro->extend_info->identity_digest, DIGEST_LEN);
+ log_info(LD_REND, "The intro circuit we just cannibalized ends at $%s, "
+ "but we requested an intro circuit to $%s. Updating "
+ "our service.", cann, orig);
+ extend_info_free(intro->extend_info);
+ intro->extend_info = extend_info_dup(launched->build_state->chosen_exit);
+ }
+
strlcpy(launched->rend_query, service->service_id,
sizeof(launched->rend_query));
memcpy(launched->rend_pk_digest, service->pk_digest, DIGEST_LEN);