]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Start implementing SSL_listen_ex
authorNeil Horman <nhorman@openssl.org>
Thu, 10 Apr 2025 14:05:59 +0000 (10:05 -0400)
committerNeil Horman <nhorman@openssl.org>
Fri, 5 Dec 2025 15:13:14 +0000 (10:13 -0500)
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27397)

include/internal/quic_ssl.h
include/openssl/ssl.h.in
ssl/quic/quic_impl.c
ssl/ssl_lib.c

index 0df73c22003e3ff2c79805efd8344590adddcbb5..2fedff9d789167b651b09317968e1d221603ac19 100644 (file)
@@ -121,6 +121,7 @@ __owur SSL *ossl_quic_accept_connection(SSL *ssl, uint64_t flags);
 __owur size_t ossl_quic_get_accept_connection_queue_len(SSL *ssl);
 __owur int ossl_quic_listen(SSL *ssl);
 __owur int ossl_quic_get_peer_addr(SSL *ssl, BIO_ADDR *peer_addr);
+__owur int ossl_quic_peeloff_conn(SSL *listener, SSL *new_conn);
 
 __owur int ossl_quic_stream_reset(SSL *ssl,
                                   const SSL_STREAM_RESET_ARGS *args,
index 26dcd98e07f2cef26c7ecc9201e23cf771172d04..6f642746dd6fde054851b65df7af2146b94655dc 100644 (file)
@@ -2578,6 +2578,9 @@ void SSL_trace(int write_p, int version, int content_type,
 int DTLSv1_listen(SSL *s, BIO_ADDR *client);
 # endif
 
+
+__owur int SSL_listen_ex(SSL *listener, SSL *new_conn);
+
 # ifndef OPENSSL_NO_CT
 
 /*
index 0ca07589af43d8c21f0f68d93b2894b72de3e081..51cabf3fd9014e656534d7fbdf268be52e8f78dc 100644 (file)
@@ -4628,6 +4628,31 @@ int ossl_quic_listen(SSL *ssl)
     return ret;
 }
 
+QUIC_TAKES_LOCK
+int ossl_quic_peeloff_conn(SSL *listener, SSL *new_conn)
+{
+    QCTX lctx;
+    QCTX cctx;
+    QUIC_CHANNEL *new_ch;
+    int ret = 0;
+
+    if (!expect_quic_listener(listener, &lctx))
+        return 0;
+
+    if (!expect_quic_cs(new_conn, &cctx))
+        return 0;
+
+    qctx_lock_for_io(&lctx);
+    new_ch = ossl_quic_port_pop_incoming(lctx.ql->port);
+    if (new_ch != NULL) {
+        /*
+         * Do our cloning work here
+         */
+    }
+    qctx_unlock(&lctx);
+    return ret;
+}
+
 /*
  * SSL_accept_connection
  * ---------------------
index 488b68f828776e039019fef6bfa447d73609f88a..502d450b5e3a4b709c4b674082383c27ec1ec9a7 100644 (file)
@@ -8059,6 +8059,15 @@ int SSL_get_peer_addr(SSL *ssl, BIO_ADDR *peer_addr)
     return ossl_quic_get_peer_addr(ssl, peer_addr);
 #else
     return 0;
+}
+
+int SSL_listen_ex(SSL *listener, SSL *new_conn)
+{
+#ifndef OPENSSL_NO_QUIC
+    if (!IS_QUIC(listener) || !IS_QUIC(new_conn))
+        return ossl_quic_peeloff_conn(listener, new_conn);
+#else
+    return 0;
 #endif
 }