diff options
author | Dmitry Kozlov <xeb@mail.ru> | 2017-10-16 15:34:28 +0300 |
---|---|---|
committer | Dmitry Kozlov <xeb@mail.ru> | 2017-10-16 15:34:28 +0300 |
commit | a4ec2baf624ee3642b8fcb09d1c30229c8e17f91 (patch) | |
tree | ab475df05ac3de738ed4d68e988973400cc10f91 /accel-pppd/extra/pppd_compat.c | |
parent | cf24c160195be9960e4c4b413803ece7c87ef2c7 (diff) | |
download | accel-ppp-a4ec2baf624ee3642b8fcb09d1c30229c8e17f91.tar.gz accel-ppp-a4ec2baf624ee3642b8fcb09d1c30229c8e17f91.zip |
pppd_compat: do not call ip-down if session was not started
Diffstat (limited to 'accel-pppd/extra/pppd_compat.c')
-rw-r--r-- | accel-pppd/extra/pppd_compat.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/accel-pppd/extra/pppd_compat.c b/accel-pppd/extra/pppd_compat.c index 03ddf29b..58581899 100644 --- a/accel-pppd/extra/pppd_compat.c +++ b/accel-pppd/extra/pppd_compat.c @@ -262,6 +262,8 @@ static void ev_ses_pre_up(struct ap_session *ses) ap_session_terminate(ses, pd->res > 127 ? TERM_NAS_ERROR : TERM_ADMIN_RESET, 0); return; } + + pd->started = 1; } else if (pid == 0) { sigset_t set; sigfillset(&set); @@ -318,8 +320,6 @@ static void ev_ses_started(struct ap_session *ses) _exit(EXIT_FAILURE); } else log_error("pppd_compat: fork: %s\n", strerror(errno)); - - pd->started = 1; } static void ev_ses_finished(struct ap_session *ses) @@ -335,7 +335,7 @@ static void ev_ses_finished(struct ap_session *ses) if (!pd) return; - if (pd->started) { + if (pd->ip_up_hnd.pid) { pthread_mutex_lock(&pd->ip_up_hnd.lock); if (pd->ip_up_hnd.pid) { log_ppp_warn("pppd_compat: ip-up is not yet finished, terminating it ...\n"); @@ -344,7 +344,7 @@ static void ev_ses_finished(struct ap_session *ses) pthread_mutex_unlock(&pd->ip_up_hnd.lock); } - if (conf_ip_down) { + if (pd->started && conf_ip_down) { argv[4] = ipaddr; argv[5] = peer_ipaddr; fill_argv(argv, pd, conf_ip_down); @@ -379,7 +379,7 @@ static void ev_ses_finished(struct ap_session *ses) log_error("pppd_compat: fork: %s\n", strerror(errno)); } - if (pd->started) { + if (pd->ip_up_hnd.pid) { pthread_mutex_lock(&pd->ip_up_hnd.lock); if (pd->ip_up_hnd.pid) { log_ppp_warn("pppd_compat: ip-up is not yet finished, killing it ...\n"); @@ -736,7 +736,7 @@ static void load_config() if (opt) conf_fork_limit = atoi(opt); else - conf_fork_limit = sysconf(_SC_NPROCESSORS_ONLN*2); + conf_fork_limit = sysconf(_SC_NPROCESSORS_ONLN)*2; } static void init(void) |