From: Hugo Landau Date: Thu, 9 Nov 2023 10:27:14 +0000 (+0000) Subject: QUIC CHANNEL: Keep a reference to our LCIDM X-Git-Tag: openssl-3.3.0-alpha1~425 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cce6fccd4ebf21e6107590c4700808eb72d198e5;p=thirdparty%2Fopenssl.git QUIC CHANNEL: Keep a reference to our LCIDM Reviewed-by: Tomas Mraz Reviewed-by: Matt Caswell (Merged from https://github.com/openssl/openssl/pull/22674) --- diff --git a/include/internal/quic_channel.h b/include/internal/quic_channel.h index 91366ec7cc0..61683aff6c7 100644 --- a/include/internal/quic_channel.h +++ b/include/internal/quic_channel.h @@ -111,6 +111,8 @@ typedef struct quic_channel_args_st { * QUIC_PORT must exceed that of the created channel. */ QUIC_PORT *port; + /* LCIDM to register LCIDs with. */ + QUIC_LCIDM *lcidm; int is_server; SSL *tls; diff --git a/ssl/quic/quic_channel.c b/ssl/quic/quic_channel.c index ebbc3e86a19..c366a087b78 100644 --- a/ssl/quic/quic_channel.c +++ b/ssl/quic/quic_channel.c @@ -12,6 +12,7 @@ #include "internal/quic_channel.h" #include "internal/quic_error.h" #include "internal/quic_rx_depack.h" +#include "internal/quic_lcidm.h" #include "../ssl_local.h" #include "quic_channel_local.h" #include "quic_port_local.h" @@ -227,7 +228,7 @@ static int ch_init(QUIC_CHANNEL *ch) size_t rx_short_dcid_len = ossl_quic_port_get_rx_short_dcid_len(ch->port); size_t tx_init_dcid_len = ossl_quic_port_get_tx_init_dcid_len(ch->port); - if (ch->port == NULL) + if (ch->port == NULL || ch->lcidm == NULL) goto err; ossl_list_stateless_reset_tokens_init(&ch->srt_list_seq); @@ -441,6 +442,7 @@ static void ch_cleanup(QUIC_CHANNEL *ch) ++pn_space) ossl_ackm_on_pkt_space_discarded(ch->ackm, pn_space); + ossl_quic_lcidm_cull(ch->lcidm, ch); ossl_quic_tx_packetiser_free(ch->txp); ossl_quic_txpim_free(ch->txpim); ossl_quic_cfq_free(ch->cfq); @@ -495,6 +497,7 @@ QUIC_CHANNEL *ossl_quic_channel_new(const QUIC_CHANNEL_ARGS *args) ch->port = args->port; ch->is_server = args->is_server; ch->tls = args->tls; + ch->lcidm = args->lcidm; if (!ch_init(ch)) { OPENSSL_free(ch); diff --git a/ssl/quic/quic_channel_local.h b/ssl/quic/quic_channel_local.h index dafe03fe8a2..8c8688aac2a 100644 --- a/ssl/quic/quic_channel_local.h +++ b/ssl/quic/quic_channel_local.h @@ -52,6 +52,9 @@ struct quic_channel_st { QUIC_TLS *qtls; SSL *tls; + /* Port LCIDM we use to register LCIDs. */ + QUIC_LCIDM *lcidm; + /* * The transport parameter block we will send or have sent. * Freed after sending or when connection is freed. diff --git a/ssl/quic/quic_port.c b/ssl/quic/quic_port.c index b99089e42bc..9be20c3f7b6 100644 --- a/ssl/quic/quic_port.c +++ b/ssl/quic/quic_port.c @@ -280,6 +280,7 @@ static QUIC_CHANNEL *port_make_channel(QUIC_PORT *port, SSL *tls, int is_server) args.port = port; args.is_server = is_server; args.tls = (tls != NULL ? tls : port_new_handshake_layer(port)); + args.lcidm = port->lcidm; if (args.tls == NULL) return NULL;