summaryrefslogtreecommitdiff
path: root/accel-pppd/ppp
diff options
context:
space:
mode:
Diffstat (limited to 'accel-pppd/ppp')
-rw-r--r--accel-pppd/ppp/ppp.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/accel-pppd/ppp/ppp.c b/accel-pppd/ppp/ppp.c
index f05b47b..db09148 100644
--- a/accel-pppd/ppp/ppp.c
+++ b/accel-pppd/ppp/ppp.c
@@ -28,7 +28,8 @@
#include "memdebug.h"
int __export conf_ppp_verbose;
-int conf_unit_cache = 0;
+int conf_unit_cache;
+static int conf_unit_preallocate;
#define PPP_BUF_SIZE 8192
static mempool_t buf_pool;
@@ -110,7 +111,11 @@ int __export establish_ppp(struct ppp_t *ppp)
ppp->chan_hnd.fd = ppp->chan_fd;
ppp->chan_hnd.read = ppp_chan_read;
- log_ppp_debug("ppp establishing\n");
+ if (conf_unit_preallocate) {
+ if (connect_ppp_channel(ppp))
+ goto exit_close_chan;
+ } else
+ log_ppp_debug("ppp establishing\n");
if (ap_session_starting(&ppp->ses))
goto exit_close_chan;
@@ -133,6 +138,9 @@ int __export connect_ppp_channel(struct ppp_t *ppp)
struct pppunit_cache *uc = NULL;
struct ifreq ifr;
+ if (ppp->unit_fd != -1)
+ return 0;
+
if (uc_size) {
pthread_mutex_lock(&uc_lock);
if (!list_empty(&uc_list)) {
@@ -693,6 +701,12 @@ static void load_config(void)
conf_unit_cache = atoi(opt);
else
conf_unit_cache = 0;
+
+ opt = conf_get_opt("ppp", "unit-preallocate");
+ if (opt)
+ conf_unit_preallocate = atoi(opt);
+ else
+ conf_unit_preallocate = 0;
}
static void init(void)