From c6ed5dd9cda38f493224d73bc5af415d7fac7773 Mon Sep 17 00:00:00 2001 From: Dmitry Kozlov Date: Wed, 6 Nov 2013 16:51:15 +0400 Subject: pppoe: add statistics for filtered packets (mac-filter) Signed-off-by: Dmitry Kozlov --- accel-pppd/ctrl/pppoe/cli.c | 1 + accel-pppd/ctrl/pppoe/pppoe.c | 5 ++++- accel-pppd/ctrl/pppoe/pppoe.h | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) (limited to 'accel-pppd/ctrl/pppoe') 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; -- cgit v1.2.3