From: Hugo Landau Date: Thu, 9 Nov 2023 10:27:13 +0000 (+0000) Subject: QUIC APL: Provide the QUIC_CHANNEL with a currently unused QUIC_PORT X-Git-Tag: openssl-3.3.0-alpha1~443 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f76710122599731dd9e023f9786b0f3f8863db25;p=thirdparty%2Fopenssl.git QUIC APL: Provide the QUIC_CHANNEL with a currently unused QUIC_PORT Reviewed-by: Tomas Mraz Reviewed-by: Matt Caswell (Merged from https://github.com/openssl/openssl/pull/22674) --- diff --git a/ssl/quic/quic_impl.c b/ssl/quic/quic_impl.c index 399d1d2afd1..adc954cafe8 100644 --- a/ssl/quic/quic_impl.c +++ b/ssl/quic/quic_impl.c @@ -15,6 +15,7 @@ #include "internal/quic_tls.h" #include "internal/quic_rx_depack.h" #include "internal/quic_error.h" +#include "internal/quic_port.h" #include "internal/time.h" typedef struct qctx_st QCTX; @@ -543,6 +544,7 @@ void ossl_quic_free(SSL *s) #endif ossl_quic_channel_free(ctx.qc->ch); + ossl_quic_port_free(ctx.qc->port); BIO_free_all(ctx.qc->net_rbio); BIO_free_all(ctx.qc->net_wbio); @@ -1487,19 +1489,34 @@ static int configure_channel(QUIC_CONNECTION *qc) QUIC_NEEDS_LOCK static int create_channel(QUIC_CONNECTION *qc) { - QUIC_CHANNEL_ARGS args = {0}; + QUIC_PORT_ARGS port_args = {0}; + QUIC_CHANNEL_ARGS ch_args = {0}; - args.libctx = qc->ssl.ctx->libctx; - args.propq = qc->ssl.ctx->propq; - args.is_server = qc->as_server; - args.tls = qc->tls; - args.mutex = qc->mutex; - args.now_cb = get_time_cb; - args.now_cb_arg = qc; + port_args.libctx = qc->ssl.ctx->libctx; + port_args.propq = qc->ssl.ctx->propq; + port_args.mutex = qc->mutex; + port_args.now_cb = get_time_cb; + port_args.now_cb_arg = qc; - qc->ch = ossl_quic_channel_new(&args); + qc->port = ossl_quic_port_new(&port_args); + if (qc->port == NULL) { + QUIC_RAISE_NON_NORMAL_ERROR(NULL, ERR_R_INTERNAL_ERROR, NULL); + return 0; + } + + ch_args.port = qc->port; + ch_args.libctx = qc->ssl.ctx->libctx; + ch_args.propq = qc->ssl.ctx->propq; + ch_args.is_server = qc->as_server; + ch_args.tls = qc->tls; + ch_args.mutex = qc->mutex; + ch_args.now_cb = get_time_cb; + ch_args.now_cb_arg = qc; + + qc->ch = ossl_quic_channel_new(&ch_args); if (qc->ch == NULL) { QUIC_RAISE_NON_NORMAL_ERROR(NULL, ERR_R_INTERNAL_ERROR, NULL); + ossl_quic_port_free(qc->port); return 0; } diff --git a/ssl/quic/quic_local.h b/ssl/quic/quic_local.h index 928ae4c6bf3..ef074daf713 100644 --- a/ssl/quic/quic_local.h +++ b/ssl/quic/quic_local.h @@ -118,6 +118,9 @@ struct quic_conn_st { SSL *tls; + /* The QUIC port representing the QUIC listener and socket. */ + QUIC_PORT *port; + /* * The QUIC channel providing the core QUIC connection implementation. Note * that this is not instantiated until we actually start trying to do the