]> git.kaiwu.me - haproxy.git/commitdiff
BUG/MEDIUM: mux_quic: fix FIN received with an already known offset
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 22 Oct 2026 08:04:23 +0000 (10:04 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 22 Oct 2026 08:11:46 +0000 (10:11 +0200)
The following patch improves STREAM FIN handling on received frames by
reducing the invokation of the parser. It requires to detect the case
where FIN is received standalone without any data,

  7dd1eec2b10bd13f05c792ec0e053c19aac952ee
  MINOR: mux-quic: refine reception of standalone STREAM FIN

This introduces an issue when STREAM FIN is received with an already
known offset. In this case, FIN is not considered standalone. However,
as the offset was already handled, parser is skipped and this prevents
closure of the stream Rx channel until its timeout.

Fix this by marking FIN as standalone after skipping already received
offset. Thus, if <len> is reduced to 0 in qcc_recv(), <fin_standalone>
will be set even if it was received with a payload.

This must be backported up to 3.2, which introduced the above patch.

src/mux_quic.c

index 2c55a0cba025d92779de89a6112ed5b51e3f2b72..97d4b871ebb2830f677bdd27647e6d8242091408 100644 (file)
@@ -1996,7 +1996,7 @@ static struct qc_stream_rxbuf *qcs_get_rxbuf(struct qcs *qcs, uint64_t offset,
 int qcc_recv(struct qcc *qcc, uint64_t id, uint64_t len, uint64_t offset,
              char fin, char *data)
 {
-       const int fin_standalone = (!len && fin);
+       int fin_standalone;
        struct qcs *qcs;
        enum ncb_ret ncb_ret;
        uint64_t left;
@@ -2086,6 +2086,9 @@ int qcc_recv(struct qcc *qcc, uint64_t id, uint64_t len, uint64_t offset,
                offset = qcs->rx.offset;
        }
 
+       /* If FIN received with an already known offset, fin_standalone must be set as well. */
+       fin_standalone = (!len && fin);
+
        if (len && (qcc->flags & QC_CF_WAIT_HS)) {
                if (!(qcc->conn->flags & CO_FL_EARLY_DATA)) {
                        /* Ensure 'Early-data: 1' will be set on the request. */