diff options
Diffstat (limited to 'accel-pppd/ctrl/pppoe')
-rw-r--r-- | accel-pppd/ctrl/pppoe/pppoe.c | 9 | ||||
-rw-r--r-- | accel-pppd/ctrl/pppoe/pppoe.h | 1 |
2 files changed, 10 insertions, 0 deletions
diff --git a/accel-pppd/ctrl/pppoe/pppoe.c b/accel-pppd/ctrl/pppoe/pppoe.c index ad363c8..e1bc402 100644 --- a/accel-pppd/ctrl/pppoe/pppoe.c +++ b/accel-pppd/ctrl/pppoe/pppoe.c @@ -723,6 +723,7 @@ static int check_padi_limit(struct pppoe_serv_t *serv, uint8_t *addr) if ((ts.tv_sec - padi->ts.tv_sec) * 1000 + (ts.tv_nsec - padi->ts.tv_nsec) / 1000000 > 1000) { list_del(&padi->entry); mempool_free(padi); + serv->padi_cnt--; __sync_sub_and_fetch(&total_padi_cnt, 1); } else break; @@ -767,6 +768,7 @@ static void pppoe_recv_PADI(struct pppoe_serv_t *serv, uint8_t *pack, int size) struct pppoe_tag *service_name_tag = NULL; int n, service_match = 0; struct delayed_pado_t *pado; + struct timespec ts; __sync_add_and_fetch(&stat_PADI_recv, 1); @@ -775,6 +777,13 @@ static void pppoe_recv_PADI(struct pppoe_serv_t *serv, uint8_t *pack, int size) if (check_padi_limit(serv, ethhdr->h_source)) { __sync_add_and_fetch(&stat_PADI_drop, 1); + if (conf_verbose) { + clock_gettime(CLOCK_MONOTONIC, &ts); + if (ts.tv_sec - 60 >= serv->last_padi_limit_warn) { + log_warn("pppoe: discarding overlimit PADI packets on interface %s\n", serv->ifname); + serv->last_padi_limit_warn = ts.tv_sec; + } + } return; } diff --git a/accel-pppd/ctrl/pppoe/pppoe.h b/accel-pppd/ctrl/pppoe/pppoe.h index ff0fc78..248ea40 100644 --- a/accel-pppd/ctrl/pppoe/pppoe.h +++ b/accel-pppd/ctrl/pppoe/pppoe.h @@ -87,6 +87,7 @@ struct pppoe_serv_t struct list_head padi_list; int padi_cnt; int padi_limit; + time_t last_padi_limit_warn; }; extern int conf_verbose; |