cli: Show tunnel queue length

This commit is contained in:
Samuel Thibault 2025-03-30 17:32:38 +02:00
parent 0845ec8a19
commit 37ff318b32

6
cli.c
View file

@ -731,11 +731,12 @@ static int cmd_show_tunnels(struct cli_def *cli, const char *command, char **arg
} }
// Show tunnel summary // Show tunnel summary
cli_print(cli, "%4s %20s %20s %6s %s", cli_print(cli, "%4s %20s %15s %6s %5s %s",
"TID", "TID",
"Hostname", "Hostname",
"IP", "IP",
"State", "State",
"Queue",
"Sessions"); "Sessions");
for (i = 1; i < MAXTUNNEL; i++) for (i = 1; i < MAXTUNNEL; i++)
@ -744,11 +745,12 @@ static int cmd_show_tunnels(struct cli_def *cli, const char *command, char **arg
if (!show_all && (!tunnel[i].ip || tunnel[i].die)) continue; if (!show_all && (!tunnel[i].ip || tunnel[i].die)) continue;
for (x = 0; x < MAXSESSION; x++) if (session[x].tunnel == i && session[x].opened && !session[x].die) sessions++; for (x = 0; x < MAXSESSION; x++) if (session[x].tunnel == i && session[x].opened && !session[x].die) sessions++;
cli_print(cli, "%4d %20s %20s %6s %6d %s", cli_print(cli, "%4d %20s %15s %6s %5d %6d %s",
i, i,
*tunnel[i].hostname ? tunnel[i].hostname : "(null)", *tunnel[i].hostname ? tunnel[i].hostname : "(null)",
fmtaddr(htonl(tunnel[i].ip), 0), fmtaddr(htonl(tunnel[i].ip), 0),
states[tunnel[i].state], states[tunnel[i].state],
tunnel[i].controlc,
sessions sessions
,(i == TUNNEL_ID_PPPOE)?"Tunnel pppoe":(tunnel[i].isremotelns?"Tunnel To Remote LNS":"Tunnel To LAC") ,(i == TUNNEL_ID_PPPOE)?"Tunnel pppoe":(tunnel[i].isremotelns?"Tunnel To Remote LNS":"Tunnel To LAC")
); );