MINOR: quic: display socket info on "show quic"

Complete "show quic" handler by displaying information related to the
quic_conn owned socket. First, the FD is printed, followed by the
address of the local and remote endpoint.

This should be backported up to 2.7.
This commit is contained in:
Amaury Denoyelle 2023-02-01 17:04:26 +01:00
parent 58d9d5d160
commit b89c0e243a

View File

@ -7646,6 +7646,7 @@ static int cli_io_handler_dump_quic(struct appctx *appctx)
struct show_quic_ctx *ctx = appctx->svcctx;
struct stconn *sc = appctx_sc(appctx);
struct quic_conn *qc;
char bufaddr[INET6_ADDRSTRLEN], bufport[6];
int expire;
unsigned char cid_len;
@ -7732,6 +7733,21 @@ static int cli_io_handler_dump_quic(struct appctx *appctx)
chunk_appendf(&trash, "\n");
/* Socket */
chunk_appendf(&trash, " fd=%d", qc->fd);
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, " from=%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, "\n");
if (applet_putchk(appctx, &trash) == -1) {
/* Register show_quic_ctx to quic_conn instance. */
LIST_APPEND(&qc->back_refs, &ctx->bref.users);