]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Rename "RENEGOTIATING state.
authorNick Mathewson <nickm@torproject.org>
Thu, 24 Apr 2025 18:19:31 +0000 (14:19 -0400)
committerNick Mathewson <nickm@torproject.org>
Thu, 24 Apr 2025 18:35:42 +0000 (14:35 -0400)
src/core/mainloop/connection.c
src/core/or/channeltls.c
src/core/or/connection_or.c
src/core/or/orconn_event.h

index 5acb714b9e7c160135ab957a9738afe6169fab11..559c640f426e3ec878302da148dfa862a2de8b97 100644 (file)
@@ -314,8 +314,8 @@ conn_state_to_string(int type, int state)
         case OR_CONN_STATE_CONNECTING: return "connect()ing";
         case OR_CONN_STATE_PROXY_HANDSHAKING: return "handshaking (proxy)";
         case OR_CONN_STATE_TLS_HANDSHAKING: return "handshaking (TLS)";
-        case OR_CONN_STATE_TLS_SERVER_RENEGOTIATING:
-          return "waiting for renegotiation or V3 handshake";
+        case OR_CONN_STATE_SERVER_VERSIONS_WAIT:
+          return "waiting for V3+ handshake";
         case OR_CONN_STATE_OR_HANDSHAKING_V3:
           return "handshaking (Tor, v3 handshake)";
         case OR_CONN_STATE_OPEN: return "open";
@@ -4506,7 +4506,7 @@ connection_handle_write_impl(connection_t *conn, int force)
         return -1;
       }
       return 0;
-    } else if (conn->state == OR_CONN_STATE_TLS_SERVER_RENEGOTIATING) {
+    } else if (conn->state == OR_CONN_STATE_SERVER_VERSIONS_WAIT) {
       return connection_handle_read(conn);
     }
 
index c8e62cbaf72895ced58a5cae69f706778d49c5be..e904fe1c4ba73537534408a2547f08c69ce876ab 100644 (file)
@@ -1246,7 +1246,7 @@ channel_tls_handle_var_cell(var_cell_t *var_cell, or_connection_t *conn)
       /* But that should be happening any longer've disabled bufferevents. */
       tor_assert_nonfatal_unreached_once();
       FALLTHROUGH_UNLESS_ALL_BUGS_ARE_FATAL;
-    case OR_CONN_STATE_TLS_SERVER_RENEGOTIATING:
+    case OR_CONN_STATE_SERVER_VERSIONS_WAIT:
       if (!(command_allowed_before_handshake(var_cell->command))) {
         log_fn(LOG_PROTOCOL_WARN, LD_PROTOCOL,
                "Received a cell with command %d in unexpected "
@@ -1416,7 +1416,7 @@ enter_v3_handshake_with_cell(var_cell_t *cell, channel_tls_t *chan)
 
   tor_assert(TO_CONN(chan->conn)->state == OR_CONN_STATE_TLS_HANDSHAKING ||
              TO_CONN(chan->conn)->state ==
-               OR_CONN_STATE_TLS_SERVER_RENEGOTIATING);
+                     OR_CONN_STATE_SERVER_VERSIONS_WAIT);
 
   if (started_here) {
     log_fn(LOG_PROTOCOL_WARN, LD_OR,
@@ -1476,7 +1476,6 @@ channel_tls_process_versions_cell(var_cell_t *cell, channel_tls_t *chan)
     case OR_CONN_STATE_OR_HANDSHAKING_V3:
       break;
     case OR_CONN_STATE_TLS_HANDSHAKING:
-    case OR_CONN_STATE_TLS_SERVER_RENEGOTIATING:
     default:
       log_fn(LOG_PROTOCOL_WARN, LD_OR,
              "VERSIONS cell while in unexpected state");
index f406f2986f17710845ae072f5af00187de7ef6cb..703d13a28eb517429b12b429dd2d4aa5e1a3fb7b 100644 (file)
@@ -1709,11 +1709,14 @@ connection_tls_continue_handshake(or_connection_t *conn)
           tor_assert(conn->base_.state == OR_CONN_STATE_TLS_HANDSHAKING);
           return connection_or_launch_v3_or_handshake(conn);
         } else {
-          /* v3 handshake, but we are not a client. */
+          /* v3+ handshake, but we are not a client. */
           log_debug(LD_OR, "Done with initial SSL handshake (server-side). "
                            "Expecting VERSIONS cell");
+          /* Note: We could instead just send a VERSIONS cell now,
+           * since the V2 handshake is no longer a thing.
+           * But that would require re-plumbing this state machine. */
           connection_or_change_state(conn,
-                        OR_CONN_STATE_TLS_SERVER_RENEGOTIATING);
+                                     OR_CONN_STATE_SERVER_VERSIONS_WAIT);
           connection_stop_writing(TO_CONN(conn));
           connection_start_reading(TO_CONN(conn));
           return 0;
index 93034a7c974418fc97df6a26b3cdade4ac195cf4..e500a8363d4d057d9cb61b8c157ccb185e3f478b 100644 (file)
  * yet. */
 #define OR_CONN_STATE_TLS_HANDSHAKING 3
 /** State for a connection at an OR: We're waiting for the client to
- * renegotiate (to indicate a v2 handshake) or send a versions cell (to
- * indicate a v3 handshake) */
-// XXXX Rename.
-#define OR_CONN_STATE_TLS_SERVER_RENEGOTIATING 5
+ * send a versions cell (to indicate a v3+ handshake) */
+#define OR_CONN_STATE_SERVER_VERSIONS_WAIT 5
 /** State for an OR connection: We're done with our SSL handshake, but we
  * haven't yet negotiated link protocol versions, done a V3 handshake, and
  * sent a netinfo cell. */