mirror of https://github.com/openssl/openssl.git
QLOG: Wiring: QUIC CHANNEL
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:
parent
00b27f33e6
commit
2031c0e928
|
@ -15,6 +15,7 @@
|
|||
# include "internal/quic_record_tx.h"
|
||||
# include "internal/quic_wire.h"
|
||||
# include "internal/quic_predef.h"
|
||||
# include "internal/qlog.h"
|
||||
# include "internal/time.h"
|
||||
# include "internal/thread.h"
|
||||
|
||||
|
@ -118,6 +119,9 @@ typedef struct quic_channel_args_st {
|
|||
|
||||
int is_server;
|
||||
SSL *tls;
|
||||
|
||||
/* Whether to use QLOG. */
|
||||
int use_qlog;
|
||||
} QUIC_CHANNEL_ARGS;
|
||||
|
||||
/* Represents the cause for a connection's termination. */
|
||||
|
|
|
@ -103,6 +103,36 @@ static void ch_raise_version_neg_failure(QUIC_CHANNEL *ch);
|
|||
|
||||
DEFINE_LHASH_OF_EX(QUIC_SRT_ELEM);
|
||||
|
||||
QUIC_NEEDS_LOCK
|
||||
static QLOG *ch_get_qlog(QUIC_CHANNEL *ch)
|
||||
{
|
||||
#ifndef OPENSSL_NO_QLOG
|
||||
QLOG_TRACE_INFO qti = {0};
|
||||
|
||||
if (ch->qlog != NULL)
|
||||
return ch->qlog;
|
||||
|
||||
if (!ch->use_qlog)
|
||||
return NULL;
|
||||
|
||||
qti.odcid = ch->init_dcid;
|
||||
qti.title = NULL;
|
||||
qti.description = NULL;
|
||||
qti.group_id = NULL;
|
||||
qti.is_server = ch->is_server;
|
||||
qti.now_cb = get_time;
|
||||
qti.now_cb_arg = ch;
|
||||
if ((ch->qlog = ossl_qlog_new_from_env(&qti)) == NULL) {
|
||||
ch->use_qlog = 0; /* don't try again */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return ch->qlog;
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* QUIC Channel Initialization and Teardown
|
||||
* ========================================
|
||||
|
@ -364,6 +394,13 @@ static void ch_cleanup(QUIC_CHANNEL *ch)
|
|||
ossl_list_ch_remove(&ch->port->channel_list, ch);
|
||||
ch->on_port_list = 0;
|
||||
}
|
||||
|
||||
#ifndef OPENSSL_NO_QLOG
|
||||
if (ch->qlog != NULL)
|
||||
ossl_qlog_flush(ch->qlog); /* best effort */
|
||||
|
||||
ossl_qlog_free(ch->qlog);
|
||||
#endif
|
||||
}
|
||||
|
||||
QUIC_CHANNEL *ossl_quic_channel_new(const QUIC_CHANNEL_ARGS *args)
|
||||
|
@ -378,6 +415,9 @@ QUIC_CHANNEL *ossl_quic_channel_new(const QUIC_CHANNEL_ARGS *args)
|
|||
ch->tls = args->tls;
|
||||
ch->lcidm = args->lcidm;
|
||||
ch->srtm = args->srtm;
|
||||
#ifndef OPENSSL_NO_QLOG
|
||||
ch->use_qlog = args->use_qlog;
|
||||
#endif
|
||||
|
||||
if (!ch_init(ch)) {
|
||||
OPENSSL_free(ch);
|
||||
|
|
|
@ -49,6 +49,9 @@ struct quic_channel_st {
|
|||
/* SRTM we register SRTs with. */
|
||||
QUIC_SRTM *srtm;
|
||||
|
||||
/* Optional QLOG instance (or NULL). */
|
||||
QLOG *qlog;
|
||||
|
||||
/*
|
||||
* The transport parameter block we will send or have sent.
|
||||
* Freed after sending or when connection is freed.
|
||||
|
@ -425,6 +428,9 @@ struct quic_channel_st {
|
|||
/* Are we on the QUIC_PORT linked list of channels? */
|
||||
unsigned int on_port_list : 1;
|
||||
|
||||
/* Has QLOG been requested? */
|
||||
unsigned int use_qlog : 1;
|
||||
|
||||
/* Saved error stack in case permanent error was encountered */
|
||||
ERR_STATE *err_state;
|
||||
|
||||
|
|
|
@ -1508,6 +1508,9 @@ static int create_channel(QUIC_CONNECTION *qc)
|
|||
QUIC_RAISE_NON_NORMAL_ERROR(NULL, ERR_R_INTERNAL_ERROR, NULL);
|
||||
return 0;
|
||||
}
|
||||
#ifndef OPENSSL_NO_QLOG
|
||||
args.use_qlog = 1; /* disabled if env not set */
|
||||
#endif
|
||||
|
||||
port_args.channel_ctx = qc->ssl.ctx;
|
||||
qc->port = ossl_quic_engine_create_port(qc->engine, &port_args);
|
||||
|
|
Loading…
Reference in New Issue