summaryrefslogtreecommitdiff
path: root/accel-pppd/ctrl/pptp
diff options
context:
space:
mode:
authorDmitry Kozlov <xeb@mail.ru>2017-04-18 16:07:35 +0300
committerDmitry Kozlov <xeb@mail.ru>2017-04-18 16:13:27 +0300
commite3fc927ee321ed6663d46357de0165340b792860 (patch)
treef346c9b3c6d178b6850cf253ac60fd5917c08a69 /accel-pppd/ctrl/pptp
parent8e91194cfd617af017f72e3e785cc71490482d38 (diff)
downloadaccel-ppp-e3fc927ee321ed6663d46357de0165340b792860.tar.gz
accel-ppp-e3fc927ee321ed6663d46357de0165340b792860.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')
-rw-r--r--accel-pppd/ctrl/pptp/pptp.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/accel-pppd/ctrl/pptp/pptp.c b/accel-pppd/ctrl/pptp/pptp.c
index ec20586f..fdcd439f 100644
--- a/accel-pppd/ctrl/pptp/pptp.c
+++ b/accel-pppd/ctrl/pptp/pptp.c
@@ -644,9 +644,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));