summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeel Chauhan <neel@neelc.org>2020-11-09 14:31:01 -0800
committerDavid Goulet <dgoulet@torproject.org>2020-11-12 12:06:34 -0500
commit46ccde66a97d7985388eb54bc74a025402fb0a19 (patch)
tree86ad51c89f416a2056245e0f8c3b187ab5636431
parent4a0cd79588d2a472ab81e4f1d0e1e1bf6f2b390c (diff)
downloadtor-46ccde66a97d7985388eb54bc74a025402fb0a19.tar.gz
tor-46ccde66a97d7985388eb54bc74a025402fb0a19.zip
Use connection_or_change_state() in v3 handshaking state change
-rw-r--r--changes/bug328805
-rw-r--r--src/core/or/channeltls.c2
-rw-r--r--src/core/or/connection_or.c2
-rw-r--r--src/core/or/connection_or.h4
4 files changed, 9 insertions, 4 deletions
diff --git a/changes/bug32880 b/changes/bug32880
new file mode 100644
index 0000000000..a25cabb7dc
--- /dev/null
+++ b/changes/bug32880
@@ -0,0 +1,5 @@
+ o Minor bugfixes (circuit, handshake):
+ - In the v3 handshaking code, Use connection_or_change_state() to change
+ the state. Previously, we changed the state directly, but this did not
+ pass a state change to the pubsub or channel object. Fixes bug 32880;
+ bugfix on 0.2.3.6-alpha. Patch by Neel Chauhan.
diff --git a/src/core/or/channeltls.c b/src/core/or/channeltls.c
index 32723fed1e..b6fdbcc632 100644
--- a/src/core/or/channeltls.c
+++ b/src/core/or/channeltls.c
@@ -1428,7 +1428,7 @@ enter_v3_handshake_with_cell(var_cell_t *cell, channel_tls_t *chan)
"OR_HANDSHAKING_V3, on a connection we originated.");
}
connection_or_block_renegotiation(chan->conn);
- chan->conn->base_.state = OR_CONN_STATE_OR_HANDSHAKING_V3;
+ connection_or_change_state(chan->conn, OR_CONN_STATE_OR_HANDSHAKING_V3);
if (connection_init_or_handshake_state(chan->conn, started_here) < 0) {
connection_or_close_for_error(chan->conn, 0);
return -1;
diff --git a/src/core/or/connection_or.c b/src/core/or/connection_or.c
index bf29cd2c3a..70cb19a3f3 100644
--- a/src/core/or/connection_or.c
+++ b/src/core/or/connection_or.c
@@ -414,7 +414,7 @@ connection_or_state_publish(const or_connection_t *conn, uint8_t state)
* be notified.
*/
-MOCK_IMPL(STATIC void,
+MOCK_IMPL(void,
connection_or_change_state,(or_connection_t *conn, uint8_t state))
{
tor_assert(conn);
diff --git a/src/core/or/connection_or.h b/src/core/or/connection_or.h
index b6aaa44df2..8cbe8c028b 100644
--- a/src/core/or/connection_or.h
+++ b/src/core/or/connection_or.h
@@ -120,14 +120,14 @@ void connection_or_group_set_badness_(smartlist_t *group, int force);
#ifdef CONNECTION_OR_PRIVATE
STATIC int should_connect_to_relay(const or_connection_t *or_conn);
STATIC void note_or_connect_failed(const or_connection_t *or_conn);
+#endif /* defined(CONNECTION_OR_PRIVATE) */
/*
* Call this when changing connection state, so notifications to the owning
* channel can be handled.
*/
-MOCK_DECL(STATIC void,connection_or_change_state,
+MOCK_DECL(void, connection_or_change_state,
(or_connection_t *conn, uint8_t state));
-#endif /* defined(CONNECTION_OR_PRIVATE) */
#ifdef TOR_UNIT_TESTS
extern int testing__connection_or_pretend_TLSSECRET_is_supported;