]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Don't keep creating CONNECTION_CLOSE frames
authorMatt Caswell <matt@openssl.org>
Fri, 18 Aug 2023 10:55:50 +0000 (11:55 +0100)
committerTomas Mraz <tomas@openssl.org>
Fri, 25 Aug 2023 06:42:39 +0000 (08:42 +0200)
If we want to send a CONNECTION_CLOSE frame then one is enough unless we
are scheduled to send another one. Now that we can create more than one
datagram in one go this is now required.

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21798)

include/internal/quic_txpim.h
ssl/quic/quic_txp.c
ssl/quic/quic_txpim.c

index 3415230c727064376982e5ce7fadcac042c3ab90..0f1f11c63095c246b88dc8394032b0af04847776 100644 (file)
@@ -40,6 +40,7 @@ typedef struct quic_txpim_pkt_st {
     unsigned int        had_max_streams_bidi_frame  : 1;
     unsigned int        had_max_streams_uni_frame   : 1;
     unsigned int        had_ack_frame               : 1;
+    unsigned int        had_conn_close              : 1;
 
     /* Private data follows. */
 } QUIC_TXPIM_PKT;
index 54b691c9bab08efddeca180f7060ef264ae13f51..51802ba7b6159df0c080e0672caabf2f09a3704d 100644 (file)
@@ -1804,6 +1804,7 @@ static int txp_generate_pre_token(OSSL_QUIC_TX_PACKETISER *txp,
             if (!tx_helper_commit(h))
                 return 0;
 
+            tpkt->had_conn_close = 1;
             *can_be_non_inflight = 0;
         } else {
             tx_helper_rollback(h);
@@ -2944,6 +2945,9 @@ static int txp_pkt_commit(OSSL_QUIC_TX_PACKETISER *txp,
     if (tpkt->had_ack_frame)
         txp->want_ack &= ~(1UL << pn_space);
 
+    if (tpkt->had_conn_close)
+        txp->want_conn_close = 0;
+
     /*
      * Decrement probe request counts if we have sent a packet that meets
      * the requirement of a probe, namely being ACK-eliciting.
index 3a7662292b9aa34154fbcf35baddeb9e28f01a54..716a0141ab5646e11c6d51cd3eeaa604f96a5d4b 100644 (file)
@@ -115,6 +115,7 @@ static void txpim_clear(QUIC_TXPIM_PKT_EX *ex)
     ex->public.had_max_streams_bidi_frame  = 0;
     ex->public.had_max_streams_uni_frame   = 0;
     ex->public.had_ack_frame               = 0;
+    ex->public.had_conn_close              = 0;
 }
 
 QUIC_TXPIM_PKT *ossl_quic_txpim_pkt_alloc(QUIC_TXPIM *txpim)