summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2016-03-24 15:03:50 -0400
committerNick Mathewson <nickm@torproject.org>2016-03-24 15:03:50 -0400
commitd5f50cb052a535b5193dc14ccfd3239a722943c2 (patch)
tree34120cadb2577794f07179b9e56f811667a35a01
parent4f86d75a4bece7768ddb87db0276268666efcf11 (diff)
parentba6509e9e1f9bfd052ea8bdfef104c87ee8ca6b9 (diff)
downloadtor-d5f50cb052a535b5193dc14ccfd3239a722943c2.tar.gz
tor-d5f50cb052a535b5193dc14ccfd3239a722943c2.zip
Merge remote-tracking branch 'dgoulet/bug18623_028_01'
-rw-r--r--src/or/directory.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/or/directory.c b/src/or/directory.c
index 21a879dcad..d057dacf51 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -1065,8 +1065,16 @@ directory_initiate_command_rend(const tor_addr_port_t *or_addr_port,
const int use_begindir = directory_command_should_use_begindir(options,
&or_addr_port->addr, or_addr_port->port,
router_purpose, indirection);
+ /* Is it an anonymous connection? Be careful, it could be either an OR or
+ * directory connection. */
const int anonymized_connection = dirind_is_anon(indirection);
- const int or_connection = use_begindir || anonymized_connection;
+ /* Is it a connection to our DirPort? */
+ const int dir_connection = (indirection == DIRIND_ANON_DIRPORT ||
+ indirection == DIRIND_DIRECT_CONN);
+ /* It's an OR connection if we should use BEGIN_DIR or if it's an
+ * anonymized connection but obviously not a directory connection. */
+ const int or_connection = (use_begindir ||
+ (anonymized_connection && !dir_connection));
tor_addr_t addr;
tor_addr_copy(&addr, &(or_connection ? or_addr_port : dir_addr_port)->addr);
@@ -1096,7 +1104,7 @@ directory_initiate_command_rend(const tor_addr_port_t *or_addr_port,
/* ensure that we don't make direct connections when a SOCKS server is
* configured. */
- if (!or_connection && !options->HTTPProxy &&
+ if (dir_connection && !options->HTTPProxy &&
(options->Socks4Proxy || options->Socks5Proxy)) {
log_warn(LD_DIR, "Cannot connect to a directory server through a "
"SOCKS proxy!");
@@ -1113,7 +1121,7 @@ directory_initiate_command_rend(const tor_addr_port_t *or_addr_port,
logged_backtrace = 1;
}
return;
- } else if (!or_connection && (!dir_addr_port->port
+ } else if (dir_connection && (!dir_addr_port->port
|| tor_addr_is_null(&dir_addr_port->addr))) {
static int logged_backtrace = 0;
log_warn(LD_DIR, "Cannot make an outgoing Dir connection without a Dir "
@@ -1153,7 +1161,7 @@ directory_initiate_command_rend(const tor_addr_port_t *or_addr_port,
if (rend_query)
conn->rend_data = rend_data_dup(rend_query);
- if (!or_connection) {
+ if (dir_connection && !anonymized_connection) {
/* then we want to connect to dirport directly */
if (options->HTTPProxy) {