[tor-commits] [tor/master] Bitwise check BRIDGE_DIRINFO
nickm at torproject.org
nickm at torproject.org
Thu Oct 9 14:56:39 UTC 2014
commit 31bf8f26907945b8f26a7543e42ce0e92dd4918f
Author: teor <teor2345 at gmail.com>
Date: Wed Oct 1 19:04:04 2014 +1000
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.
---
changes/bug13163-bitwise-check-BRIDGE-DIRINFO | 5 +++++
src/or/directory.c | 6 +++---
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/changes/bug13163-bitwise-check-BRIDGE-DIRINFO b/changes/bug13163-bitwise-check-BRIDGE-DIRINFO
new file mode 100644
index 0000000..7f5ec05
--- /dev/null
+++ b/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.
diff --git a/src/or/directory.c b/src/or/directory.c
index 12717eb..83cc56f 100644
--- a/src/or/directory.c
+++ b/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);
More information about the tor-commits
mailing list