From: Hugo Landau Date: Fri, 22 Mar 2024 07:24:05 +0000 (+0000) Subject: QUIC: Avoid ticking before a connection is established X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=72917c85eaddcee2e2f2a5f09d1e724ab785a48a;p=thirdparty%2Fopenssl.git QUIC: Avoid ticking before a connection is established Reviewed-by: Neil Horman Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/23995) --- diff --git a/ssl/quic/quic_channel.c b/ssl/quic/quic_channel.c index 2daf112f08b..3fa7a8c8f4a 100644 --- a/ssl/quic/quic_channel.c +++ b/ssl/quic/quic_channel.c @@ -1800,7 +1800,6 @@ static int ch_generate_transport_params(QUIC_CHANNEL *ch) ch->local_transport_params = (unsigned char *)buf_mem->data; buf_mem->data = NULL; - if (!ossl_quic_tls_set_transport_params(ch->qtls, ch->local_transport_params, buf_len)) goto err; @@ -1870,6 +1869,10 @@ void ossl_quic_channel_subtick(QUIC_CHANNEL *ch, QUIC_TICK_RESULT *res, * - determine the time at which we should next be ticked. */ + /* Nothing to do yet if connection has not been started. */ + if (ch->state == QUIC_CHANNEL_STATE_IDLE) + return; + /* If we are in the TERMINATED state, there is nothing to do. */ if (ossl_quic_channel_is_terminated(ch)) { res->net_read_desired = 0; diff --git a/ssl/quic/quic_tls.c b/ssl/quic/quic_tls.c index b2ad28e5d1f..d705f77678b 100644 --- a/ssl/quic/quic_tls.c +++ b/ssl/quic/quic_tls.c @@ -52,6 +52,9 @@ struct quic_tls_st { /* Set if the handshake has completed */ unsigned int complete : 1; + + /* Set if we have consumed the local transport parameters yet. */ + unsigned int local_transport_params_consumed : 1; }; struct ossl_record_layer_st { @@ -606,6 +609,7 @@ static int add_transport_params_cb(SSL *s, unsigned int ext_type, *out = qtls->local_transport_params; *outlen = qtls->local_transport_params_len; + qtls->local_transport_params_consumed = 1; return 1; } @@ -833,6 +837,9 @@ int ossl_quic_tls_set_transport_params(QUIC_TLS *qtls, const unsigned char *transport_params, size_t transport_params_len) { + if (qtls->local_transport_params_consumed) + return 0; + qtls->local_transport_params = transport_params; qtls->local_transport_params_len = transport_params_len; return 1;