summaryrefslogtreecommitdiff
path: root/accel-pppd/ctrl
diff options
context:
space:
mode:
authorDmitry Kozlov <xeb@mail.ru>2013-11-06 16:51:15 +0400
committerDmitry Kozlov <xeb@mail.ru>2013-11-06 16:51:15 +0400
commitc6ed5dd9cda38f493224d73bc5af415d7fac7773 (patch)
tree7f9ae6e0aaadcbe7fd6265378d488fa79461f556 /accel-pppd/ctrl
parent6d160f30d56df6433ea30e504e0dfeb626d52aa5 (diff)
downloadaccel-ppp-c6ed5dd9cda38f493224d73bc5af415d7fac7773.tar.gz
accel-ppp-c6ed5dd9cda38f493224d73bc5af415d7fac7773.zip
pppoe: add statistics for filtered packets (mac-filter)
Signed-off-by: Dmitry Kozlov <xeb@mail.ru>
Diffstat (limited to 'accel-pppd/ctrl')
-rw-r--r--accel-pppd/ctrl/pppoe/cli.c1
-rw-r--r--accel-pppd/ctrl/pppoe/pppoe.c5
-rw-r--r--accel-pppd/ctrl/pppoe/pppoe.h1
3 files changed, 6 insertions, 1 deletions
diff --git a/accel-pppd/ctrl/pppoe/cli.c b/accel-pppd/ctrl/pppoe/cli.c
index 4f712b8..ad577c1 100644
--- a/accel-pppd/ctrl/pppoe/cli.c
+++ b/accel-pppd/ctrl/pppoe/cli.c
@@ -97,6 +97,7 @@ static int show_stat_exec(const char *cmd, char * const *fields, int fields_cnt,
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);
+ cli_sendv(client, " filtered: %lu\r\n", stat_filtered);
return CLI_CMD_OK;
}
diff --git a/accel-pppd/ctrl/pppoe/pppoe.c b/accel-pppd/ctrl/pppoe/pppoe.c
index c254c7a..9a43181 100644
--- a/accel-pppd/ctrl/pppoe/pppoe.c
+++ b/accel-pppd/ctrl/pppoe/pppoe.c
@@ -105,6 +105,7 @@ unsigned long stat_PADR_recv;
unsigned long stat_PADR_dup_recv;
unsigned long stat_PADS_sent;
unsigned int total_padi_cnt;
+unsigned long stat_filtered;
pthread_rwlock_t serv_lock = PTHREAD_RWLOCK_INITIALIZER;
LIST_HEAD(serv_list);
@@ -1055,8 +1056,10 @@ static int pppoe_serv_read(struct triton_md_handler_t *h)
continue;
}
- if (mac_filter_check(ethhdr->h_source))
+ if (mac_filter_check(ethhdr->h_source)) {
+ __sync_add_and_fetch(&stat_filtered, 1);
continue;
+ }
if (memcmp(ethhdr->h_dest, bc_addr, ETH_ALEN) && memcmp(ethhdr->h_dest, serv->hwaddr, ETH_ALEN))
continue;
diff --git a/accel-pppd/ctrl/pppoe/pppoe.h b/accel-pppd/ctrl/pppoe/pppoe.h
index faed20c..9811d63 100644
--- a/accel-pppd/ctrl/pppoe/pppoe.h
+++ b/accel-pppd/ctrl/pppoe/pppoe.h
@@ -104,6 +104,7 @@ extern unsigned long stat_PADR_recv;
extern unsigned long stat_PADR_dup_recv;
extern unsigned long stat_PADS_sent;
extern unsigned long stat_PADI_drop;
+extern unsigned long stat_filtered;
extern pthread_rwlock_t serv_lock;
extern struct list_head serv_list;