From 1aa69ca5f6c9e1eeae6a1375516ef25624812728 Mon Sep 17 00:00:00 2001 From: Dmitry Kozlov Date: Tue, 29 Apr 2014 14:27:52 +0400 Subject: ipoe: add support for connlimit module Signed-off-by: Dmitry Kozlov --- accel-pppd/ctrl/ipoe/ipoe.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'accel-pppd') diff --git a/accel-pppd/ctrl/ipoe/ipoe.c b/accel-pppd/ctrl/ipoe/ipoe.c index 0548feb9..5820065c 100644 --- a/accel-pppd/ctrl/ipoe/ipoe.c +++ b/accel-pppd/ctrl/ipoe/ipoe.c @@ -141,6 +141,8 @@ static unsigned int stat_delayed_offer; static mempool_t ses_pool; static mempool_t disc_item_pool; +static int connlimit_loaded; + static LIST_HEAD(serv_list); static pthread_mutex_t serv_lock = PTHREAD_MUTEX_INITIALIZER; @@ -1105,6 +1107,9 @@ static void ipoe_ses_recv_dhcpv4(struct dhcpv4_serv *dhcpv4, struct dhcpv4_packe if (ap_shutdown) return; + + if (connlimit_loaded && connlimit_check(cl_key_from_mac(pack->hdr->chaddr))) + return; if (conf_verbose) { log_ppp_info2("recv "); @@ -1274,6 +1279,9 @@ static void __ipoe_recv_dhcpv4(struct dhcpv4_serv *dhcpv4, struct dhcpv4_packet if (ap_shutdown) return; + + if (connlimit_loaded && connlimit_check(cl_key_from_mac(pack->hdr->chaddr))) + return; pthread_mutex_lock(&serv->lock); if (pack->msg_type == DHCPDISCOVER) { @@ -2978,6 +2986,8 @@ static void ipoe_init(void) triton_event_register_handler(EV_RADIUS_COA, (triton_event_func)ev_radius_coa); } #endif + + connlimit_loaded = triton_module_loaded("connlimit"); } DEFINE_INIT(52, ipoe_init); -- cgit v1.2.3