MINOR: quic: emit CONNECTION_CLOSE on app init error

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.
This commit is contained in:
Amaury Denoyelle 2022-04-14 14:59:35 +02:00
parent 05d4ae6436
commit 5d774dee55

View 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;
}