diff options
author | Dmitry Kozlov <xeb@mail.ru> | 2010-11-21 17:31:00 +0300 |
---|---|---|
committer | Dmitry Kozlov <xeb@mail.ru> | 2010-11-21 17:31:00 +0300 |
commit | a09fdabf7939819581c6b7797b180a18c4f477fa (patch) | |
tree | 4cfaa02377ff7a660c53099c300de0890dff5d3f /accel-pptpd/ppp | |
parent | ddad202eca1c0a1d95321bd396df0dda01620a2b (diff) | |
download | accel-ppp-xebd-a09fdabf7939819581c6b7797b180a18c4f477fa.tar.gz accel-ppp-xebd-a09fdabf7939819581c6b7797b180a18c4f477fa.zip |
bug fixes
Diffstat (limited to 'accel-pptpd/ppp')
-rw-r--r-- | accel-pptpd/ppp/ppp.c | 18 | ||||
-rw-r--r-- | accel-pptpd/ppp/ppp_auth.c | 21 | ||||
-rw-r--r-- | accel-pptpd/ppp/ppp_fsm.c | 8 |
3 files changed, 24 insertions, 23 deletions
diff --git a/accel-pptpd/ppp/ppp.c b/accel-pptpd/ppp/ppp.c index acda605..408383e 100644 --- a/accel-pptpd/ppp/ppp.c +++ b/accel-pptpd/ppp/ppp.c @@ -152,7 +152,7 @@ int __export establish_ppp(struct ppp_t *ppp) triton_md_enable_handler(&ppp->unit_hnd, MD_MODE_READ); ppp->state = PPP_STATE_STARTING; - __sync_fetch_and_add(&ppp_stat.starting, 1); + ppp_stat.starting++; pthread_rwlock_wrlock(&ppp_lock); list_add_tail(&ppp->entry, &ppp_list); @@ -184,13 +184,13 @@ static void destablish_ppp(struct ppp_t *ppp) switch (ppp->state) { case PPP_STATE_ACTIVE: - __sync_fetch_and_sub(&ppp_stat.active, 1); + ppp_stat.active--; break; case PPP_STATE_STARTING: - __sync_fetch_and_sub(&ppp_stat.starting, 1); + ppp_stat.starting--; break; case PPP_STATE_FINISHING: - __sync_fetch_and_sub(&ppp_stat.finishing, 1); + ppp_stat.finishing--; break; } @@ -374,8 +374,8 @@ void __export ppp_layer_started(struct ppp_t *ppp, struct ppp_layer_data_t *d) if (n->entry.next == &ppp->layers) { ppp->state = PPP_STATE_ACTIVE; - __sync_fetch_and_sub(&ppp_stat.starting, 1); - __sync_fetch_and_add(&ppp_stat.active, 1); + ppp_stat.starting--; + ppp_stat.active++; ppp->ctrl->started(ppp); triton_event_fire(EV_PPP_STARTED, ppp); } else { @@ -430,10 +430,10 @@ void __export ppp_terminate(struct ppp_t *ppp, int cause, int hard) ppp->terminating = 1; if (ppp->state == PPP_STATE_ACTIVE) - __sync_fetch_and_sub(&ppp_stat.active, 1); + ppp_stat.active--; else - __sync_fetch_and_sub(&ppp_stat.starting, 1); - __sync_fetch_and_add(&ppp_stat.finishing, 1); + ppp_stat.starting--; + ppp_stat.finishing++; ppp->state = PPP_STATE_FINISHING; log_ppp_debug("ppp_terminate\n"); diff --git a/accel-pptpd/ppp/ppp_auth.c b/accel-pptpd/ppp/ppp_auth.c index c993414..0683593 100644 --- a/accel-pptpd/ppp/ppp_auth.c +++ b/accel-pptpd/ppp/ppp_auth.c @@ -34,6 +34,7 @@ struct auth_option_t struct list_head auth_list; struct auth_data_t *auth; struct auth_data_t *peer_auth; + int started:1; }; struct auth_layer_data_t @@ -41,7 +42,6 @@ struct auth_layer_data_t struct ppp_layer_data_t ld; struct auth_option_t auth_opt; struct ppp_t *ppp; - int started:1; }; static struct lcp_option_handler_t auth_opt_hnd = @@ -92,6 +92,11 @@ static void auth_free(struct ppp_lcp_t *lcp, struct lcp_option_t *opt) struct auth_option_t *auth_opt = container_of(opt, typeof(*auth_opt), opt); struct auth_data_t *d; + if (auth_opt->started && auth_opt->auth) { + auth_opt->auth->h->finish(lcp->ppp, auth_opt->auth); + auth_opt->started = 0; + } + while(!list_empty(&auth_opt->auth_list)) { d = list_entry(auth_opt->auth_list.next, typeof(*d), entry); list_del(&d->entry); @@ -258,12 +263,11 @@ static int auth_layer_start(struct ppp_layer_data_t *ld) struct auth_layer_data_t *ad = container_of(ld,typeof(*ad),ld); log_ppp_debug("auth_layer_start\n"); - - ad->started = 1; - - if (ad->auth_opt.auth) + + if (ad->auth_opt.auth) { + ad->auth_opt.started = 1; ad->auth_opt.auth->h->start(ad->ppp, ad->auth_opt.auth); - else { + } else { log_ppp_debug("auth_layer_started\n"); ppp_layer_started(ad->ppp, ld); } @@ -280,7 +284,7 @@ static void auth_layer_finish(struct ppp_layer_data_t *ld) if (ad->auth_opt.auth) ad->auth_opt.auth->h->finish(ad->ppp, ad->auth_opt.auth); - ad->started = 0; + ad->auth_opt.started = 0; log_ppp_debug("auth_layer_finished\n"); ppp_layer_finished(ad->ppp, ld); @@ -292,9 +296,6 @@ static void auth_layer_free(struct ppp_layer_data_t *ld) log_ppp_debug("auth_layer_free\n"); - if (ad->started && ad->auth_opt.auth) - ad->auth_opt.auth->h->finish(ad->ppp, ad->auth_opt.auth); - _free(ad); } diff --git a/accel-pptpd/ppp/ppp_fsm.c b/accel-pptpd/ppp/ppp_fsm.c index 495b346..46b6215 100644 --- a/accel-pptpd/ppp/ppp_fsm.c +++ b/accel-pptpd/ppp/ppp_fsm.c @@ -192,8 +192,8 @@ void ppp_fsm_timeout1(struct ppp_fsm_t *layer) case FSM_Req_Sent: case FSM_Ack_Sent: stop_timer(layer); - if (layer->layer_finished) layer->layer_finished(layer); layer->fsm_state=FSM_Stopped; + if (layer->layer_finished) layer->layer_finished(layer); break; default: break; @@ -417,8 +417,8 @@ void ppp_fsm_recv_term_ack(struct ppp_fsm_t *layer) if (layer->layer_finished) layer->layer_finished(layer); break; case FSM_Stopping: - if (layer->layer_finished) layer->layer_finished(layer); layer->fsm_state=FSM_Stopped; + if (layer->layer_finished) layer->layer_finished(layer); break; case FSM_Ack_Rcvd: layer->fsm_state=FSM_Req_Sent; @@ -462,15 +462,15 @@ void ppp_fsm_recv_code_rej_bad(struct ppp_fsm_t *layer) layer->fsm_state=FSM_Stopping; break; case FSM_Closing: - if (layer->layer_finished) layer->layer_finished(layer); layer->fsm_state=FSM_Closed; + if (layer->layer_finished) layer->layer_finished(layer); break; case FSM_Stopping: case FSM_Req_Sent: case FSM_Ack_Rcvd: case FSM_Ack_Sent: - if (layer->layer_finished) layer->layer_finished(layer); layer->fsm_state=FSM_Stopped; + if (layer->layer_finished) layer->layer_finished(layer); break; default: break; |