Преглед на файлове

Bitwise check BRIDGE_DIRINFO

Bitwise check for the BRIDGE_DIRINFO flag, rather than checking for
equality.

Fixes a (potential) bug where directories offering BRIDGE_DIRINFO,
and some other flag (i.e. microdescriptors or extrainfo),
would be ignored when looking for bridge directories.

Final fix in series for bug 13163.
teor преди 11 години
родител
ревизия
31bf8f2690
променени са 2 файла, в които са добавени 8 реда и са изтрити 3 реда
  1. 5 0
      changes/bug13163-bitwise-check-BRIDGE-DIRINFO
  2. 3 3
      src/or/directory.c

+ 5 - 0
changes/bug13163-bitwise-check-BRIDGE-DIRINFO

@@ -0,0 +1,5 @@
+  o Minor bugfixes:
+    - Bitwise check the BRIDGE_DIRINFO flag rather than using equality.
+      Fixes a (potential) bug where directories offering BRIDGE_DIRINFO and
+      some other flag (i.e. microdescriptors or extrainfo) would be ignored
+      when looking for bridge directories. Partially fixes bug 13163.

+ 3 - 3
src/or/directory.c

@@ -452,7 +452,7 @@ directory_get_from_dirserver(uint8_t dir_purpose, uint8_t router_purpose,
     return;
 
   if (!get_via_tor) {
-    if (options->UseBridges && type != BRIDGE_DIRINFO) {
+    if (options->UseBridges && !(type & BRIDGE_DIRINFO)) {
       /* We want to ask a running bridge for which we have a descriptor.
        *
        * When we ask choose_random_entry() for a bridge, we specify what
@@ -479,7 +479,7 @@ directory_get_from_dirserver(uint8_t dir_purpose, uint8_t router_purpose,
                            "nodes are available yet.");
       return;
     } else {
-      if (prefer_authority || type == BRIDGE_DIRINFO) {
+      if (prefer_authority || (type & BRIDGE_DIRINFO)) {
         /* only ask authdirservers, and don't ask myself */
         rs = router_pick_trusteddirserver(type, pds_flags);
         if (rs == NULL && (pds_flags & (PDS_NO_EXISTING_SERVERDESC_FETCH|
@@ -506,7 +506,7 @@ directory_get_from_dirserver(uint8_t dir_purpose, uint8_t router_purpose,
           return;
         }
       }
-      if (!rs && type != BRIDGE_DIRINFO) {
+      if (!rs && !(type & BRIDGE_DIRINFO)) {
         /* */
         rs = directory_pick_generic_dirserver(type, pds_flags,
                                               dir_purpose);