diff options
author | Dmitry Kozlov <xeb@mail.ru> | 2017-04-18 20:42:32 +0300 |
---|---|---|
committer | Dmitry Kozlov <xeb@mail.ru> | 2017-04-18 20:42:32 +0300 |
commit | 88a908974b0b2e9c7eee8ad9a8b0b4432e95d167 (patch) | |
tree | c347a8a2aca1d4ef069862fac4c131c31a501ceb /accel-pppd/ctrl/pptp/pptp.c | |
parent | c94c49114ca6c6dd342dad0db525050a154f7a0e (diff) | |
download | accel-ppp-88a908974b0b2e9c7eee8ad9a8b0b4432e95d167.tar.gz accel-ppp-88a908974b0b2e9c7eee8ad9a8b0b4432e95d167.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/pptp/pptp.c')
-rw-r--r-- | accel-pppd/ctrl/pptp/pptp.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/accel-pppd/ctrl/pptp/pptp.c b/accel-pppd/ctrl/pptp/pptp.c index 4aba5767..c8731ca7 100644 --- a/accel-pppd/ctrl/pptp/pptp.c +++ b/accel-pppd/ctrl/pptp/pptp.c @@ -648,9 +648,14 @@ static int pptp_connect(struct triton_md_handler_t *h) continue; } + if (conf_max_sessions && ap_session_stat.active + ap_session_stat.starting > conf_max_sessions) { + close(sock); + continue; + } + if (triton_module_loaded("connlimit") && connlimit_check(cl_key_from_ipv4(addr.sin_addr.s_addr))) { close(sock); - return 0; + continue; } log_info2("pptp: new connection from %s\n", inet_ntoa(addr.sin_addr)); |