diff options
author | teor <teor@torproject.org> | 2019-10-25 10:38:22 +1000 |
---|---|---|
committer | teor <teor@torproject.org> | 2019-10-25 10:38:22 +1000 |
commit | a91f52a443e605a5b8efd4fe0d4032512c23b6cd (patch) | |
tree | f55472331a8490b82b619d3d7512172b88f745fd /src/feature/dircommon | |
parent | b3d035d5c4ebe55a6793d80ade47e67ca514d4fd (diff) | |
parent | c8aa3cc17d9cf28ea98c4619984b3f9c0afa3f3a (diff) | |
download | tor-a91f52a443e605a5b8efd4fe0d4032512c23b6cd.tar.gz tor-a91f52a443e605a5b8efd4fe0d4032512c23b6cd.zip |
Merge branch 'maint-0.4.2'
Diffstat (limited to 'src/feature/dircommon')
-rw-r--r-- | src/feature/dircommon/directory.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/src/feature/dircommon/directory.c b/src/feature/dircommon/directory.c index b3db0aa108..8e5b413326 100644 --- a/src/feature/dircommon/directory.c +++ b/src/feature/dircommon/directory.c @@ -212,7 +212,8 @@ connection_dir_is_anonymous(const dir_connection_t *dir_conn) * be closed or marked for close. */ if (linked_conn == NULL || linked_conn->magic != EDGE_CONNECTION_MAGIC || conn->linked_conn_is_closed || conn->linked_conn->marked_for_close) { - log_info(LD_DIR, "Rejected HSDir request: not linked to edge"); + log_debug(LD_DIR, "Directory connection is not anonymous: " + "not linked to edge"); return false; } @@ -221,13 +222,27 @@ connection_dir_is_anonymous(const dir_connection_t *dir_conn) /* Can't be a circuit we initiated and without a circuit, no channel. */ if (circ == NULL || CIRCUIT_IS_ORIGIN(circ)) { - log_info(LD_DIR, "Rejected HSDir request: not on OR circuit"); + log_debug(LD_DIR, "Directory connection is not anonymous: " + "not on OR circuit"); return false; } - /* Get the previous channel to learn if it is a client or relay link. */ + /* It is possible that the circuit was closed because one of the channel was + * closed or a DESTROY cell was received. Either way, this connection can + * not continue so return that it is not anonymous since we can not know for + * sure if it is. */ + if (circ->marked_for_close) { + log_debug(LD_DIR, "Directory connection is not anonymous: " + "circuit marked for close"); + return false; + } + + /* Get the previous channel to learn if it is a client or relay link. We + * BUG() because if the circuit is not mark for close, we ought to have a + * p_chan else we have a code flow issue. */ if (BUG(CONST_TO_OR_CIRCUIT(circ)->p_chan == NULL)) { - log_info(LD_DIR, "Rejected HSDir request: no p_chan"); + log_debug(LD_DIR, "Directory connection is not anonymous: " + "no p_chan on circuit"); return false; } |