]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: quic-be: Add a function to initialize the QUIC client transport parameters
authorFrederic Lecaille <flecaille@haproxy.com>
Wed, 3 Jan 2024 13:36:44 +0000 (14:36 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 11 Jun 2025 16:37:34 +0000 (18:37 +0200)
Implement qc_srv_params_init() to initialize the QUIC client transport parameters
in relation with connections to haproxy servers/backends.

include/haproxy/quic_tp.h
src/quic_tp.c

index d3bdd18c9d8eff33942491a66bf2a2630cb100f8..651e95cdbfcfde05f28a3bd93b82978d7eb379c8 100644 (file)
@@ -26,6 +26,9 @@ int qc_lstnr_params_init(struct quic_conn *qc,
                          const unsigned char *dcid, size_t dcidlen,
                          const unsigned char *scid, size_t scidlen,
                          const struct quic_cid *token_odcid);
+void qc_srv_params_init(struct quic_conn *qc,
+                        const struct quic_transport_params *srv_params,
+                        const unsigned char *scid, size_t scidlen);
 
 /* Dump <cid> transport parameter connection ID value if present (non null length).
  * Used only for debugging purposes.
index caf66577e9fc4b617ea6b207f93911c5051ad714..4b081e2c46c12207fafec284be7167fa1dab6a93 100644 (file)
@@ -828,3 +828,21 @@ int qc_lstnr_params_init(struct quic_conn *qc,
        return 1;
 }
 
+/* QUIC client (or haproxy server) only function.
+ * Initialize the local transport parameters <rx_params> from <srv_params>
+ * coming from configuration and source connection ID).
+ * Never fails.
+ */
+void qc_srv_params_init(struct quic_conn *qc,
+                        const struct quic_transport_params *srv_params,
+                        const unsigned char *scid, size_t scidlen)
+{
+       struct quic_transport_params *rx_params = &qc->rx.params;
+
+       /* Copy the transport parameters. */
+       *rx_params = *srv_params;
+       /* Copy the initial source connection ID. */
+       memcpy(rx_params->initial_source_connection_id.data, scid, scidlen);
+       rx_params->initial_source_connection_id.len = scidlen;
+       TRACE_PROTO("\nRX(local) transp. params.", QUIC_EV_TRANSP_PARAMS, qc, rx_params);
+}