[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] Use connection_or_change_state() in v3 handshaking state change



commit 46ccde66a97d7985388eb54bc74a025402fb0a19
Author: Neel Chauhan <neel@xxxxxxxxx>
Date:   Mon Nov 9 14:31:01 2020 -0800

    Use connection_or_change_state() in v3 handshaking state change
---
 changes/bug32880            | 5 +++++
 src/core/or/channeltls.c    | 2 +-
 src/core/or/connection_or.c | 2 +-
 src/core/or/connection_or.h | 4 ++--
 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;

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits