aboutsummaryrefslogtreecommitdiff
path: root/src/or/entrynodes.c
diff options
context:
space:
mode:
authorrl1987 <rl1987@sdf.lonestar.org>2013-12-08 20:42:33 +0200
committerNick Mathewson <nickm@torproject.org>2013-12-09 11:22:22 -0500
commite6590efaa77c8cf186ce92e6ebad175e9c6450d1 (patch)
tree05efa32716a3d804dc2873dad9671a25ae531819 /src/or/entrynodes.c
parent9c048d90b6b17f6d54fd8adfbe301db6e98d6142 (diff)
downloadtor-e6590efaa77c8cf186ce92e6ebad175e9c6450d1.tar
tor-e6590efaa77c8cf186ce92e6ebad175e9c6450d1.tar.gz
Fix get_configured_bridge_by_addr_port_digest(.,.,NULL)
The old behavior was that NULL matched only bridges without known identities; the correct behavior is that NULL should match all bridges (assuming that their addr:port matches).
Diffstat (limited to 'src/or/entrynodes.c')
-rw-r--r--src/or/entrynodes.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/or/entrynodes.c b/src/or/entrynodes.c
index ebbd85c78..d463303fc 100644
--- a/src/or/entrynodes.c
+++ b/src/or/entrynodes.c
@@ -1657,7 +1657,8 @@ get_configured_bridge_by_orports_digest(const char *digest,
/** If we have a bridge configured whose digest matches <b>digest</b>, or a
* bridge with no known digest whose address matches <b>addr</b>:<b>/port</b>,
- * return that bridge. Else return NULL. */
+ * return that bridge. Else return NULL. If <b>digest</b> is NULL, check for
+ * address/port matches only. */
static bridge_info_t *
get_configured_bridge_by_addr_port_digest(const tor_addr_t *addr,
uint16_t port,
@@ -1667,7 +1668,7 @@ get_configured_bridge_by_addr_port_digest(const tor_addr_t *addr,
return NULL;
SMARTLIST_FOREACH_BEGIN(bridge_list, bridge_info_t *, bridge)
{
- if (tor_digest_is_zero(bridge->identity) &&
+ if ((tor_digest_is_zero(bridge->identity) || digest == NULL) &&
!tor_addr_compare(&bridge->addr, addr, CMP_EXACT) &&
bridge->port == port)
return bridge;