]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
QUIC: Avoid ticking before a connection is established
authorHugo Landau <hlandau@openssl.org>
Fri, 22 Mar 2024 07:24:05 +0000 (07:24 +0000)
committerNeil Horman <nhorman@openssl.org>
Mon, 17 Feb 2025 16:27:32 +0000 (11:27 -0500)
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23995)

ssl/quic/quic_channel.c
ssl/quic/quic_tls.c

index fa6bfb5d69d0b3dda2c9150776b59ab227333449..d266b4de6cb3b0155deb93867f79853bc9a8bc6a 100644 (file)
@@ -1820,7 +1820,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;
@@ -1890,6 +1889,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;
index bd5eed874adcedc0c4212d271d8d564b23fffb3d..821fcc50b7055df6c689dbeaf41694584d62958c 100644 (file)
@@ -53,6 +53,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 {
@@ -601,6 +604,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;
 }
 
@@ -852,6 +856,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;