]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Bitwise check BRIDGE_DIRINFO
authorteor <teor2345@gmail.com>
Wed, 1 Oct 2014 09:04:04 +0000 (19:04 +1000)
committerteor <teor2345@gmail.com>
Tue, 7 Oct 2014 18:37:15 +0000 (05:37 +1100)
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.

changes/bug13163-bitwise-check-BRIDGE-DIRINFO [new file with mode: 0644]
src/or/directory.c

diff --git a/changes/bug13163-bitwise-check-BRIDGE-DIRINFO b/changes/bug13163-bitwise-check-BRIDGE-DIRINFO
new file mode 100644 (file)
index 0000000..7f5ec05
--- /dev/null
@@ -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.
index 12717ebfeda3fb6da6d6b4af71cbbf68fc27f8fe..83cc56f35239c9341d10501b7ae1b59fa760bcce 100644 (file)
@@ -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);