diff options
author | Kozlov Dmitry <dima@server> | 2010-10-05 14:18:52 +0400 |
---|---|---|
committer | Kozlov Dmitry <dima@server> | 2010-10-05 14:18:52 +0400 |
commit | 7f16563bd5a4ef21b970e8dcbab0e5cbe02bfe97 (patch) | |
tree | 573a053112cb4c4b0980d0688a2fe63ef79fd1c0 /accel-pptpd/ppp | |
parent | c9e6b5f6b41163ed363e2ad0a1fc354607cb402e (diff) | |
download | accel-ppp-7f16563bd5a4ef21b970e8dcbab0e5cbe02bfe97.tar.gz accel-ppp-7f16563bd5a4ef21b970e8dcbab0e5cbe02bfe97.zip |
bug fixes
Diffstat (limited to 'accel-pptpd/ppp')
-rw-r--r-- | accel-pptpd/ppp/ppp_auth.c | 15 | ||||
-rw-r--r-- | accel-pptpd/ppp/ppp_ccp.c | 13 | ||||
-rw-r--r-- | accel-pptpd/ppp/ppp_fsm.c | 2 | ||||
-rw-r--r-- | accel-pptpd/ppp/ppp_ipcp.c | 9 | ||||
-rw-r--r-- | accel-pptpd/ppp/ppp_ipcp.h | 1 | ||||
-rw-r--r-- | accel-pptpd/ppp/ppp_lcp.c | 12 | ||||
-rw-r--r-- | accel-pptpd/ppp/ppp_lcp.h | 1 |
7 files changed, 40 insertions, 13 deletions
diff --git a/accel-pptpd/ppp/ppp_auth.c b/accel-pptpd/ppp/ppp_auth.c index dfa5415..ada01ad 100644 --- a/accel-pptpd/ppp/ppp_auth.c +++ b/accel-pptpd/ppp/ppp_auth.c @@ -41,6 +41,7 @@ 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= @@ -269,14 +270,15 @@ static int auth_layer_start(struct ppp_layer_data_t *ld) log_ppp_debug("auth_layer_start\n"); + ad->started = 1; + if (ad->auth_opt.auth) 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); } - + return 0; } @@ -289,6 +291,8 @@ 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; + log_ppp_debug("auth_layer_finished\n"); ppp_layer_finished(ad->ppp,ld); } @@ -298,6 +302,9 @@ static void auth_layer_free(struct ppp_layer_data_t *ld) struct auth_layer_data_t *ad=container_of(ld,typeof(*ad),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); } @@ -307,8 +314,8 @@ void __export auth_successed(struct ppp_t *ppp, char *username) struct auth_layer_data_t *ad=container_of(ppp_find_layer_data(ppp,&auth_layer),typeof(*ad),ld); log_ppp_debug("auth_layer_started\n"); ppp->username = username; - triton_event_fire(EV_PPP_AUTHORIZED, ppp); ppp_layer_started(ppp,&ad->ld); + triton_event_fire(EV_PPP_AUTHORIZED, ppp); } void __export auth_failed(struct ppp_t *ppp) diff --git a/accel-pptpd/ppp/ppp_ccp.c b/accel-pptpd/ppp/ppp_ccp.c index 36db6f9..ca12892 100644 --- a/accel-pptpd/ppp/ppp_ccp.c +++ b/accel-pptpd/ppp/ppp_ccp.c @@ -176,12 +176,15 @@ static void ccp_layer_up(struct ppp_fsm_t *fsm) { struct ppp_ccp_t *ccp=container_of(fsm,typeof(*ccp),fsm); log_ppp_debug("ccp_layer_started\n"); - ccp->started = 1; - if (ccp_set_flags(ccp->ppp->unit_fd, 1, 1)) { - ppp_terminate(ccp->ppp, 0); - return; + + if (!ccp->started) { + ccp->started = 1; + if (ccp_set_flags(ccp->ppp->unit_fd, 1, 1)) { + ppp_terminate(ccp->ppp, 0); + return; + } + ppp_layer_started(ccp->ppp,&ccp->ld); } - ppp_layer_started(ccp->ppp,&ccp->ld); } static void ccp_layer_down(struct ppp_fsm_t *fsm) diff --git a/accel-pptpd/ppp/ppp_fsm.c b/accel-pptpd/ppp/ppp_fsm.c index 6efc2e0..4769dc8 100644 --- a/accel-pptpd/ppp/ppp_fsm.c +++ b/accel-pptpd/ppp/ppp_fsm.c @@ -13,7 +13,7 @@ static int conf_max_terminate = 2; static int conf_max_configure = 5; static int conf_max_failure = 5; -static int conf_timeout = 3; +static int conf_timeout = 5; void send_term_req(struct ppp_fsm_t *layer); void send_term_ack(struct ppp_fsm_t *layer); diff --git a/accel-pptpd/ppp/ppp_ipcp.c b/accel-pptpd/ppp/ppp_ipcp.c index 795cbc0..f8d0a3f 100644 --- a/accel-pptpd/ppp/ppp_ipcp.c +++ b/accel-pptpd/ppp/ppp_ipcp.c @@ -139,7 +139,10 @@ static void ipcp_layer_up(struct ppp_fsm_t *fsm) { struct ppp_ipcp_t *ipcp=container_of(fsm,typeof(*ipcp),fsm); log_ppp_debug("ipcp_layer_started\n"); - ppp_layer_started(ipcp->ppp,&ipcp->ld); + if (!ipcp->started) { + ipcp->started = 1; + ppp_layer_started(ipcp->ppp,&ipcp->ld); + } } static void ipcp_layer_down(struct ppp_fsm_t *fsm) @@ -147,6 +150,10 @@ static void ipcp_layer_down(struct ppp_fsm_t *fsm) struct ppp_ipcp_t *ipcp=container_of(fsm,typeof(*ipcp),fsm); log_ppp_debug("ipcp_layer_finished\n"); ppp_layer_finished(ipcp->ppp,&ipcp->ld); + if (ipcp->started) + ipcp->started = 0; + else + ppp_terminate(ipcp->ppp, 1); } static void print_ropt(struct recv_opt_t *ropt) diff --git a/accel-pptpd/ppp/ppp_ipcp.h b/accel-pptpd/ppp/ppp_ipcp.h index 266ab7d..c955987 100644 --- a/accel-pptpd/ppp/ppp_ipcp.h +++ b/accel-pptpd/ppp/ppp_ipcp.h @@ -87,6 +87,7 @@ struct ppp_ipcp_t int ropt_len; int conf_req_len; + int started:1; }; int ipcp_option_register(struct ipcp_option_handler_t *h); diff --git a/accel-pptpd/ppp/ppp_lcp.c b/accel-pptpd/ppp/ppp_lcp.c index 1328764..90141aa 100644 --- a/accel-pptpd/ppp/ppp_lcp.c +++ b/accel-pptpd/ppp/ppp_lcp.c @@ -152,9 +152,13 @@ static void lcp_layer_up(struct ppp_fsm_t *fsm) { struct ppp_lcp_t *lcp=container_of(fsm,typeof(*lcp),fsm); log_ppp_debug("lcp_layer_started\n"); - ppp_layer_started(lcp->ppp,&lcp->ld); - start_echo(lcp); + if (!lcp->started) { + lcp->started = 1; + ppp_layer_started(lcp->ppp,&lcp->ld); + + start_echo(lcp); + } } static void lcp_layer_down(struct ppp_fsm_t *fsm) @@ -171,6 +175,10 @@ static void lcp_layer_finished(struct ppp_fsm_t *fsm) log_ppp_debug("lcp_layer_finished\n"); stop_echo(lcp); ppp_layer_finished(lcp->ppp,&lcp->ld); + if (lcp->started) + lcp->started = 0; + else + ppp_terminate(lcp->ppp, 1); } static void print_ropt(struct recv_opt_t *ropt) diff --git a/accel-pptpd/ppp/ppp_lcp.h b/accel-pptpd/ppp/ppp_lcp.h index 661f200..6d67b69 100644 --- a/accel-pptpd/ppp/ppp_lcp.h +++ b/accel-pptpd/ppp/ppp_lcp.h @@ -127,6 +127,7 @@ struct ppp_lcp_t int ropt_len; int conf_req_len; + int started:1; }; int lcp_option_register(struct lcp_option_handler_t *h); |