summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--accel-pppd/accel-ppp.conf1
-rw-r--r--accel-pppd/ctrl/pppoe/pppoe.c14
2 files changed, 15 insertions, 0 deletions
diff --git a/accel-pppd/accel-ppp.conf b/accel-pppd/accel-ppp.conf
index 7f341b62..a4ece60d 100644
--- a/accel-pppd/accel-ppp.conf
+++ b/accel-pppd/accel-ppp.conf
@@ -75,6 +75,7 @@ verbose=1
[pppoe]
verbose=1
+#max-starting=0
#ac-name=xxx
#service-name=yyy
#pado-delay=0
diff --git a/accel-pppd/ctrl/pppoe/pppoe.c b/accel-pppd/ctrl/pppoe/pppoe.c
index 12b54004..a1f54e71 100644
--- a/accel-pppd/ctrl/pppoe/pppoe.c
+++ b/accel-pppd/ctrl/pppoe/pppoe.c
@@ -87,6 +87,7 @@ struct iplink_arg {
long *arg1;
};
+static int conf_max_starting;
int conf_verbose;
char *conf_service_name[255];
int conf_accept_any_service;
@@ -962,6 +963,13 @@ static void pppoe_recv_PADI(struct pppoe_serv_t *serv, uint8_t *pack, int size)
if (conf_max_sessions && ap_session_stat.active + ap_session_stat.starting >= conf_max_sessions)
return;
+ if (conf_max_starting > 0 && stat_starting >= conf_max_starting) {
+ log_warn("pppoe: Count of starting sessions > conf_max_starting, droping connection...\n");
+ return;
+
+ }
+
+
if (check_padi_limit(serv, ethhdr->h_source)) {
__sync_add_and_fetch(&stat_PADI_drop, 1);
@@ -1922,6 +1930,12 @@ static void load_config(void)
char *opt;
struct conf_sect_t *s = conf_get_section("pppoe");
+ opt = conf_get_opt("pppoe", "max-starting");
+ if (opt)
+ conf_max_starting = atoi(opt);
+ else
+ conf_max_starting = 0;
+
opt = conf_get_opt("pppoe", "verbose");
if (opt)
conf_verbose = atoi(opt);