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.
This commit is contained in:
Amaury Denoyelle 2022-01-11 12:03:09 +01:00
parent 5ff1c9778c
commit c3b6f4d484
3 changed files with 19 additions and 0 deletions

View File

@ -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 */

View File

@ -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 <addr> preferred address transport parameter in <buf> 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,

View File

@ -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);