MINOR: quic: define retry_source_connection_id TP
Define a new QUIC transport parameter retry_source_connection_id. This
parameter is set only by server, after issuing a Retry packet.
diff --git a/include/haproxy/xprt_quic-t.h b/include/haproxy/xprt_quic-t.h
index 78ced51..98a0ea7 100644
--- a/include/haproxy/xprt_quic-t.h
+++ b/include/haproxy/xprt_quic-t.h
@@ -306,6 +306,7 @@
#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 @@
* 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 2c41355..9e76c75 100644
--- a/include/haproxy/xprt_quic.h
+++ b/include/haproxy/xprt_quic.h
@@ -488,6 +488,8 @@
p->with_stateless_reset_token = 1;
p->active_connection_id_limit = 8;
+ p->retry_source_connection_id.len = 0;
+
}
/* Encode <addr> preferred address transport parameter in <buf> without its
@@ -779,6 +781,15 @@
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 6cf0d4b..83379d0 100644
--- a/src/xprt_quic.c
+++ b/src/xprt_quic.c
@@ -4198,6 +4198,9 @@
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);