aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2017-05-02 19:18:04 -0400
committerNick Mathewson <nickm@torproject.org>2017-05-02 19:18:04 -0400
commit7bc9f93abbfcabba1acde441b5fac98d4676c08e (patch)
treefb81ff00f65a99dd7a669f3f9ab5c0ce02bae542
parenta91f948ccac5e681de9e8e63efb267c7ad9e9f5f (diff)
parentf9af7e8bd01d4b7a70776a96c649a89cf1717dd1 (diff)
downloadtor-7bc9f93abbfcabba1acde441b5fac98d4676c08e.tar.gz
tor-7bc9f93abbfcabba1acde441b5fac98d4676c08e.zip
Merge branch 'teor_connection-with-client-v2_squashed'
-rw-r--r--changes/bug214065
-rw-r--r--src/or/channel.h4
-rw-r--r--src/or/channeltls.c4
-rw-r--r--src/or/command.c10
-rw-r--r--src/or/or.h4
5 files changed, 19 insertions, 8 deletions
diff --git a/changes/bug21406 b/changes/bug21406
new file mode 100644
index 0000000000..170e631d79
--- /dev/null
+++ b/changes/bug21406
@@ -0,0 +1,5 @@
+ o Minor bugfixes (code correctness):
+ - Accurately identify client connections using their lack of peer
+ authentication. This means that we bail out earlier if asked to extend
+ to a client. Follow-up to 21407.
+ Fixes bug 21406; bugfix on 0.2.4.23.
diff --git a/src/or/channel.h b/src/or/channel.h
index 33dceb1be0..3d97b8e306 100644
--- a/src/or/channel.h
+++ b/src/or/channel.h
@@ -214,8 +214,8 @@ struct channel_s {
unsigned int is_bad_for_new_circs:1;
/** True iff we have decided that the other end of this connection
- * is a client. Channels with this flag set should never be used
- * to satisfy an EXTEND request. */
+ * is a client or bridge relay. Connections with this flag set should never
+ * be used to satisfy an EXTEND request. */
unsigned int is_client:1;
/** Set if the channel was initiated remotely (came from a listener) */
diff --git a/src/or/channeltls.c b/src/or/channeltls.c
index 9d9e7446ab..7c4dc9aa09 100644
--- a/src/or/channeltls.c
+++ b/src/or/channeltls.c
@@ -1654,6 +1654,10 @@ channel_tls_process_netinfo_cell(cell_t *cell, channel_tls_t *chan)
tor_assert(tor_mem_is_zero(
(const char*)(chan->conn->handshake_state->
authenticated_ed25519_peer_id.pubkey), 32));
+ /* If the client never authenticated, it's a tor client or bridge
+ * relay, and we must not use it for EXTEND requests (nor could we, as
+ * there are no authenticated peer IDs) */
+ channel_mark_client(TLS_CHAN_TO_BASE(chan));
channel_set_circid_type(TLS_CHAN_TO_BASE(chan), NULL,
chan->conn->link_proto < MIN_LINK_PROTO_FOR_WIDE_CIRC_IDS);
diff --git a/src/or/command.c b/src/or/command.c
index 0992e97b8b..c91a967fd4 100644
--- a/src/or/command.c
+++ b/src/or/command.c
@@ -344,8 +344,14 @@ command_process_create_cell(cell_t *cell, channel_t *chan)
int len;
created_cell_t created_cell;
- /* Make sure we never try to use the OR connection on which we
- * received this cell to satisfy an EXTEND request, */
+ /* If the client used CREATE_FAST, it's probably a tor client or bridge
+ * relay, and we must not use it for EXTEND requests (in most cases, we
+ * won't have an authenticated peer ID for the extend).
+ * Public relays on 0.2.9 and later will use CREATE_FAST if they have no
+ * ntor onion key for this relay, but that should be a rare occurrence.
+ * Clients on 0.3.1 and later avoid using CREATE_FAST as much as they can,
+ * even during bootstrap, so the CREATE_FAST check is most accurate for
+ * earlier tor client versions. */
channel_mark_client(chan);
memset(&created_cell, 0, sizeof(created_cell));
diff --git a/src/or/or.h b/src/or/or.h
index a09533f970..e30a1d24c8 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -1564,10 +1564,6 @@ typedef struct or_connection_t {
* NETINFO cell listed the address we're connected to as recognized. */
unsigned int is_canonical:1;
- /** True iff we have decided that the other end of this connection
- * is a client. Connections with this flag set should never be used
- * to satisfy an EXTEND request. */
- unsigned int is_connection_with_client:1;
/** True iff this is an outgoing connection. */
unsigned int is_outgoing:1;
unsigned int proxy_type:2; /**< One of PROXY_NONE...PROXY_SOCKS5 */