summaryrefslogtreecommitdiff
path: root/accel-pptpd/cli
diff options
context:
space:
mode:
authorDmitry Kozlov <xeb@mail.ru>2011-01-03 10:58:37 +0300
committerDmitry Kozlov <xeb@mail.ru>2011-01-03 10:58:37 +0300
commite51a8e8a93cd6e29c9d5bc28e1e634fa6dae813d (patch)
treebef9f3ca8a7d13312ce81ed7825595cc5f7eddb4 /accel-pptpd/cli
parent6409b409508f22ea7dbb3f3fa2cb9de78d5073c5 (diff)
downloadaccel-ppp-e51a8e8a93cd6e29c9d5bc28e1e634fa6dae813d.tar.gz
accel-ppp-e51a8e8a93cd6e29c9d5bc28e1e634fa6dae813d.zip
cli: show sessions: show rate-limit by dfault
Diffstat (limited to 'accel-pptpd/cli')
-rw-r--r--accel-pptpd/cli/show_sessions.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/accel-pptpd/cli/show_sessions.c b/accel-pptpd/cli/show_sessions.c
index f8fb3d0..90aeb3f 100644
--- a/accel-pptpd/cli/show_sessions.c
+++ b/accel-pptpd/cli/show_sessions.c
@@ -14,7 +14,7 @@
#include "memdebug.h"
#define CELL_SIZE 128
-#define DEF_COLUMNS "ifname,username,calling-sid,ip,type,state,uptime"
+#define DEF_COLUMNS "ifname,username,calling-sid,ip,rate-limit,type,state,uptime"
struct column_t
{
@@ -128,7 +128,7 @@ static int show_ses_exec(const char *cmd, char * const *f, int f_cnt, void *cli)
struct row_t *row;
struct cell_t *cell;
char *ptr1, *ptr2;
- int i, n, total_width = 0;
+ int i, n, total_width, def_columns = 0;
struct ppp_t *ppp;
char *buf = NULL;
LIST_HEAD(c_list);
@@ -167,8 +167,10 @@ static int show_ses_exec(const char *cmd, char * const *f, int f_cnt, void *cli)
}
}
- if (!columns)
+ if (!columns) {
columns = DEF_COLUMNS;
+ def_columns = 1;
+ }
columns = _strdup(columns);
ptr1 = columns;
@@ -177,15 +179,18 @@ static int show_ses_exec(const char *cmd, char * const *f, int f_cnt, void *cli)
if (ptr2)
*ptr2 = 0;
column = find_column(ptr1);
- if (!column) {
- cli_sendv(cli, "unknown column %s\r\n", ptr1);
- _free(columns);
- goto out;
+ if (column) {
+ col = _malloc(sizeof(*col));
+ col->column = column;
+ col->width = strlen(column->name);
+ list_add_tail(&col->entry, &c_list);
+ } else {
+ if (!def_columns) {
+ cli_sendv(cli, "unknown column %s\r\n", ptr1);
+ _free(columns);
+ goto out;
+ }
}
- col = _malloc(sizeof(*col));
- col->column = column;
- col->width = strlen(column->name);
- list_add_tail(&col->entry, &c_list);
if (!ptr2)
break;
ptr1 = ptr2 + 1;