]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
QUIC PORT: Allow QUIC_PORT to throw away incoming connections
authorHugo Landau <hlandau@openssl.org>
Mon, 5 Feb 2024 16:31:23 +0000 (16:31 +0000)
committerNeil Horman <nhorman@openssl.org>
Mon, 17 Feb 2025 16:27:32 +0000 (11:27 -0500)
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23334)

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

index eb060581e017a711c5e8d6e7b31608d04da40097..1f8997a1591df3e4e340a506e907aa0e396cc8ac 100644 (file)
@@ -82,6 +82,11 @@ QUIC_CHANNEL *ossl_quic_port_create_incoming(QUIC_PORT *port, SSL *tls);
  */
 QUIC_CHANNEL *ossl_quic_port_pop_incoming(QUIC_PORT *port);
 
+/*
+ * Delete any channels which are pending acceptance.
+ */
+void ossl_quic_port_drop_incoming(QUIC_PORT *port);
+
 /*
  * Queries and Accessors
  * =====================
index 214227b8a74e0944f0450f11a3a11276d5d357ba..6562a70492d4472e54b8e958179d92a2879e439d 100644 (file)
@@ -565,6 +565,7 @@ QUIC_TAKES_LOCK
 static void quic_free_listener(QCTX *ctx)
 {
     quic_unref_port_bios(ctx->ql->port);
+    ossl_quic_port_drop_incoming(ctx->ql->port);
     ossl_quic_port_free(ctx->ql->port);
     ossl_quic_engine_free(ctx->ql->engine);
     ossl_crypto_mutex_free(&ctx->ql->mutex);
index f9e195902dec615b7c2cd2581fb9b1a17ae86af2..a33a7a337991025c04c183a5afed3287526b255e 100644 (file)
@@ -440,6 +440,22 @@ QUIC_CHANNEL *ossl_quic_port_pop_incoming(QUIC_PORT *port)
     return ch;
 }
 
+void ossl_quic_port_drop_incoming(QUIC_PORT *port)
+{
+    QUIC_CHANNEL *ch;
+    SSL *tls;
+
+    for (;;) {
+        ch = ossl_quic_port_pop_incoming(port);
+        if (ch == NULL)
+            break;
+
+        tls = ossl_quic_channel_get0_tls(ch);
+        ossl_quic_channel_free(ch);
+        SSL_free(tls);
+    }
+}
+
 void ossl_quic_port_set_allow_incoming(QUIC_PORT *port, int allow_incoming)
 {
     port->allow_incoming = allow_incoming;