MINOR: quic: Dump version_information transport parameter
Implement quic_tp_version_info_dump() to dump such a transport parameter (only remote). Call it from quic_transport_params_dump() which dump all the transport parameters. Can be backported to 2.6 as it's useful for debugging.
This commit is contained in:
parent
57bddbcbbb
commit
4f5777a415
|
@ -29,6 +29,7 @@ struct tp_preferred_address {
|
||||||
struct tp_version_information {
|
struct tp_version_information {
|
||||||
uint32_t choosen;
|
uint32_t choosen;
|
||||||
const uint32_t *others;
|
const uint32_t *others;
|
||||||
|
size_t nb_others;
|
||||||
const struct quic_version *negotiated_version;
|
const struct quic_version *negotiated_version;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -43,9 +43,35 @@ static inline void quic_tp_cid_dump(struct buffer *buf,
|
||||||
chunk_appendf(buf, ")");
|
chunk_appendf(buf, ")");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void quic_tp_version_info_dump(struct buffer *b,
|
||||||
|
const struct tp_version_information *tp, int local)
|
||||||
|
{
|
||||||
|
if (!tp->choosen)
|
||||||
|
return;
|
||||||
|
|
||||||
|
chunk_appendf(b, "\n\tversion_information:(choosen=0x%08x", tp->choosen);
|
||||||
|
if (tp->nb_others) {
|
||||||
|
int i = 0;
|
||||||
|
const uint32_t *ver;
|
||||||
|
chunk_appendf(b, ",others=");
|
||||||
|
for (ver = tp->others; i < tp->nb_others; i++, ver++) {
|
||||||
|
if (i != 0)
|
||||||
|
chunk_appendf(b, ",");
|
||||||
|
if (local)
|
||||||
|
chunk_appendf(b, "0x%08x", *ver);
|
||||||
|
else
|
||||||
|
chunk_appendf(b, "0x%08x", ntohl(*ver));
|
||||||
|
}
|
||||||
|
chunk_appendf(b, ")\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static inline void quic_transport_params_dump(struct buffer *b,
|
static inline void quic_transport_params_dump(struct buffer *b,
|
||||||
|
const struct quic_conn *qc,
|
||||||
const struct quic_transport_params *p)
|
const struct quic_transport_params *p)
|
||||||
{
|
{
|
||||||
|
int local = p == &qc->rx.params;
|
||||||
|
|
||||||
chunk_appendf(b, "\n\toriginal_destination_connection_id:");
|
chunk_appendf(b, "\n\toriginal_destination_connection_id:");
|
||||||
quic_tp_cid_dump(b, &p->original_destination_connection_id);
|
quic_tp_cid_dump(b, &p->original_destination_connection_id);
|
||||||
chunk_appendf(b, "\n\tinitial_source_connection_id:");
|
chunk_appendf(b, "\n\tinitial_source_connection_id:");
|
||||||
|
@ -70,6 +96,7 @@ static inline void quic_transport_params_dump(struct buffer *b,
|
||||||
chunk_appendf(b, "\n\tdisable_active_migration? %s", p->disable_active_migration ? "yes" : "no");
|
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_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");
|
chunk_appendf(b, "\n\twith_preferred_address? %s", p->with_preferred_address ? "yes" : "no");
|
||||||
|
quic_tp_version_info_dump(b, &p->version_information, local);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* USE_QUIC */
|
#endif /* USE_QUIC */
|
||||||
|
|
|
@ -191,6 +191,7 @@ static int quic_transport_param_dec_version_info(struct tp_version_information *
|
||||||
/* TODO: not supported */
|
/* TODO: not supported */
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
tp->nb_others = (end - (const unsigned char *)tp->others) / sizeof *tp->others;
|
||||||
for (ver = tp->others; ver < (const uint32_t *)end; ver++) {
|
for (ver = tp->others; ver < (const uint32_t *)end; ver++) {
|
||||||
if (!tp->negotiated_version) {
|
if (!tp->negotiated_version) {
|
||||||
int i;
|
int i;
|
||||||
|
|
|
@ -264,7 +264,7 @@ static void quic_trace(enum trace_level level, uint64_t mask, const struct trace
|
||||||
|
|
||||||
if (mask & QUIC_EV_TRANSP_PARAMS) {
|
if (mask & QUIC_EV_TRANSP_PARAMS) {
|
||||||
const struct quic_transport_params *p = a2;
|
const struct quic_transport_params *p = a2;
|
||||||
quic_transport_params_dump(&trace_buf, p);
|
quic_transport_params_dump(&trace_buf, qc, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mask & QUIC_EV_CONN_ADDDATA) {
|
if (mask & QUIC_EV_CONN_ADDDATA) {
|
||||||
|
|
Loading…
Reference in New Issue