]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: quic: Stateless reset token copy to transport parameters
authorFrédéric Lécaille <flecaille@haproxy.com>
Mon, 9 May 2022 14:22:29 +0000 (16:22 +0200)
committerFrédéric Lécaille <flecaille@haproxy.com>
Thu, 12 May 2022 15:48:35 +0000 (17:48 +0200)
A server may send the stateless reset token associated to the current
connection from its transport parameters. So, let's copy it from
qc_lstnt_params_init().

src/xprt_quic.c

index 4a2e3ddfdcf07b0a4af31f087c5aac1ff563c469..a5bfa4a9de98d2e8dfded3b4c8f93e7ebc0173b2 100644 (file)
@@ -4391,12 +4391,16 @@ static int parse_retry_token(const unsigned char *token, uint64_t token_len,
  */
 static int qc_lstnr_params_init(struct quic_conn *qc, struct listener *l,
                                 const unsigned char *token, size_t token_len,
+                                const struct quic_connection_id *icid,
                                 const struct quic_cid *dcid)
 {
        struct quic_cid *odcid = &qc->rx.params.original_destination_connection_id;
 
        /* Copy the transport parameters. */
        qc->rx.params = l->bind_conf->quic_params;
+       /* Copy the stateless reset token */
+       memcpy(qc->rx.params.stateless_reset_token, icid->stateless_reset_token,
+              sizeof qc->rx.params.stateless_reset_token);
        /* Copy original_destination_connection_id transport parameter. */
        if (token_len) {
                if (parse_retry_token(token, token_len, odcid)) {
@@ -4544,7 +4548,7 @@ static struct quic_conn *qc_new_conn(unsigned int version, int ipv4,
        qc->sendto_err = 0;
        memcpy(&qc->peer_addr, saddr, sizeof qc->peer_addr);
 
-       if (server && !qc_lstnr_params_init(qc, l, token, token_len, dcid))
+       if (server && !qc_lstnr_params_init(qc, l, token, token_len, icid, dcid))
                goto err;
 
        TRACE_LEAVE(QUIC_EV_CONN_INIT, qc);