BUG/MINOR: quic: Address inversion in "show quic full"
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.
(cherry picked from commit 4d56b725fb0990ddaea7b95b71e84513525bc988)
Signed-off-by: William Lallemand <wlallemand@haproxy.org>
diff --git a/src/quic_conn.c b/src/quic_conn.c
index 5653404..319a614 100644
--- a/src/quic_conn.c
+++ b/src/quic_conn.c
@@ -8737,13 +8737,14 @@
/* 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 @@
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 @@
/* 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);
}