From: Hugo Landau Date: Fri, 8 Sep 2023 12:37:18 +0000 (+0100) Subject: QLOG: QUIC CHANNEL: Allow a log title to be specified X-Git-Tag: openssl-3.3.0-alpha1~217 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=407bcc8d55c06d556a1026aa83c62f10f923ebb2;p=thirdparty%2Fopenssl.git QLOG: QUIC CHANNEL: Allow a log title to be specified Reviewed-by: Matt Caswell Reviewed-by: Neil Horman (Merged from https://github.com/openssl/openssl/pull/22037) --- diff --git a/include/internal/quic_channel.h b/include/internal/quic_channel.h index 20d2ca86c42..aafdeca3d2a 100644 --- a/include/internal/quic_channel.h +++ b/include/internal/quic_channel.h @@ -122,6 +122,9 @@ typedef struct quic_channel_args_st { /* Whether to use QLOG. */ int use_qlog; + + /* Title to use for the QLOG session, or NULL. */ + const char *qlog_title; } QUIC_CHANNEL_ARGS; /* Represents the cause for a connection's termination. */ diff --git a/ssl/quic/quic_channel.c b/ssl/quic/quic_channel.c index 2b1838bb912..0311e9a7120 100644 --- a/ssl/quic/quic_channel.c +++ b/ssl/quic/quic_channel.c @@ -118,7 +118,7 @@ static QLOG *ch_get_qlog(QUIC_CHANNEL *ch) return NULL; qti.odcid = ch->init_dcid; - qti.title = NULL; + qti.title = ch->qlog_title; qti.description = NULL; qti.group_id = NULL; qti.is_server = ch->is_server; @@ -402,6 +402,7 @@ static void ch_cleanup(QUIC_CHANNEL *ch) if (ch->qlog != NULL) ossl_qlog_flush(ch->qlog); /* best effort */ + OPENSSL_free(ch->qlog_title); ossl_qlog_free(ch->qlog); #endif } @@ -420,6 +421,13 @@ QUIC_CHANNEL *ossl_quic_channel_new(const QUIC_CHANNEL_ARGS *args) ch->srtm = args->srtm; #ifndef OPENSSL_NO_QLOG ch->use_qlog = args->use_qlog; + + if (ch->use_qlog && args->qlog_title != NULL) { + if ((ch->qlog_title = OPENSSL_strdup(args->qlog_title)) == NULL) { + OPENSSL_free(ch); + return NULL; + } + } #endif if (!ch_init(ch)) { diff --git a/ssl/quic/quic_channel_local.h b/ssl/quic/quic_channel_local.h index 2a31848158c..4cd4dd84b70 100644 --- a/ssl/quic/quic_channel_local.h +++ b/ssl/quic/quic_channel_local.h @@ -437,6 +437,9 @@ struct quic_channel_st { /* Scratch area for use by RXDP to store decoded ACK ranges. */ OSSL_QUIC_ACK_RANGE *ack_range_scratch; size_t num_ack_range_scratch; + + /* Title for QLOG purposes. We own this copy. */ + char *quic_channel_local; }; # endif