Looking up bridge by ID may choose the wrong bridge
As mentioned by arma in #14216 (moved) comment 3.
Basically, whenever we try to look up a bridge by ID we may not choose the one we want. If we configured multiple pluggable transports for the same bridge, each PT will be associated with the same ID. We usually stop searching when we find a matching ID in the list, but the first match may not be the transport we wanted.
As an example, node_is_a_configured_bridge():
int
node_is_a_configured_bridge(const node_t *node)
{
int retval = 0;
smartlist_t *orports = node_get_all_orports(node);
retval = get_configured_bridge_by_orports_digest(node->identity,
orports) != NULL;
calls get_configured_bridge_by_orports_digest()
static bridge_info_t *
get_configured_bridge_by_orports_digest(const char *digest,
const smartlist_t *orports)
{
if (!bridge_list)
return NULL;
SMARTLIST_FOREACH_BEGIN(bridge_list, bridge_info_t *, bridge)
{
if (tor_digest_is_zero(bridge->identity)) {
SMARTLIST_FOREACH_BEGIN(orports, tor_addr_port_t *, ap)
{
if (tor_addr_compare(&bridge->addr, &ap->addr, CMP_EXACT) == 0 &&
bridge->port == ap->port)
return bridge;
}
SMARTLIST_FOREACH_END(ap);
}
if (digest && tor_memeq(bridge->identity, digest, DIGEST_LEN))
return bridge;
}