diff --git a/include/haproxy/xprt_quic-t.h b/include/haproxy/xprt_quic-t.h index 78ced5160..98a0ea709 100644 --- a/include/haproxy/xprt_quic-t.h +++ b/include/haproxy/xprt_quic-t.h @@ -306,6 +306,7 @@ struct preferred_address { #define QUIC_TP_PREFERRED_ADDRESS 13 #define QUIC_TP_ACTIVE_CONNECTION_ID_LIMIT 14 #define QUIC_TP_INITIAL_SOURCE_CONNECTION_ID 15 +#define QUIC_TP_RETRY_SOURCE_CONNECTION_ID 16 /* * These defines are not for transport parameter type, but the maximum accepted value for @@ -346,6 +347,10 @@ struct quic_transport_params { * When received by clients, must be set to 1 if present. */ struct quic_cid original_destination_connection_id; /* Forbidden for clients */ + /* + * MUST be sent by servers after Retry. + */ + struct quic_cid retry_source_connection_id; /* Forbidden for clients */ /* MUST be present both for servers and clients. */ struct quic_cid initial_source_connection_id; struct preferred_address preferred_address; /* Forbidden for clients */ diff --git a/include/haproxy/xprt_quic.h b/include/haproxy/xprt_quic.h index 2c41355ba..9e76c7594 100644 --- a/include/haproxy/xprt_quic.h +++ b/include/haproxy/xprt_quic.h @@ -488,6 +488,8 @@ static inline void quic_transport_params_init(struct quic_transport_params *p, p->with_stateless_reset_token = 1; p->active_connection_id_limit = 8; + p->retry_source_connection_id.len = 0; + } /* Encode preferred address transport parameter in without its @@ -779,6 +781,15 @@ static inline int quic_transport_params_encode(unsigned char *buf, p->original_destination_connection_id.data, p->original_destination_connection_id.len)) return 0; + + if (p->retry_source_connection_id.len) { + if (!quic_transport_param_enc_mem(&pos, end, + QUIC_TP_RETRY_SOURCE_CONNECTION_ID, + p->retry_source_connection_id.data, + p->retry_source_connection_id.len)) + return 0; + } + if (p->with_stateless_reset_token && !quic_transport_param_enc_mem(&pos, end, QUIC_TP_STATELESS_RESET_TOKEN, p->stateless_reset_token, diff --git a/src/xprt_quic.c b/src/xprt_quic.c index 6cf0d4bb7..83379d097 100644 --- a/src/xprt_quic.c +++ b/src/xprt_quic.c @@ -4198,6 +4198,9 @@ static ssize_t qc_lstnr_pkt_rcv(unsigned char *buf, const unsigned char *end, TRACE_PROTO("Error during Initial token parsing", QUIC_EV_CONN_LPKT, qc); goto err; } + /* Copy retry_source_connection_id transport parameter. */ + quic_cid_cpy(&qc->rx.params.retry_source_connection_id, + &pkt->dcid); } else { memcpy(odcid->data, &pkt->dcid.data, pkt->dcid.len);