mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-06 07:07:04 +02:00
MINOR: quic-be: helper functions to save/restore transport params (0-RTT)
Define quic_early_transport_params new struct for QUIC transport parameters in relation with 0-RTT. This parameters must be saved during a first session to be reused for 0-RTT next sessions. qc_early_transport_params_cpy() copies the 0-RTT transport parameters to be saved during a first connection to a backend. The copy is made from a quic_transport_params struct to a quic_ealy_transport_params struct. On the contrary, qc_early_transport_params_reuse() copies the transport parameters to be reused for a 0-RTT session from a previous one. The copy is made from a quic_early_transport_params strcut to a quic_transport_params struct. Also add QUIC_EV_EARLY_TRANSP_PARAMS trace event to dump such 0-RTT transport parameters from traces.
This commit is contained in:
parent
2f2c8c0e3e
commit
e59be9473b
@ -115,6 +115,18 @@ struct quic_transport_params {
|
||||
struct tp_version_information version_information;
|
||||
};
|
||||
|
||||
/* Transport parameters to be saved for 0-RTT sessions. */
|
||||
struct quic_early_transport_params {
|
||||
uint64_t max_udp_payload_size;
|
||||
uint64_t active_connection_id_limit;
|
||||
uint64_t initial_max_data;
|
||||
uint64_t initial_max_stream_data_bidi_local;
|
||||
uint64_t initial_max_stream_data_bidi_remote;
|
||||
uint64_t initial_max_stream_data_uni;
|
||||
uint64_t initial_max_streams_bidi;
|
||||
uint64_t initial_max_streams_uni;
|
||||
};
|
||||
|
||||
/* Return type for QUIC TP decode function */
|
||||
enum quic_tp_dec_err {
|
||||
QUIC_TP_DEC_ERR_NONE = 0, /* no error */
|
||||
|
@ -19,6 +19,12 @@ int quic_transport_params_encode(unsigned char *buf,
|
||||
int quic_transport_params_store(struct quic_conn *conn, int server,
|
||||
const unsigned char *buf,
|
||||
const unsigned char *end);
|
||||
void qc_early_transport_params_cpy(struct quic_conn *qc,
|
||||
struct quic_early_transport_params *e,
|
||||
struct quic_transport_params *p);
|
||||
void qc_early_transport_params_reuse(struct quic_conn *qc,
|
||||
struct quic_transport_params *p,
|
||||
const struct quic_early_transport_params *e);
|
||||
|
||||
int qc_lstnr_params_init(struct quic_conn *qc,
|
||||
const struct quic_transport_params *listener_params,
|
||||
@ -123,5 +129,23 @@ static inline void quic_transport_params_dump(struct buffer *b,
|
||||
quic_tp_version_info_dump(b, &p->version_information, local);
|
||||
}
|
||||
|
||||
static inline void quic_early_transport_params_dump(struct buffer *b,
|
||||
const struct quic_conn *qc,
|
||||
const struct quic_early_transport_params *p)
|
||||
{
|
||||
chunk_appendf(b, " mudp_payload_sz=%llu", (ull)p->max_udp_payload_size);
|
||||
chunk_appendf(b, " act_cid_limit=%llu\n", (ull)p->active_connection_id_limit);
|
||||
|
||||
chunk_appendf(b, " md=%llu", (ull)p->initial_max_data);
|
||||
chunk_appendf(b, " msd_bidi_l=%llu",
|
||||
(ull)p->initial_max_stream_data_bidi_local);
|
||||
chunk_appendf(b, " msd_bidi_r=%llu",
|
||||
(ull)p->initial_max_stream_data_bidi_remote);
|
||||
chunk_appendf(b, " msd_uni=%llu",
|
||||
(ull)p->initial_max_stream_data_uni);
|
||||
chunk_appendf(b, " ms_bidi=%llu", (ull)p->initial_max_streams_bidi);
|
||||
chunk_appendf(b, " ms_uni=%llu\n", (ull)p->initial_max_streams_uni);
|
||||
}
|
||||
|
||||
#endif /* USE_QUIC */
|
||||
#endif /* _HAPROXY_QUIC_TP_H */
|
||||
|
@ -100,5 +100,6 @@ struct quic_rx_crypto_frm {
|
||||
#define QUIC_EV_CONN_SSL_COMPAT (1ULL << 51)
|
||||
#define QUIC_EV_CONN_BIND_TID (1ULL << 52)
|
||||
#define QUIC_EV_CONN_RELEASE_RCD (1ULL << 53)
|
||||
#define QUIC_EV_EARLY_TRANSP_PARAMS (1ULL << 54)
|
||||
|
||||
#endif /* _HAPROXY_QUIC_TRACE_T_H */
|
||||
|
@ -862,3 +862,36 @@ void qc_srv_params_init(struct quic_conn *qc,
|
||||
rx_params->initial_source_connection_id.len = scidlen;
|
||||
TRACE_PROTO("\nRX(local) transp. params.", QUIC_EV_TRANSP_PARAMS, qc, rx_params);
|
||||
}
|
||||
|
||||
/* Copy the 0-RTT transport parameters to be saved from <p> to <e> */
|
||||
void qc_early_transport_params_cpy(struct quic_conn *qc,
|
||||
struct quic_early_transport_params *e,
|
||||
struct quic_transport_params *p)
|
||||
{
|
||||
e->max_udp_payload_size = p->max_udp_payload_size;
|
||||
e->initial_max_data = p->initial_max_data;
|
||||
e->initial_max_stream_data_bidi_local = p->initial_max_stream_data_bidi_local;
|
||||
e->initial_max_stream_data_bidi_remote = p->initial_max_stream_data_bidi_remote;
|
||||
e->initial_max_stream_data_uni = p->initial_max_stream_data_uni;
|
||||
e->initial_max_streams_bidi = p->initial_max_streams_bidi;
|
||||
e->initial_max_streams_uni = p->initial_max_streams_uni;
|
||||
e->active_connection_id_limit = p->active_connection_id_limit;
|
||||
TRACE_PROTO("\nTX(remote) saved early transp. params.", QUIC_EV_EARLY_TRANSP_PARAMS, qc, e);
|
||||
}
|
||||
|
||||
/* Copy <e> 0-RTT transport parameters to <p> transport parameter for <qc> connection. */
|
||||
void qc_early_transport_params_reuse(struct quic_conn *qc,
|
||||
struct quic_transport_params *p,
|
||||
const struct quic_early_transport_params *e)
|
||||
{
|
||||
p->max_udp_payload_size = e->max_udp_payload_size;
|
||||
p->initial_max_data = e->initial_max_data;
|
||||
p->initial_max_stream_data_bidi_local = e->initial_max_stream_data_bidi_local;
|
||||
p->initial_max_stream_data_bidi_remote = e->initial_max_stream_data_bidi_remote;
|
||||
p->initial_max_stream_data_uni = e->initial_max_stream_data_uni;
|
||||
p->initial_max_streams_bidi = e->initial_max_streams_bidi;
|
||||
p->initial_max_streams_uni = e->initial_max_streams_uni;
|
||||
p->active_connection_id_limit = e->active_connection_id_limit;
|
||||
TRACE_PROTO("\nTX(remote) reuse early transp. params.", QUIC_EV_EARLY_TRANSP_PARAMS, qc, e);
|
||||
TRACE_PROTO("\nTX(remote) transp. params.", QUIC_EV_TRANSP_PARAMS, qc, p);
|
||||
}
|
||||
|
@ -69,6 +69,7 @@ static const struct trace_event quic_trace_events[] = {
|
||||
{ .mask = QUIC_EV_CONN_FRMLIST, .name = "frm_list", .desc = "frame list"},
|
||||
{ .mask = QUIC_EV_STATELESS_RST, .name = "stateless_reset", .desc = "stateless reset sent"},
|
||||
{ .mask = QUIC_EV_TRANSP_PARAMS, .name = "transport_params", .desc = "transport parameters"},
|
||||
{ .mask = QUIC_EV_EARLY_TRANSP_PARAMS, .name = "early_transport_params", .desc = "early transport parameters"},
|
||||
{ .mask = QUIC_EV_CONN_IDLE_TIMER, .name = "idle_timer", .desc = "idle timer task"},
|
||||
{ .mask = QUIC_EV_CONN_SUB, .name = "xprt_sub", .desc = "RX/TX subscription or unsubscription to QUIC xprt"},
|
||||
{ .mask = QUIC_EV_CONN_RCV, .name = "conn_recv", .desc = "RX on connection" },
|
||||
@ -140,6 +141,13 @@ static void quic_trace(enum trace_level level, uint64_t mask, const struct trace
|
||||
quic_transport_params_dump(&trace_buf, qc, p);
|
||||
}
|
||||
|
||||
if (mask & QUIC_EV_EARLY_TRANSP_PARAMS) {
|
||||
const struct quic_early_transport_params *p = a2;
|
||||
|
||||
if (p)
|
||||
quic_early_transport_params_dump(&trace_buf, qc, p);
|
||||
}
|
||||
|
||||
if (mask & QUIC_EV_CONN_ADDDATA) {
|
||||
const enum ssl_encryption_level_t *level = a2;
|
||||
const size_t *len = a3;
|
||||
|
Loading…
Reference in New Issue
Block a user