cli: Show acceleration interface name

And allow selecting a session through it
This commit is contained in:
Samuel Thibault 2024-01-18 02:00:21 +01:00
parent f00ec1c6e4
commit 0ac498d7d3
3 changed files with 25 additions and 4 deletions

17
cli.c
View file

@ -451,10 +451,23 @@ static int cmd_show_session(struct cli_def *cli, const char *command, char **arg
for (i = 0; i < argc; i++)
{
unsigned int s, b_in, b_out, r;
int ifunit = -1;
if (!strncmp(argv[i], PPP_IF_PREFIX, strlen(PPP_IF_PREFIX)))
{
char *start = argv[i]+strlen(PPP_IF_PREFIX);
char *end;
long res = strtol(start, &end, 10);
if (end != start && !*end)
ifunit = res;
}
for (s = 0; s < MAXSESSION; s++)
if (!strcmp(argv[i], session[s].user))
{
if ((ifunit >= 0 && sess_local[s].ppp_if_unit == ifunit)
|| !strcmp(argv[i], session[s].user))
break;
}
if (s >= MAXSESSION)
{
s = atoi(argv[i]);
@ -473,6 +486,8 @@ static int cmd_show_session(struct cli_def *cli, const char *command, char **arg
cli_print(cli, "\tRemote ID:\t%d", session[s].far);
if (session[s].bundle)
cli_print(cli, "\tBundle ID:\t%d (%d)", session[s].bundle, bundle[session[s].bundle].num_of_links);
if (sess_local[s].ppp_if_unit >= 0)
cli_print(cli, "\tInterface:\tppp%d", sess_local[s].ppp_if_unit);
cli_print(cli, "\tPPP Phase:\t%s", ppp_phase(session[s].ppp.phase));
switch (session[s].ppp.phase)
{