From: Nick Mathewson Date: Thu, 24 Apr 2025 18:19:31 +0000 (-0400) Subject: Rename "RENEGOTIATING state. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d3f560929f20bf9b8565ab6a00cc05106573b7da;p=thirdparty%2Ftor.git Rename "RENEGOTIATING state. --- diff --git a/src/core/mainloop/connection.c b/src/core/mainloop/connection.c index 5acb714b9e..559c640f42 100644 --- a/src/core/mainloop/connection.c +++ b/src/core/mainloop/connection.c @@ -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); } diff --git a/src/core/or/channeltls.c b/src/core/or/channeltls.c index c8e62cbaf7..e904fe1c4b 100644 --- a/src/core/or/channeltls.c +++ b/src/core/or/channeltls.c @@ -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"); diff --git a/src/core/or/connection_or.c b/src/core/or/connection_or.c index f406f2986f..703d13a28e 100644 --- a/src/core/or/connection_or.c +++ b/src/core/or/connection_or.c @@ -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; diff --git a/src/core/or/orconn_event.h b/src/core/or/orconn_event.h index 93034a7c97..e500a8363d 100644 --- a/src/core/or/orconn_event.h +++ b/src/core/or/orconn_event.h @@ -35,10 +35,8 @@ * 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. */