diff options
author | Dmitry Kozlov <xeb@mail.ru> | 2016-06-25 10:55:27 +0300 |
---|---|---|
committer | Dmitry Kozlov <xeb@mail.ru> | 2016-06-25 10:55:27 +0300 |
commit | 1833d760f0b797844758f41bf3a238d57b2b0aa4 (patch) | |
tree | d134cefdb218840ba6105988630880435af792c0 /accel-pppd/ppp | |
parent | 2d10076d240537e1f48bca0bb6e0b99aa4427406 (diff) | |
download | accel-ppp-1833d760f0b797844758f41bf3a238d57b2b0aa4.tar.gz accel-ppp-1833d760f0b797844758f41bf3a238d57b2b0aa4.zip |
ppp: introduced unit-preallocate option
If set to 1 then allocate unit (interface) before authorization, so Nas-Port and Nas-Port-Id would be defined in Access-Request phase
Diffstat (limited to 'accel-pppd/ppp')
-rw-r--r-- | accel-pppd/ppp/ppp.c | 18 |
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) |