]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: quic: emit CONNECTION_CLOSE on app init error
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 14 Apr 2022 12:59:35 +0000 (14:59 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 14 Apr 2022 13:09:32 +0000 (15:09 +0200)
Emit a CONNECTION_CLOSE if the app layer cannot be properly initialized
on qc_xprt_start. This force the quic-conn to enter the closing state
before being closed.

Without this, quic-conn normal operations continue, despite the
app-layer reported as not initialized. This behavior is undefined, in
particular when handling STREAM frames.

src/xprt_quic.c

index 528f7c01067eafa9b1a78e512e214d84f836b100..812c2535633641a320e4384ecc6e11c0072b12cb 100644 (file)
@@ -5756,6 +5756,9 @@ static int qc_xprt_start(struct connection *conn, void *ctx)
        qc = conn->handle.qc;
        if (qcc_install_app_ops(qc->qcc, qc->app_ops)) {
                TRACE_PROTO("Cannot install app layer", QUIC_EV_CONN_LPKT, qc);
+               /* prepare a CONNECTION_CLOSE frame */
+               qc->err_code = QC_ERR_APPLICATION_ERROR;
+               qc->flags |= QUIC_FL_CONN_IMMEDIATE_CLOSE;
                return -1;
        }