diff options
author | Dmitry Kozlov <xeb@mail.ru> | 2017-04-18 20:47:53 +0300 |
---|---|---|
committer | Dmitry Kozlov <xeb@mail.ru> | 2017-04-18 21:22:06 +0300 |
commit | a596ef53a689f0ecbf24d0043a4ad571cc8a4bf3 (patch) | |
tree | cc266cbbf9fa936098f16ba9ccdfcbe1188f57ec /accel-pppd/ctrl/ipoe | |
parent | bf4fabd6c50a34d4223bdc78be9e852720f71bba (diff) | |
download | accel-ppp-a596ef53a689f0ecbf24d0043a4ad571cc8a4bf3.tar.gz accel-ppp-a596ef53a689f0ecbf24d0043a4ad571cc8a4bf3.zip |
implemented session count limiting
new config option:
[common]
max-sessions=N
If set then accel-pppd stops reply to new connection requests if total number of sessions (active and starting) is reached specified limit.
Diffstat (limited to 'accel-pppd/ctrl/ipoe')
-rw-r--r-- | accel-pppd/ctrl/ipoe/ipoe.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/accel-pppd/ctrl/ipoe/ipoe.c b/accel-pppd/ctrl/ipoe/ipoe.c index b8aba6c9..7ac9f64a 100644 --- a/accel-pppd/ctrl/ipoe/ipoe.c +++ b/accel-pppd/ctrl/ipoe/ipoe.c @@ -1241,6 +1241,12 @@ static struct ipoe_session *ipoe_session_create_dhcpv4(struct ipoe_serv *serv, s int dlen = 0; uint8_t *ptr = NULL; + if (ap_shutdown) + return NULL; + + if (conf_max_sessions && ap_session_stat.active + ap_session_stat.starting >= conf_max_sessions) + return NULL; + ses = ipoe_session_alloc(serv->ifname); if (!ses) return NULL; @@ -1884,6 +1890,9 @@ static struct ipoe_session *ipoe_session_create_up(struct ipoe_serv *serv, struc if (ap_shutdown) return NULL; + if (conf_max_sessions && ap_session_stat.active + ap_session_stat.starting >= conf_max_sessions) + return NULL; + if (l4_redirect_list_check(saddr)) return NULL; |