Skip to content

Commit

Permalink
QUIC APL: Fix server API bugs discovered during test
Browse files Browse the repository at this point in the history
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from #23334)
  • Loading branch information
hlandau committed Apr 19, 2024
1 parent 3cd93c8 commit 12b8bf0
Showing 1 changed file with 18 additions and 11 deletions.
29 changes: 18 additions & 11 deletions ssl/quic/quic_impl.c
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,18 @@ SSL *ossl_quic_new(SSL_CTX *ctx)
return NULL;
}

QUIC_NEEDS_LOCK
static void quic_unref_port_bios(QUIC_PORT *port)
{
BIO *b;

b = ossl_quic_port_get_net_rbio(port);
BIO_free_all(b);

b = ossl_quic_port_get_net_wbio(port);
BIO_free_all(b);
}

QUIC_NEEDS_LOCK
static void qc_cleanup(QUIC_CONNECTION *qc, int have_lock)
{
Expand All @@ -530,15 +542,8 @@ static void qc_cleanup(QUIC_CONNECTION *qc, int have_lock)
ossl_quic_channel_free(qc->ch);
qc->ch = NULL;

if (qc->port != NULL) {
BIO *b;

b = ossl_quic_port_get_net_rbio(qc->port);
BIO_free_all(b);

b = ossl_quic_port_get_net_wbio(qc->port);
BIO_free_all(b);

if (qc->port != NULL && qc->listener == NULL) { /* TODO */
quic_unref_port_bios(qc->port);
ossl_quic_port_free(qc->port);
qc->port = NULL;
}
Expand All @@ -559,6 +564,7 @@ static void qc_cleanup(QUIC_CONNECTION *qc, int have_lock)
QUIC_TAKES_LOCK
static void quic_free_listener(QCTX *ctx)
{
quic_unref_port_bios(ctx->ql->port);
ossl_quic_port_free(ctx->ql->port);
ossl_quic_engine_free(ctx->ql->engine);
ossl_crypto_mutex_free(&ctx->ql->mutex);
Expand Down Expand Up @@ -1183,11 +1189,11 @@ int ossl_quic_handle_events(SSL *s)
{
QCTX ctx;

if (!expect_quic(s, &ctx))
if (!expect_quic_any(s, &ctx))
return 0;

qctx_lock(&ctx);
ossl_quic_reactor_tick(ossl_quic_channel_get_reactor(ctx.qc->ch), 0);
ossl_quic_reactor_tick(ossl_quic_obj_get0_reactor(ctx.obj), 0);
qctx_unlock(&ctx);
return 1;
}
Expand Down Expand Up @@ -4104,6 +4110,7 @@ static int ql_listen(QUIC_LISTENER *ql)
if (ql->listening)
return 1;

ossl_quic_port_set_allow_incoming(ql->port, 1);
ql->listening = 1;
return 1;
}
Expand Down

0 comments on commit 12b8bf0

Please sign in to comment.