From a9e9f3ea0d7d4c48ba402d885372c978d5c75aab Mon Sep 17 00:00:00 2001 From: Dmitriy Eshenko Date: Thu, 29 Jun 2023 20:48:39 +0300 Subject: CLI: PPPoE: Add possibility to display inbound interface and service-name in show sessions command --- accel-pppd/cli/show_sessions.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'accel-pppd/cli/show_sessions.c') diff --git a/accel-pppd/cli/show_sessions.c b/accel-pppd/cli/show_sessions.c index b814e824..22f5318a 100644 --- a/accel-pppd/cli/show_sessions.c +++ b/accel-pppd/cli/show_sessions.c @@ -629,6 +629,18 @@ static void print_tx_pkts(struct ap_session *ses, char *buf) sprintf(buf, "%llu", stats.tx_packets); } +static void print_inbound_if(struct ap_session *ses, char *buf) +{ + if (ses->ctrl->ifname) + snprintf(buf, CELL_SIZE, "%s", ses->ctrl->ifname); +} + +static void print_service_name(struct ap_session *ses, char *buf) +{ + if (ses->ctrl->service_name) + snprintf(buf, CELL_SIZE, "%s", ses->ctrl->service_name); +} + static void load_config(void *data) { const char *opt = NULL; @@ -663,7 +675,7 @@ static void init(void) cli_show_ses_register("ip", "IP address", print_ip); cli_show_ses_register("ip6", "IPv6 address", print_ip6); cli_show_ses_register("ip6-dp", "IPv6 delegated prefix", print_ip6_dp); - cli_show_ses_register("type", "VPN type", print_type); + cli_show_ses_register("type", "connection type", print_type); cli_show_ses_register("state", "state of session", print_state); cli_show_ses_register("uptime", "uptime (human readable)", print_uptime); cli_show_ses_register("uptime-raw", "uptime (in seconds)", print_uptime_raw); @@ -677,6 +689,8 @@ static void init(void) cli_show_ses_register("tx-bytes-raw", "transmitted bytes", print_tx_bytes_raw); cli_show_ses_register("rx-pkts", "received packets", print_rx_pkts); cli_show_ses_register("tx-pkts", "transmitted packets", print_tx_pkts); + cli_show_ses_register("inbound-if", "inbound interface", print_inbound_if); + cli_show_ses_register("service-name", "PPPoE service name", print_service_name); triton_event_register_handler(EV_CONFIG_RELOAD, load_config); } -- cgit v1.2.3