Ticket #13163: 03-UseBridges-check-bridge-type-bit.patch

File 03-UseBridges-check-bridge-type-bit.patch, 1.4 KB (added by teor, 6 years ago)

Have UseBridges check the bridge bit, rather than checking equality (all other comparisons check bits)

  • src/or/directory.c

    diff --git a/src/or/directory.c b/src/or/directory.c
    index 1aaa75c..032b971 100644
    a b directory_get_from_dirserver(uint8_t dir_purpose, uint8_t router_purpose, 
    452452    return;
    453453
    454454  if (!get_via_tor) {
    455     if (options->UseBridges && type != BRIDGE_DIRINFO) {
     455    if (options->UseBridges && (type & BRIDGE_DIRINFO)) {
    456456      /* We want to ask a running bridge for which we have a descriptor.
    457457       *
    458458       * When we ask choose_random_entry() for a bridge, we specify what
    directory_get_from_dirserver(uint8_t dir_purpose, uint8_t router_purpose, 
    479479                           "nodes are available yet.");
    480480      return;
    481481    } else {
    482       if (prefer_authority || type == BRIDGE_DIRINFO) {
     482      if (prefer_authority || (type & BRIDGE_DIRINFO)) {
    483483        /* only ask authdirservers, and don't ask myself */
    484484        rs = router_pick_trusteddirserver(type, pds_flags);
    485485        if (rs == NULL && (pds_flags & (PDS_NO_EXISTING_SERVERDESC_FETCH|
    directory_get_from_dirserver(uint8_t dir_purpose, uint8_t router_purpose, 
    506506          return;
    507507        }
    508508      }
    509       if (!rs && type != BRIDGE_DIRINFO) {
     509      if (!rs && !(type & BRIDGE_DIRINFO)) {
    510510        /* */
    511511        rs = directory_pick_generic_dirserver(type, pds_flags,
    512512                                              dir_purpose);