Opened 5 years ago

Last modified 2 years ago

#14581 new defect

Looking up bridge by ID may choose the wrong bridge

Reported by: sysrqb Owned by:
Priority: High Milestone: Tor: unspecified
Component: Core Tor/Tor Version:
Severity: Normal Keywords: tor-bridge tor-guards tor-pt refactor
Cc: Actual Points:
Parent ID: #14579 Points: 4
Reviewer: Sponsor: SponsorM-can

Description

As mentioned by arma in #14216 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;
    }

Child Tickets

Change History (15)

comment:1 Changed 5 years ago by sysrqb

Summary: Looking up entry nodes by ID results in a collision when we use transportsLooking up bridges by ID results in a collision when we use transports

comment:2 Changed 5 years ago by sysrqb

Parent ID: #14579

comment:3 Changed 5 years ago by sysrqb

Summary: Looking up bridges by ID results in a collision when we use transportsLooking up bridge by ID may choose the wrong bridge

comment:4 Changed 4 years ago by nickm

Status: newassigned

comment:5 Changed 4 years ago by nickm

Keywords: 027-triaged-1-out added

Marking triaged-out items from first round of 0.2.7 triage.

comment:6 Changed 4 years ago by nickm

Milestone: Tor: 0.2.7.x-finalTor: 0.2.???

Make all non-needs_review, non-needs_revision, 027-triaged-1-out items belong to 0.2.???

comment:7 Changed 3 years ago by teor

Milestone: Tor: 0.2.???Tor: 0.3.???

Milestone renamed

comment:8 Changed 3 years ago by nickm

Keywords: tor-03-unspecified-201612 added
Milestone: Tor: 0.3.???Tor: unspecified

Finally admitting that 0.3.??? was a euphemism for Tor: unspecified all along.

comment:9 Changed 2 years ago by nickm

Keywords: tor-03-unspecified-201612 removed

Remove an old triaging keyword.

comment:10 Changed 2 years ago by nickm

Keywords: 027-triaged-in added

comment:11 Changed 2 years ago by nickm

Keywords: 027-triaged-in removed

comment:12 Changed 2 years ago by nickm

Keywords: 027-triaged-1-out removed

comment:13 Changed 2 years ago by nickm

Status: assignednew

Change the status of all assigned/accepted Tor tickets with owner="" to "new".

comment:14 Changed 2 years ago by nickm

Keywords: tor-bridge tor-guards tor-pt refactor added
Points: 4
Priority: MediumHigh
Severity: Normal

comment:15 Changed 2 years ago by nickm

Sponsor: SponsorM-can
Note: See TracTickets for help on using tickets.