summaryrefslogtreecommitdiff
path: root/accel-pptpd/ctrl
diff options
context:
space:
mode:
authorDmitry Kozlov <xeb@mail.ru>2011-01-04 00:11:04 +0300
committerDmitry Kozlov <xeb@mail.ru>2011-01-04 00:11:04 +0300
commitcdd91cd6a6a7bd00dcf9a0ba78ea76e01ce33655 (patch)
tree9edc12be71dc10f7112aef9fa654faa2b6897b51 /accel-pptpd/ctrl
parent709dd1595b4877471cb18397be28352730120067 (diff)
downloadaccel-ppp-xebd-cdd91cd6a6a7bd00dcf9a0ba78ea76e01ce33655.tar.gz
accel-ppp-xebd-cdd91cd6a6a7bd00dcf9a0ba78ea76e01ce33655.zip
pppoe: additional statistics
radius: additional statistics
Diffstat (limited to 'accel-pptpd/ctrl')
-rw-r--r--accel-pptpd/ctrl/pppoe/cli.c4
-rw-r--r--accel-pptpd/ctrl/pppoe/pppoe.c15
-rw-r--r--accel-pptpd/ctrl/pppoe/pppoe.h5
3 files changed, 23 insertions, 1 deletions
diff --git a/accel-pptpd/ctrl/pppoe/cli.c b/accel-pptpd/ctrl/pppoe/cli.c
index 7a62952..9929f66 100644
--- a/accel-pptpd/ctrl/pppoe/cli.c
+++ b/accel-pptpd/ctrl/pppoe/cli.c
@@ -68,6 +68,10 @@ static int show_stat_exec(const char *cmd, char * const *fields, int fields_cnt,
cli_send(client, "pppoe:\r\n");
cli_sendv(client, " active: %u\r\n", stat_active);
cli_sendv(client, " delayed PADO: %u\r\n", stat_delayed_pado);
+ cli_sendv(client, " recv PADI: %lu\r\n", stat_PADI_recv);
+ cli_sendv(client, " sent PADO: %lu\r\n", stat_PADO_sent);
+ cli_sendv(client, " recv PADR(dup): %lu(%lu)\r\n", stat_PADR_recv, stat_PADR_dup_recv);
+ cli_sendv(client, " sent PADS: %lu\r\n", stat_PADS_sent);
return CLI_CMD_OK;
}
diff --git a/accel-pptpd/ctrl/pppoe/pppoe.c b/accel-pptpd/ctrl/pppoe/pppoe.c
index 3e6b0bf..95ae394 100644
--- a/accel-pptpd/ctrl/pppoe/pppoe.c
+++ b/accel-pptpd/ctrl/pppoe/pppoe.c
@@ -75,6 +75,11 @@ static mempool_t pado_pool;
unsigned int stat_active;
unsigned int stat_delayed_pado;
+unsigned long stat_PADI_recv;
+unsigned long stat_PADO_sent;
+unsigned long stat_PADR_recv;
+unsigned long stat_PADR_dup_recv;
+unsigned long stat_PADS_sent;
pthread_rwlock_t serv_lock = PTHREAD_RWLOCK_INITIALIZER;
LIST_HEAD(serv_list);
@@ -581,6 +586,7 @@ static void pppoe_send_PADO(struct pppoe_serv_t *serv, const uint8_t *addr, cons
print_packet(pack);
}
+ __sync_add_and_fetch(&stat_PADO_sent, 1);
pppoe_send(serv->hnd.fd, pack);
}
@@ -628,6 +634,7 @@ static void pppoe_send_PADS(struct pppoe_conn_t *conn)
print_packet(pack);
}
+ __sync_add_and_fetch(&stat_PADS_sent, 1);
pppoe_send(conn->disc_sock, pack);
}
@@ -693,6 +700,8 @@ static void pppoe_recv_PADI(struct pppoe_serv_t *serv, uint8_t *pack, int size)
int n, service_match = 0;
struct delayed_pado_t *pado;
+ __sync_add_and_fetch(&stat_PADI_recv, 1);
+
if (ppp_shutdown || pado_delay == -1)
return;
@@ -791,6 +800,8 @@ static void pppoe_recv_PADR(struct pppoe_serv_t *serv, uint8_t *pack, int size)
struct pppoe_conn_t *conn;
int vendor_id;
+ __sync_add_and_fetch(&stat_PADR_recv, 1);
+
if (ppp_shutdown)
return;
@@ -876,8 +887,10 @@ static void pppoe_recv_PADR(struct pppoe_serv_t *serv, uint8_t *pack, int size)
pthread_mutex_lock(&serv->lock);
conn = find_channel(serv, (uint8_t *)ac_cookie_tag->tag_data);
- if (conn && !conn->ppp.username)
+ if (conn && !conn->ppp.username) {
+ __sync_add_and_fetch(&stat_PADR_dup_recv, 1);
pppoe_send_PADS(conn);
+ }
pthread_mutex_unlock(&serv->lock);
if (conn)
diff --git a/accel-pptpd/ctrl/pppoe/pppoe.h b/accel-pptpd/ctrl/pppoe/pppoe.h
index b0e665d..2264dd1 100644
--- a/accel-pptpd/ctrl/pppoe/pppoe.h
+++ b/accel-pptpd/ctrl/pppoe/pppoe.h
@@ -91,6 +91,11 @@ extern char *conf_pado_delay;
extern unsigned int stat_active;
extern unsigned int stat_delayed_pado;
+extern unsigned long stat_PADI_recv;
+extern unsigned long stat_PADO_sent;
+extern unsigned long stat_PADR_recv;
+extern unsigned long stat_PADR_dup_recv;
+extern unsigned long stat_PADS_sent;
extern pthread_rwlock_t serv_lock;
extern struct list_head serv_list;