diff options
-rw-r--r-- | accel-pppd/accel-ppp.conf | 2 | ||||
-rw-r--r-- | accel-pppd/accel-ppp.conf.5 | 72 | ||||
-rw-r--r-- | accel-pppd/cli/show_sessions.c | 16 | ||||
-rw-r--r-- | accel-pppd/ctrl/pppoe/pppoe.c | 7 | ||||
-rw-r--r-- | accel-pppd/include/ap_session.h | 1 |
5 files changed, 96 insertions, 2 deletions
diff --git a/accel-pppd/accel-ppp.conf b/accel-pppd/accel-ppp.conf index 1b14b9b0..e80ffd00 100644 --- a/accel-pppd/accel-ppp.conf +++ b/accel-pppd/accel-ppp.conf @@ -300,7 +300,7 @@ verbose=1 telnet=127.0.0.1:2000 tcp=127.0.0.1:2001 #password=123 -#sessions-columns=ifname,username,ip,ip6,ip6-dp,type,state,uptime,uptime-raw,calling-sid,called-sid,sid,comp,rx-bytes,tx-bytes,rx-bytes-raw,tx-bytes-raw,rx-pkts,tx-pkts +#sessions-columns=ifname,username,ip,ip6,ip6-dp,type,state,uptime,uptime-raw,calling-sid,called-sid,sid,comp,inbound-if,service-name,rx-bytes,tx-bytes,rx-bytes-raw,tx-bytes-raw,rx-pkts,tx-pkts,netns,vrf [snmp] master=0 diff --git a/accel-pppd/accel-ppp.conf.5 b/accel-pppd/accel-ppp.conf.5 index 4424400d..26e32fe9 100644 --- a/accel-pppd/accel-ppp.conf.5 +++ b/accel-pppd/accel-ppp.conf.5 @@ -1257,4 +1257,76 @@ command history (defaults to \fI/var/lib/accel-ppp/history\fR). Defines the default set of columns to be displayed by the "show sessions" command (defaults to \fIifname,username,calling-sid,ip,rate-limit,type,comp,state,uptime\fR). +.br +.B Possible columns: +.br +.B ifname +- interface name +.br +.B username +- user name +.br +.B ip +- IP address +.br +.B ip6 +- IPv6 address +.br +.B ip6-dp +- IPv6 delegated prefix +.br +.B type +- connection type [pppoe|ipoe|pptp|l2tp|sstp] +.br +.B state +- state of session +.br +.B uptime +- uptime (human readable) +.br +.B uptime-raw +- uptime (in seconds) +.br +.B calling-sid +- calling station id +.br +.B called-sid +- called station id +.br +.B sid +- session id +.br +.B comp +- compression/encryption method +.br +.B inbound-if +- inbound interface +.br +.B service-name +- PPPoE service name +.br +.B rx-bytes +- received bytes (human readable) +.br +.B tx-bytes +- transmitted bytes (human readable) +.br +.B rx-bytes-raw +- received bytes +.br +.B tx-bytes-raw +- transmitted bytes +.br +.B rx-pkts +- received packets +.br +.B tx-pkts +- transmitted packets +.br +.B netns +- network namespaces +.br +.B vrf +- virtual routing and forwarding +.br Invalid column names are silently discarded. 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); } diff --git a/accel-pppd/ctrl/pppoe/pppoe.c b/accel-pppd/ctrl/pppoe/pppoe.c index 59d9f4f3..78cc64a0 100644 --- a/accel-pppd/ctrl/pppoe/pppoe.c +++ b/accel-pppd/ctrl/pppoe/pppoe.c @@ -201,6 +201,7 @@ static void disconnect(struct pppoe_conn_t *conn) sid_map[conn->sid/(8*sizeof(long))] |= 1 << (conn->sid % (8*sizeof(long))); pthread_mutex_unlock(&sid_lock); + _free(conn->ctrl.service_name); _free(conn->ctrl.calling_station_id); _free(conn->ctrl.called_station_id); _free(conn->service_name); @@ -389,6 +390,12 @@ static struct pppoe_conn_t *allocate_channel(struct pppoe_serv_t *serv, const ui conn->ctrl.calling_station_id = _malloc(IFNAMSIZ + 19); + conn->ctrl.service_name = _malloc(256); + memset(conn->ctrl.service_name, 0x0, 256); + + if (service_name && ntohs(service_name->tag_len) < 256 && ntohs(service_name->tag_len) > 0) + memcpy(conn->ctrl.service_name, service_name->tag_data, ntohs(service_name->tag_len)); + if (conf_ifname_in_sid == 1 || conf_ifname_in_sid == 3) if (conf_sid_uppercase) sprintf(conn->ctrl.calling_station_id, "%s:%02X:%02X:%02X:%02X:%02X:%02X", serv->ifname, diff --git a/accel-pppd/include/ap_session.h b/accel-pppd/include/ap_session.h index 70515133..27471859 100644 --- a/accel-pppd/include/ap_session.h +++ b/accel-pppd/include/ap_session.h @@ -51,6 +51,7 @@ struct ap_ctrl { int mppe; char *calling_station_id; char *called_station_id; + char *service_name; unsigned int dont_ifcfg:1; unsigned int ppp:1; unsigned int ppp_npmode:2; |