]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: quic: Add transport parameters to "show quic"
authorFrédéric Lécaille <flecaille@haproxy.com>
Tue, 7 Mar 2023 14:18:02 +0000 (15:18 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 8 Mar 2023 07:50:54 +0000 (08:50 +0100)
Modify quic_transport_params_dump() and others function relative to the
transport parameters value dump from TRACE() to make their output more
compact.
Add call to quic_transport_params_dump() to dump the transport parameters
from "show quic" CLI command.

Must be backported to 2.7.

include/haproxy/quic_tp.h
src/quic_conn.c

index 18d568f387c5d200c02f02744612cf5d319ed49b..16296e5f8a8f59cda5084ce07c7628dd7b0e182e 100644 (file)
@@ -35,12 +35,8 @@ static inline void quic_tp_cid_dump(struct buffer *buf,
 {
        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_tp_version_info_dump(struct buffer *b,
@@ -49,7 +45,7 @@ static inline void quic_tp_version_info_dump(struct buffer *b,
        if (!tp->chosen)
                return;
 
-       chunk_appendf(b, "\n\tversion_information:(chosen=0x%08x", tp->chosen);
+       chunk_appendf(b, "    version_information:(chosen=0x%08x", tp->chosen);
        if (tp->nb_others) {
                int i = 0;
                const uint32_t *ver;
@@ -62,8 +58,8 @@ static inline void quic_tp_version_info_dump(struct buffer *b,
                        else
                                chunk_appendf(b, "0x%08x", ntohl(*ver));
                }
-               chunk_appendf(b, ")\n");
        }
+       chunk_appendf(b, ")\n");
 }
 
 static inline void quic_transport_params_dump(struct buffer *b,
@@ -72,30 +68,60 @@ static inline void quic_transport_params_dump(struct buffer *b,
 {
        int local = p == &qc->rx.params;
 
-       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:");
+       if (p->original_destination_connection_id.len) {
+               chunk_appendf(b, " odcid=");
+               quic_tp_cid_dump(b, &p->original_destination_connection_id);
+       }
+       chunk_appendf(b, " iscid=");
        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);
+       if (p->retry_source_connection_id.len) {
+               chunk_appendf(b, "  rscid=");
+               quic_tp_cid_dump(b, &p->retry_source_connection_id);
+       }
+       chunk_appendf(b, "\n");
+
+       chunk_appendf(b, "    midle_timeout=%llums", (ull)p->max_idle_timeout);
+       chunk_appendf(b, " mudp_payload_sz=%llu", (ull)p->max_udp_payload_size);
+       chunk_appendf(b, " ack_delay_exp=%llu", (ull)p->ack_delay_exponent);
+       chunk_appendf(b, " mack_delay=%llums", (ull)p->max_ack_delay);
+       chunk_appendf(b, " act_cid_limit=%llu\n", (ull)p->active_connection_id_limit);
 
-       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",
+       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, "\n\tinitial_max_stream_data_bidi_remote=%llu",
+       chunk_appendf(b, " msd_bidi_r=%llu",
                      (ull)p->initial_max_stream_data_bidi_remote);
-       chunk_appendf(b, "\n\tinitial_max_stream_data_uni=%llu",
+       chunk_appendf(b, " msd_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");
+       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);
+
+       if (p->disable_active_migration || p->with_stateless_reset_token ||
+           p->with_preferred_address) {
+               int prev = 0;
+
+               chunk_appendf(b, "    (");
+               if (p->disable_active_migration) {
+                       if (prev)
+                               chunk_appendf(b, ",");
+                       prev = 1;
+                       chunk_appendf(b, "no_act_migr");
+               }
+               if (p->with_stateless_reset_token) {
+                       if (prev)
+                               chunk_appendf(b, ",");
+                       prev = 1;
+                       chunk_appendf(b, "stless_rst_tok");
+               }
+               if (p->with_preferred_address) {
+                       if (prev)
+                               chunk_appendf(b, ",");
+                       prev = 1;
+                       chunk_appendf(b, "pref_addr");
+               }
+               chunk_appendf(b, ")\n");
+       }
+
        quic_tp_version_info_dump(b, &p->version_information, local);
 }
 
index 2cae51cc3e888d781be97100b0569cb1158b2b0a..90a2c5dd256ff9fb69406f2b478c484e7d300441 100644 (file)
@@ -8204,6 +8204,11 @@ static int cli_io_handler_dump_quic(struct appctx *appctx)
 
                chunk_appendf(&trash, "\n");
 
+               chunk_appendf(&trash, "  loc. TPs:");
+               quic_transport_params_dump(&trash, qc, &qc->rx.params);
+               chunk_appendf(&trash, "  rem. TPs:");
+               quic_transport_params_dump(&trash, qc, &qc->tx.params);
+
                /* Connection state */
                if (qc->flags & QUIC_FL_CONN_CLOSING)
                        chunk_appendf(&trash, "  st=closing          ");