]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
QUIC QRX: (Server support) Add support for manual URXE injection
authorHugo Landau <hlandau@openssl.org>
Tue, 22 Nov 2022 13:28:24 +0000 (13:28 +0000)
committerHugo Landau <hlandau@openssl.org>
Thu, 19 Jan 2023 13:17:39 +0000 (13:17 +0000)
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/19734)

include/internal/quic_record_rx.h
ssl/quic/quic_record_rx.c

index a72fb249728bb49c83df4e224fa113d6f561fda1..95c0fa56351d7283c20083fb99782925f30db0b5 100644 (file)
@@ -321,6 +321,15 @@ int ossl_qrx_set_early_validation_cb(OSSL_QRX *qrx,
                                      ossl_qrx_early_validation_cb *cb,
                                      void *cb_arg);
 
+/*
+ * Forcibly injects a URXE which has been issued by the DEMUX into the QRX for
+ * processing. This can be used to pass a received datagram to the QRX if it
+ * would not be correctly routed to the QRX via standard DCID-based routing; for
+ * example, when handling an incoming Initial packet which is attempting to
+ * establish a new connection.
+ */
+void ossl_qrx_inject_urxe(OSSL_QRX *qrx, QUIC_URXE *e);
+
 /*
  * Key Update (RX)
  * ===============
index 18a2428b6b6f480775ccfea220fe03639c563b79..cf9f960c3db637230181630ef560c236dc89c114 100644 (file)
@@ -217,10 +217,8 @@ void ossl_qrx_free(OSSL_QRX *qrx)
     OPENSSL_free(qrx);
 }
 
-static void qrx_on_rx(QUIC_URXE *urxe, void *arg)
+void ossl_qrx_inject_urxe(OSSL_QRX *qrx, QUIC_URXE *urxe)
 {
-    OSSL_QRX *qrx = arg;
-
     /* Initialize our own fields inside the URXE and add to the pending list. */
     urxe->processed     = 0;
     urxe->hpr_removed   = 0;
@@ -228,6 +226,12 @@ static void qrx_on_rx(QUIC_URXE *urxe, void *arg)
     ossl_list_urxe_insert_tail(&qrx->urx_pending, urxe);
 }
 
+static void qrx_on_rx(QUIC_URXE *urxe, void *arg)
+{
+    OSSL_QRX *qrx = arg;
+    ossl_qrx_inject_urxe(qrx, urxe);
+}
+
 int ossl_qrx_add_dst_conn_id(OSSL_QRX *qrx,
                              const QUIC_CONN_ID *dst_conn_id)
 {