QLOG: QUIC CHANNEL: Allow a log title to be specified

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22037)
This commit is contained in:
Hugo Landau 2023-09-08 13:37:18 +01:00
parent faf0912a2f
commit 407bcc8d55
3 changed files with 15 additions and 1 deletions

View File

@ -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. */

View File

@ -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)) {

View File

@ -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