summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--accel-pppd/extra/pppd_compat.c10
-rw-r--r--accel-pppd/session.c4
2 files changed, 9 insertions, 5 deletions
diff --git a/accel-pppd/extra/pppd_compat.c b/accel-pppd/extra/pppd_compat.c
index 0aca3e6e..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");
diff --git a/accel-pppd/session.c b/accel-pppd/session.c
index 1d25c3a3..3c559398 100644
--- a/accel-pppd/session.c
+++ b/accel-pppd/session.c
@@ -421,6 +421,10 @@ int __export ap_session_set_username(struct ap_session *s, char *username)
_free(username);
return -1;
} else {
+ if (!ses->wakeup) {
+ ses->wakeup = s->ctrl->ctx;
+ wait = 1;
+ }
ap_session_ifdown(ses);
triton_context_call(ses->ctrl->ctx, (triton_event_func)__terminate_sec, ses);
continue;