]> 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)
committerViktor Dukhovni <openssl-users@dukhovni.org>
Wed, 11 Sep 2024 08:00:08 +0000 (18:00 +1000)
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 e474ba9497ddfb7613eaea84a1b3a8c6a0b141f3..f6a8ed3f67862d3244278445527ad4290e63c7a0 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 ad82ba6d989e06b74fa6ea1f09214fddf2156296..64323c1c6e2d199154dfb4e0ee267ded174a3044 100644 (file)
@@ -435,6 +435,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;