]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: quic: Address inversion in "show quic full"
authorFrédéric Lécaille <flecaille@haproxy.com>
Wed, 14 Jun 2023 07:17:20 +0000 (09:17 +0200)
committerFrédéric Lécaille <flecaille@haproxy.com>
Wed, 14 Jun 2023 07:33:28 +0000 (09:33 +0200)
The local address was dumped as "from" address by dump_quic_full() and
the peer address as "to" address. This patch fixes this issue.

Furthermore, to support the server side (QUIC client) to come, it is preferable
to stop using "from" and "to" labels to dump the local and peer addresses which
is confusing for a QUIC client which uses its local address as "from" address.

To mimic netstat, this is "Local Address" and "Foreign Address" which will
be displayed by "show quic" CLI command and "local_addr" and "foreign_addr"
for "show quic full" command to mention the local addresses and the peer
addresses.

Must be backported as far as 2.7.

src/quic_conn.c

index 5653404b61f5c45f076761d6f6b740029e5510b9..319a614545907b5a40ba6b35a476493f3b9b6481 100644 (file)
@@ -8737,13 +8737,14 @@ static void dump_quic_oneline(struct show_quic_ctx *ctx, struct quic_conn *qc)
        /* Socket */
        if (qc->local_addr.ss_family == AF_INET ||
            qc->local_addr.ss_family == AF_INET6) {
+               addr_to_str(&qc->local_addr, bufaddr, sizeof(bufaddr));
+               port_to_str(&qc->local_addr, bufport, sizeof(bufport));
+               chunk_appendf(&trash, "%15s:%-5s   ", bufaddr, bufport);
+
                addr_to_str(&qc->peer_addr, bufaddr, sizeof(bufaddr));
                port_to_str(&qc->peer_addr, bufport, sizeof(bufport));
                chunk_appendf(&trash, "%15s:%-5s ", bufaddr, bufport);
 
-               addr_to_str(&qc->local_addr, bufaddr, sizeof(bufaddr));
-               port_to_str(&qc->local_addr, bufport, sizeof(bufport));
-               chunk_appendf(&trash, "%15s:%-5s   ", bufaddr, bufport);
        }
 
        /* CIDs */
@@ -8819,11 +8820,11 @@ static void dump_quic_full(struct show_quic_ctx *ctx, struct quic_conn *qc)
            qc->local_addr.ss_family == AF_INET6) {
                addr_to_str(&qc->local_addr, bufaddr, sizeof(bufaddr));
                port_to_str(&qc->local_addr, bufport, sizeof(bufport));
-               chunk_appendf(&trash, "               from=%s:%s", bufaddr, bufport);
+               chunk_appendf(&trash, "               local_addr=%s:%s", bufaddr, bufport);
 
                addr_to_str(&qc->peer_addr, bufaddr, sizeof(bufaddr));
                port_to_str(&qc->peer_addr, bufport, sizeof(bufport));
-               chunk_appendf(&trash, " to=%s:%s", bufaddr, bufport);
+               chunk_appendf(&trash, " foreign_addr=%s:%s", bufaddr, bufport);
        }
 
        chunk_appendf(&trash, "\n");
@@ -8947,8 +8948,8 @@ static int cli_io_handler_dump_quic(struct appctx *appctx)
                /* Print legend for oneline format. */
                if (ctx->format == QUIC_DUMP_FMT_ONELINE) {
                        chunk_appendf(&trash, "# conn/frontend                     state   "
-                                     "in_flight infl_p lost_p               "
-                                     "from                    to          "
+                                     "in_flight infl_p lost_p         "
+                                     "Local Address           Foreign Address      "
                                      "local & remote CIDs\n");
                        applet_putchk(appctx, &trash);
                }