From: Frédéric Lécaille Date: Wed, 14 Jun 2023 07:17:20 +0000 (+0200) Subject: BUG/MINOR: quic: Address inversion in "show quic full" X-Git-Tag: v2.9-dev1~60 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4d56b725fb0990ddaea7b95b71e84513525bc988;p=thirdparty%2Fhaproxy.git 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. --- diff --git a/src/quic_conn.c b/src/quic_conn.c index 5653404b61..319a614545 100644 --- a/src/quic_conn.c +++ b/src/quic_conn.c @@ -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); }