summaryrefslogtreecommitdiff
path: root/accel-pppd/session.c
diff options
context:
space:
mode:
authorDmitry Kozlov <xeb@mail.ru>2017-04-18 20:47:53 +0300
committerDmitry Kozlov <xeb@mail.ru>2017-04-18 21:22:06 +0300
commita596ef53a689f0ecbf24d0043a4ad571cc8a4bf3 (patch)
treecc266cbbf9fa936098f16ba9ccdfcbe1188f57ec /accel-pppd/session.c
parentbf4fabd6c50a34d4223bdc78be9e852720f71bba (diff)
downloadaccel-ppp-xebd-a596ef53a689f0ecbf24d0043a4ad571cc8a4bf3.tar.gz
accel-ppp-xebd-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/session.c')
-rw-r--r--accel-pppd/session.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/accel-pppd/session.c b/accel-pppd/session.c
index 730a57a..1d25c3a 100644
--- a/accel-pppd/session.c
+++ b/accel-pppd/session.c
@@ -34,6 +34,7 @@ static int conf_single_session = -1;
static int conf_sid_source;
static int conf_seq_save_timeout = 10;
static const char *conf_seq_file;
+int __export conf_max_sessions;
pthread_rwlock_t __export ses_lock = PTHREAD_RWLOCK_INITIALIZER;
__export LIST_HEAD(ses_list);
@@ -76,6 +77,10 @@ void __export ap_session_set_ifindex(struct ap_session *ses)
ses->acct_tx_packets_i = stats.tx_packets;
ses->acct_rx_bytes_i = stats.rx_bytes;
ses->acct_tx_bytes_i = stats.tx_bytes;
+ ses->acct_rx_bytes = 0;
+ ses->acct_tx_bytes = 0;
+ ses->acct_input_gigawords = 0;
+ ses->acct_output_gigawords = 0;
}
}
@@ -511,6 +516,12 @@ static void load_config(void)
conf_seq_file = conf_get_opt("common", "seq-file");
if (!conf_seq_file)
conf_seq_file = "/var/lib/accel-ppp/seq";
+
+ opt = conf_get_opt("common", "max-sessions");
+ if (opt)
+ conf_max_sessions = atoi(opt);
+ else
+ conf_max_sessions = 0;
}
static void init(void)