mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-23 06:41:32 +02:00
MINOR: quic: Transport parameters dump
Add quic_transport_params_dump() static inline function to do so for a quic_transport_parameters struct as parameter. We use the trace API do dump these transport parameters both after they have been initialized (RX/local) or received (TX/remote).
This commit is contained in:
parent
748ece68b8
commit
c7785b5c26
@ -5,6 +5,7 @@
|
|||||||
#error "Must define USE_OPENSSL"
|
#error "Must define USE_OPENSSL"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <haproxy/chunk.h>
|
||||||
#include <haproxy/quic_tp-t.h>
|
#include <haproxy/quic_tp-t.h>
|
||||||
#include <haproxy/xprt_quic-t.h>
|
#include <haproxy/xprt_quic-t.h>
|
||||||
|
|
||||||
@ -24,5 +25,51 @@ int qc_lstnr_params_init(struct quic_conn *qc,
|
|||||||
const unsigned char *dcid, size_t dcidlen,
|
const unsigned char *dcid, size_t dcidlen,
|
||||||
const unsigned char *scid, size_t scidlen,
|
const unsigned char *scid, size_t scidlen,
|
||||||
const unsigned char *odcid, size_t odcidlen, int token);
|
const unsigned char *odcid, size_t odcidlen, int token);
|
||||||
|
|
||||||
|
/* Dump <cid> transport parameter connection ID value if present (non null length).
|
||||||
|
* Used only for debugging purposes.
|
||||||
|
*/
|
||||||
|
static inline void quic_tp_cid_dump(struct buffer *buf,
|
||||||
|
const struct tp_cid *cid)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
chunk_appendf(buf, "(%d", cid->len);
|
||||||
|
if (cid->len)
|
||||||
|
chunk_appendf(buf, ",");
|
||||||
|
for (i = 0; i < cid->len; i++)
|
||||||
|
chunk_appendf(buf, "%02x", cid->data[i]);
|
||||||
|
chunk_appendf(buf, ")");
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void quic_transport_params_dump(struct buffer *b,
|
||||||
|
const struct quic_transport_params *p)
|
||||||
|
{
|
||||||
|
chunk_appendf(b, "\n\toriginal_destination_connection_id:");
|
||||||
|
quic_tp_cid_dump(b, &p->original_destination_connection_id);
|
||||||
|
chunk_appendf(b, "\n\tinitial_source_connection_id:");
|
||||||
|
quic_tp_cid_dump(b, &p->initial_source_connection_id);
|
||||||
|
chunk_appendf(b, "\n\tretry_source_connection_id:");
|
||||||
|
quic_tp_cid_dump(b, &p->retry_source_connection_id);
|
||||||
|
|
||||||
|
chunk_appendf(b, "\n\tmax_idle_timeout=%llu", (ull)p->max_idle_timeout);
|
||||||
|
chunk_appendf(b, "\n\tmax_udp_payload_size=%llu", (ull)p->max_udp_payload_size);
|
||||||
|
chunk_appendf(b, "\n\tinitial_max_data=%llu", (ull)p->initial_max_data);
|
||||||
|
chunk_appendf(b, "\n\tinitial_max_stream_data_bidi_local=%llu",
|
||||||
|
(ull)p->initial_max_stream_data_bidi_local);
|
||||||
|
chunk_appendf(b, "\n\tinitial_max_stream_data_bidi_remote=%llu",
|
||||||
|
(ull)p->initial_max_stream_data_bidi_remote);
|
||||||
|
chunk_appendf(b, "\n\tinitial_max_stream_data_uni=%llu",
|
||||||
|
(ull)p->initial_max_stream_data_uni);
|
||||||
|
chunk_appendf(b, "\n\tinitial_max_streams_bidi=%llu", (ull)p->initial_max_streams_bidi);
|
||||||
|
chunk_appendf(b, "\n\tinitial_max_streams_uni=%llu", (ull)p->initial_max_streams_uni);
|
||||||
|
chunk_appendf(b, "\n\tack_delay_exponent=%llu", (ull)p->ack_delay_exponent);
|
||||||
|
chunk_appendf(b, "\n\tmax_ack_delay=%llu", (ull)p->max_ack_delay);
|
||||||
|
chunk_appendf(b, "\n\tactive_connection_id_limit=%llu", (ull)p->active_connection_id_limit);
|
||||||
|
chunk_appendf(b, "\n\tdisable_active_migration? %s", p->disable_active_migration ? "yes" : "no");
|
||||||
|
chunk_appendf(b, "\n\twith_stateless_reset_token? %s", p->with_stateless_reset_token ? "yes" : "no");
|
||||||
|
chunk_appendf(b, "\n\twith_preferred_address? %s", p->with_preferred_address ? "yes" : "no");
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* USE_QUIC */
|
#endif /* USE_QUIC */
|
||||||
#endif /* _HAPROXY_QUIC_TP_H */
|
#endif /* _HAPROXY_QUIC_TP_H */
|
||||||
|
@ -239,6 +239,7 @@ enum quic_pkt_type {
|
|||||||
#define QUIC_EV_CONN_ACKSTRM (1ULL << 41)
|
#define QUIC_EV_CONN_ACKSTRM (1ULL << 41)
|
||||||
#define QUIC_EV_CONN_FRMLIST (1ULL << 42)
|
#define QUIC_EV_CONN_FRMLIST (1ULL << 42)
|
||||||
#define QUIC_EV_STATELESS_RST (1ULL << 43)
|
#define QUIC_EV_STATELESS_RST (1ULL << 43)
|
||||||
|
#define QUIC_EV_TRANSP_PARAMS (1ULL << 44)
|
||||||
|
|
||||||
/* Similar to kernel min()/max() definitions. */
|
/* Similar to kernel min()/max() definitions. */
|
||||||
#define QUIC_MIN(a, b) ({ \
|
#define QUIC_MIN(a, b) ({ \
|
||||||
|
@ -3,10 +3,13 @@
|
|||||||
#include <haproxy/net_helper.h>
|
#include <haproxy/net_helper.h>
|
||||||
#include <haproxy/quic_enc.h>
|
#include <haproxy/quic_enc.h>
|
||||||
#include <haproxy/quic_tp.h>
|
#include <haproxy/quic_tp.h>
|
||||||
|
#include <haproxy/trace.h>
|
||||||
#include <haproxy/xprt_quic-t.h>
|
#include <haproxy/xprt_quic-t.h>
|
||||||
|
|
||||||
#define QUIC_MAX_UDP_PAYLOAD_SIZE 2048
|
#define QUIC_MAX_UDP_PAYLOAD_SIZE 2048
|
||||||
|
|
||||||
|
#define TRACE_SOURCE &trace_quic
|
||||||
|
|
||||||
/* This is the values of some QUIC transport parameters when absent.
|
/* This is the values of some QUIC transport parameters when absent.
|
||||||
* Should be used to initialize any transport parameters (local or remote)
|
* Should be used to initialize any transport parameters (local or remote)
|
||||||
* before updating them with customized values.
|
* before updating them with customized values.
|
||||||
@ -523,6 +526,8 @@ int quic_transport_params_store(struct quic_conn *qc, int server,
|
|||||||
qc->max_idle_timeout =
|
qc->max_idle_timeout =
|
||||||
QUIC_MAX(tx_params->max_idle_timeout, rx_params->max_idle_timeout);
|
QUIC_MAX(tx_params->max_idle_timeout, rx_params->max_idle_timeout);
|
||||||
|
|
||||||
|
TRACE_PROTO("\nTX(remote) transp. params.", QUIC_EV_TRANSP_PARAMS, qc, tx_params);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -564,6 +569,7 @@ int qc_lstnr_params_init(struct quic_conn *qc,
|
|||||||
/* Copy the initial source connection ID. */
|
/* Copy the initial source connection ID. */
|
||||||
memcpy(rx_params->initial_source_connection_id.data, scid, scidlen);
|
memcpy(rx_params->initial_source_connection_id.data, scid, scidlen);
|
||||||
rx_params->initial_source_connection_id.len = scidlen;
|
rx_params->initial_source_connection_id.len = scidlen;
|
||||||
|
TRACE_PROTO("\nRX(local) transp. params.", QUIC_EV_TRANSP_PARAMS, qc, rx_params);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -113,6 +113,7 @@ static const struct trace_event quic_trace_events[] = {
|
|||||||
{ .mask = QUIC_EV_CONN_ACKSTRM, .name = "ack_strm", .desc = "STREAM ack."},
|
{ .mask = QUIC_EV_CONN_ACKSTRM, .name = "ack_strm", .desc = "STREAM ack."},
|
||||||
{ .mask = QUIC_EV_CONN_FRMLIST, .name = "frm_list", .desc = "frame list"},
|
{ .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_STATELESS_RST, .name = "stateless_reset", .desc = "stateless reset sent"},
|
||||||
|
{ .mask = QUIC_EV_TRANSP_PARAMS, .name = "transport_params", .desc = "transport parameters"},
|
||||||
{ /* end */ }
|
{ /* end */ }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -215,6 +216,11 @@ static void quic_trace(enum trace_level level, uint64_t mask, const struct trace
|
|||||||
quic_cid_dump(&trace_buf, &qc->scid);
|
quic_cid_dump(&trace_buf, &qc->scid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mask & QUIC_EV_TRANSP_PARAMS) {
|
||||||
|
const struct quic_transport_params *p = a2;
|
||||||
|
quic_transport_params_dump(&trace_buf, p);
|
||||||
|
}
|
||||||
|
|
||||||
if (mask & QUIC_EV_CONN_ADDDATA) {
|
if (mask & QUIC_EV_CONN_ADDDATA) {
|
||||||
const enum ssl_encryption_level_t *level = a2;
|
const enum ssl_encryption_level_t *level = a2;
|
||||||
const size_t *len = a3;
|
const size_t *len = a3;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user