]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: xprt-quic: finalize app layer initialization after ALPN nego
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 3 Dec 2021 13:44:21 +0000 (14:44 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 7 Dec 2021 14:37:53 +0000 (15:37 +0100)
The app layer is initialized after the handshake completion by the XPRT
stack. Call the finalize operation just after that.

Remove the erroneous call to finalize by the mux in the TPs callback as
the app layer is not yet initialized at this stage.

This should fix the missing H3 settings currently not emitted by
haproxy.

src/mux_quic.c
src/xprt_quic.c

index b15f1f7f32fdb0c7e0aebe1f132f628b93f99199..64990e461437b19ae9cc595dc2834d81f82b4331 100644 (file)
@@ -498,12 +498,6 @@ void quic_mux_transport_params_update(struct qcc *qcc)
                qcc->strms[QCS_SRV_BIDI].rx.max_data = srv_params->initial_max_stream_data_bidi_local;
                qcc->strms[QCS_SRV_UNI].rx.max_data = srv_params->initial_max_stream_data_uni;
        }
-
-       /* Now that we have all the flow control information, we can finalize the application
-        * context.
-        */
-       if (qcc->app_ops)
-               qcc->app_ops->finalize(qcc->ctx);
 }
 
 /* Initialize the mux once it's attached. For outgoing connections, the context
index c7056c07a4dc4c18b59eb9ad5be28aea0b93903f..0ed7336c35b0b7d8ea5498e2dd52d700ffdfe1d2 100644 (file)
@@ -1827,6 +1827,7 @@ static inline int qc_provide_cdata(struct quic_enc_level *el,
 {
        int ssl_err, state;
        struct quic_conn *qc;
+       const struct qcc_app_ops *app_ops;
        const char *alpn;
        int alpn_len;
 
@@ -1887,12 +1888,10 @@ static inline int qc_provide_cdata(struct quic_enc_level *el,
 
        conn_get_alpn(ctx->conn, &alpn, &alpn_len);
        if (alpn_len >= 2 && memcmp(alpn, "h3", 2) == 0) {
-               qc->qcc->app_ops = &h3_ops;
-               if (!qc->qcc->app_ops->init(qc->qcc))
-                       goto err;
+               app_ops = qc->qcc->app_ops = &h3_ops;
        }
        else if (alpn_len >= 10 && memcmp(alpn, "hq-interop", 10) == 0) {
-               qc->qcc->app_ops = &hq_interop_ops;
+               app_ops = qc->qcc->app_ops = &hq_interop_ops;
        }
        else {
                /* TODO RFC9001 8.1. Protocol Negotiation
@@ -1902,6 +1901,14 @@ static inline int qc_provide_cdata(struct quic_enc_level *el,
                goto err;
        }
 
+       if (app_ops->init) {
+               if (!app_ops->init(qc->qcc))
+                       goto err;
+       }
+
+       if (app_ops->finalize)
+               app_ops->finalize(qc->qcc->ctx);
+
  out:
        TRACE_LEAVE(QUIC_EV_CONN_SSLDATA, ctx->conn);
        return 1;