From: Hugo Landau Date: Thu, 9 Nov 2023 10:27:14 +0000 (+0000) Subject: QUIC PORT: Enable injection of incoming URXEs into a channel via default handler... X-Git-Tag: openssl-3.3.0-alpha1~426 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0df897321dc146e7ece7b23516cf24b5975f9dc0;p=thirdparty%2Fopenssl.git QUIC PORT: Enable injection of incoming URXEs into a channel via default handler rather than DEMUX routing Reviewed-by: Tomas Mraz Reviewed-by: Matt Caswell (Merged from https://github.com/openssl/openssl/pull/22674) --- diff --git a/include/internal/quic_channel.h b/include/internal/quic_channel.h index bdc48e50840..91366ec7cc0 100644 --- a/include/internal/quic_channel.h +++ b/include/internal/quic_channel.h @@ -276,6 +276,8 @@ void ossl_quic_channel_raise_net_error(QUIC_CHANNEL *ch); /* For use by QUIC_PORT only. */ void ossl_quic_channel_on_stateless_reset(QUIC_CHANNEL *ch); +void ossl_quic_channel_inject(QUIC_CHANNEL *ch, QUIC_URXE *e); + /* * Queries and Accessors * ===================== diff --git a/ssl/quic/quic_channel.c b/ssl/quic/quic_channel.c index c363b3bdde3..ebbc3e86a19 100644 --- a/ssl/quic/quic_channel.c +++ b/ssl/quic/quic_channel.c @@ -3029,6 +3029,11 @@ static void ch_save_err_state(QUIC_CHANNEL *ch) OSSL_ERR_STATE_save(ch->err_state); } +void ossl_quic_channel_inject(QUIC_CHANNEL *ch, QUIC_URXE *e) +{ + ossl_qrx_inject_urxe(ch->qrx, e); +} + void ossl_quic_channel_on_stateless_reset(QUIC_CHANNEL *ch) { QUIC_TERMINATE_CAUSE tcause = {0}; diff --git a/ssl/quic/quic_port.c b/ssl/quic/quic_port.c index 91240c3c0e1..b99089e42bc 100644 --- a/ssl/quic/quic_port.c +++ b/ssl/quic/quic_port.c @@ -444,7 +444,15 @@ static void port_default_packet_handler(QUIC_URXE *e, void *arg, QUIC_PORT *port = arg; PACKET pkt; QUIC_PKT_HDR hdr; - QUIC_CHANNEL *new_ch = NULL; + QUIC_CHANNEL *ch = NULL, *new_ch = NULL; + + if (dcid != NULL + && ossl_quic_lcidm_lookup(port->lcidm, dcid, NULL, + (void **)&ch)) { + assert(ch != NULL); + ossl_quic_channel_inject(ch, e); + return; + } if (port_try_handle_stateless_reset(port, e)) goto undesirable;