]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
QUIC PORT: Enable injection of incoming URXEs into a channel via default handler...
authorHugo Landau <hlandau@openssl.org>
Thu, 9 Nov 2023 10:27:14 +0000 (10:27 +0000)
committerHugo Landau <hlandau@openssl.org>
Thu, 21 Dec 2023 08:11:59 +0000 (08:11 +0000)
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22674)

include/internal/quic_channel.h
ssl/quic/quic_channel.c
ssl/quic/quic_port.c

index bdc48e50840a8f70d9059115c66a5dd1e0298339..91366ec7cc067e747aedcbcace4f89f3f3c81b41 100644 (file)
@@ -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
  * =====================
index c363b3bdde32f04b924e828055ff81d526bbb346..ebbc3e86a19ae19b3a7ff016a417d1d97cb2a61c 100644 (file)
@@ -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};
index 91240c3c0e193210c9c00258a6a54bf7ed571156..b99089e42bc3caa46fc210a2f3b5c2d3a9a00d10 100644 (file)
@@ -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;