summaryrefslogtreecommitdiff
path: root/src/or/entrynodes.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2014-05-14 14:34:01 -0400
committerNick Mathewson <nickm@torproject.org>2014-05-14 14:34:01 -0400
commit79c875ecdc546094dc761241a8f4cd7caccf9c0e (patch)
tree4e564d1a052451147e634297b9f917404ba8ce8e /src/or/entrynodes.c
parent747f368c6d72cc6a68bb0a12c4209c534517b656 (diff)
downloadtor-79c875ecdc546094dc761241a8f4cd7caccf9c0e.tar.gz
tor-79c875ecdc546094dc761241a8f4cd7caccf9c0e.zip
Would-be fix for bug 7733: learn bridge ID from descriptor
If somebody has configured a client to use a bridge without setting an identity digest (not recommended), learn the identity digest from whatever bridge descriptor we have downloaded or have in our cache.
Diffstat (limited to 'src/or/entrynodes.c')
-rw-r--r--src/or/entrynodes.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/or/entrynodes.c b/src/or/entrynodes.c
index 957217ac6c..daaac13edb 100644
--- a/src/or/entrynodes.c
+++ b/src/or/entrynodes.c
@@ -2187,6 +2187,13 @@ learned_bridge_descriptor(routerinfo_t *ri, int from_cache)
node = node_get_mutable_by_id(ri->cache_info.identity_digest);
tor_assert(node);
rewrite_node_address_for_bridge(bridge, node);
+ if (tor_digest_is_zero(bridge->identity)) {
+ memcpy(bridge->identity,ri->cache_info.identity_digest, DIGEST_LEN);
+ log_notice(LD_DIR, "Learned identity %s for bridge at %s:%d",
+ hex_str(bridge->identity, DIGEST_LEN),
+ fmt_and_decorate_addr(&bridge->addr),
+ (int) bridge->port);
+ }
add_an_entry_guard(node, 1, 1, 0, 0);
log_notice(LD_DIR, "new bridge descriptor '%s' (%s): %s", ri->nickname,