From 6efad618371915bf0b402f26117a02ad53aaeb20 Mon Sep 17 00:00:00 2001 From: Kozlov Dmitry Date: Mon, 14 May 2012 23:06:11 +0400 Subject: cli: add 'comp' field to 'show sessions' to indicate compression/encryption method --- accel-pppd/cli/show_sessions.c | 8 +++++++- accel-pppd/ppp/ccp_mppe.c | 4 +++- accel-pppd/ppp/ppp.h | 1 + 3 files changed, 11 insertions(+), 2 deletions(-) (limited to 'accel-pppd') diff --git a/accel-pppd/cli/show_sessions.c b/accel-pppd/cli/show_sessions.c index 4caded1..c0fec58 100644 --- a/accel-pppd/cli/show_sessions.c +++ b/accel-pppd/cli/show_sessions.c @@ -15,7 +15,7 @@ #include "memdebug.h" #define CELL_SIZE 128 -#define DEF_COLUMNS "ifname,username,calling-sid,ip,rate-limit,type,state,uptime" +#define DEF_COLUMNS "ifname,username,calling-sid,ip,rate-limit,type,comp,state,uptime" struct column_t { @@ -450,6 +450,11 @@ static void print_sid(const struct ppp_t *ppp, char *buf) snprintf(buf, CELL_SIZE, "%s", ppp->sessionid); } +static void print_comp(const struct ppp_t *ppp, char *buf) +{ + snprintf(buf, CELL_SIZE, "%s", ppp->comp ? ppp->comp : ""); +} + static void init(void) { cli_register_simple_cmd2(show_ses_exec, show_ses_help, 2, "show", "sessions"); @@ -463,6 +468,7 @@ static void init(void) cli_show_ses_register("calling-sid", "calling station id", print_calling_sid); cli_show_ses_register("called-sid", "called station id", print_called_sid); cli_show_ses_register("sid", "session id", print_sid); + cli_show_ses_register("comp", "compression/ecnryption method", print_comp); } DEFINE_INIT(12, init); diff --git a/accel-pppd/ppp/ccp_mppe.c b/accel-pppd/ppp/ccp_mppe.c index 90f9d83..388e2f6 100644 --- a/accel-pppd/ppp/ccp_mppe.c +++ b/accel-pppd/ppp/ccp_mppe.c @@ -214,7 +214,9 @@ static int mppe_recv_conf_req(struct ppp_ccp_t *ccp, struct ccp_option_t *opt, u } log_ppp_debug(" (mppe enabled)"); - } + ccp->ppp->comp = "mppe"; + } else + ccp->ppp->comp = NULL; return CCP_OPT_ACK; } diff --git a/accel-pppd/ppp/ppp.h b/accel-pppd/ppp/ppp.h index 18cb5c2..f831242 100644 --- a/accel-pppd/ppp/ppp.h +++ b/accel-pppd/ppp/ppp.h @@ -114,6 +114,7 @@ struct ppp_t struct ipv6db_item_t *ipv6; char *ipv4_pool_name; char *ipv6_pool_name; + const char *comp; struct ppp_ctrl_t *ctrl; -- cgit v1.2.3