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:17:54 +0300 |
| commit | 3ec0e18a9636924736cd5759ad53a41924363533 (patch) | |
| tree | 2a42a6bb8ce13e7fad686245d82fea217640c940 /accel-pppd/ctrl/pptp | |
| parent | f22c441fa712c110afb17cdb7476fe3bfdaf3538 (diff) | |
| download | accel-ppp-3ec0e18a9636924736cd5759ad53a41924363533.tar.gz accel-ppp-3ec0e18a9636924736cd5759ad53a41924363533.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.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 ec20586f..d878b087 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)); |
