]> 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)
committerViktor Dukhovni <openssl-users@dukhovni.org>
Wed, 11 Sep 2024 08:35:22 +0000 (18:35 +1000)
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 2daf112f08b4483009c3b20bda25bed18ad4219d..3fa7a8c8f4ab66339dedd0692237e6b5e4d2ba5a 100644 (file)
@@ -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;
index b2ad28e5d1f6192d5596a4140b9d9327b89802af..d705f77678bd5b930ef77b4b8a30223d95d6832e 100644 (file)
@@ -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;