From 4295dd21bd9f0ce463fcefacb921094b1a3f9b4f Mon Sep 17 00:00:00 2001 From: Amaury Denoyelle Date: Mon, 13 May 2024 09:02:47 +0200 Subject: [PATCH] BUG/MINOR: mux-quic: fix error code on shutdown for non HTTP/3 qcc_shutdown() is called whenever the connection must be closed. If application protocol defined its owned shutdown callback, it is invoked to use the correct error code. Else transport error code NO_ERROR is used. A bug occurs in the latter case as NO_ERROR is used with quic_err_app() which is reserved for application errro codes. This will trigger the emission of a CONNECTION_CLOSE of type 0x1d (Application) instead of 0x1c (Transport). This bug is considered minor as it does not impact QUIC with HTTP/3. It may only be visible when using experimental HTTP/0.9 protocol. This should be backported up to 2.6. For 2.6, patch must be completed rewritten due to code differences. Here is the change to apply : diff --git a/src/mux_quic.c b/src/mux_quic.c index 26fb70ddf..c48f82e27 100644 --- a/src/mux_quic.c +++ b/src/mux_quic.c @@ -1918,7 +1918,9 @@ static void qc_release(struct qcc *qcc) qc_send(qcc); } else { - qcc_emit_cc_app(qcc, QC_ERR_NO_ERROR, 0); + /* Duplicate from qcc_emit_cc_app() for Transport error code. */ + if (!(qcc->conn->handle.qc->flags & QUIC_FL_CONN_IMMEDIATE_CLOSE)) + qcc->conn->handle.qc->err = quic_err_transport(QC_ERR_NO_ERROR); } } --- src/mux_quic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mux_quic.c b/src/mux_quic.c index 23df3f14d..7d7420f35 100644 --- a/src/mux_quic.c +++ b/src/mux_quic.c @@ -2352,7 +2352,7 @@ static void qcc_shutdown(struct qcc *qcc) qcc_io_send(qcc); } else { - qcc->err = quic_err_app(QC_ERR_NO_ERROR); + qcc->err = quic_err_transport(QC_ERR_NO_ERROR); } /* Register "no error" code at transport layer. Do not use