summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Kozlov <xeb@mail.ru>2014-04-29 14:27:52 +0400
committerDmitry Kozlov <xeb@mail.ru>2014-04-29 14:27:52 +0400
commit1aa69ca5f6c9e1eeae6a1375516ef25624812728 (patch)
tree8f8655b1258d6161084f2d6554953742f81e4d6e
parente994deba6c8bede564e7639de29ffe5e8783df20 (diff)
downloadaccel-ppp-1aa69ca5f6c9e1eeae6a1375516ef25624812728.tar.gz
accel-ppp-1aa69ca5f6c9e1eeae6a1375516ef25624812728.zip
ipoe: add support for connlimit module
Signed-off-by: Dmitry Kozlov <xeb@mail.ru>
-rw-r--r--accel-pppd/ctrl/ipoe/ipoe.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/accel-pppd/ctrl/ipoe/ipoe.c b/accel-pppd/ctrl/ipoe/ipoe.c
index 0548feb..5820065 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);