Skip to content

Commit

Permalink
QUIC APL: Provide the QUIC_CHANNEL with a currently unused QUIC_PORT
Browse files Browse the repository at this point in the history
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from #22674)
  • Loading branch information
hlandau committed Dec 21, 2023
1 parent 12ab8af commit f767101
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 9 deletions.
35 changes: 26 additions & 9 deletions ssl/quic/quic_impl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}

Expand Down
3 changes: 3 additions & 0 deletions ssl/quic/quic_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f767101

Please sign in to comment.