diff options
-rw-r--r-- | accel-pppd/ppp/ppp.c | 27 | ||||
-rw-r--r-- | accel-pppd/ppp/ppp.h | 2 | ||||
-rw-r--r-- | accel-pppd/ppp/ppp_ccp.c | 2 | ||||
-rw-r--r-- | accel-pppd/ppp/ppp_ipcp.c | 7 | ||||
-rw-r--r-- | accel-pppd/ppp/ppp_ipv6cp.c | 5 |
5 files changed, 31 insertions, 12 deletions
diff --git a/accel-pppd/ppp/ppp.c b/accel-pppd/ppp/ppp.c index 3b65dfeb..a0f65f1d 100644 --- a/accel-pppd/ppp/ppp.c +++ b/accel-pppd/ppp/ppp.c @@ -433,16 +433,11 @@ static void ppp_ifup(struct ppp_t *ppp) triton_event_fire(EV_PPP_STARTED, ppp); } -void __export ppp_layer_started(struct ppp_t *ppp, struct ppp_layer_data_t *d) +static void __ppp_layer_started(struct ppp_t *ppp, struct ppp_layer_data_t *d) { struct layer_node_t *n = d->node; int f = 0; - if (d->started) - return; - - d->started = 1; - list_for_each_entry(d, &n->items, entry) { if (!d->started && !d->passive) return; if (d->started && !d->optional) @@ -470,6 +465,26 @@ void __export ppp_layer_started(struct ppp_t *ppp, struct ppp_layer_data_t *d) } } +void __export ppp_layer_started(struct ppp_t *ppp, struct ppp_layer_data_t *d) +{ + if (d->started) + return; + + d->started = 1; + + __ppp_layer_started(ppp, d); +} + +void __export ppp_layer_passive(struct ppp_t *ppp, struct ppp_layer_data_t *d) +{ + if (d->started) + return; + + d->passive = 1; + + __ppp_layer_started(ppp, d); +} + void __export ppp_layer_finished(struct ppp_t *ppp, struct ppp_layer_data_t *d) { struct layer_node_t *n = d->node; diff --git a/accel-pppd/ppp/ppp.h b/accel-pppd/ppp/ppp.h index 744202e1..4d3fccd6 100644 --- a/accel-pppd/ppp/ppp.h +++ b/accel-pppd/ppp/ppp.h @@ -174,6 +174,8 @@ void ppp_recv_proto_rej(struct ppp_t *ppp, uint16_t proto); struct ppp_fsm_t* ppp_lcp_init(struct ppp_t *ppp); void ppp_layer_started(struct ppp_t *ppp,struct ppp_layer_data_t*); void ppp_layer_finished(struct ppp_t *ppp,struct ppp_layer_data_t*); +void ppp_layer_passive(struct ppp_t *ppp,struct ppp_layer_data_t*); + void ppp_terminate(struct ppp_t *ppp, int hard, int cause); void ppp_register_chan_handler(struct ppp_t *, struct ppp_handler_t *); diff --git a/accel-pppd/ppp/ppp_ccp.c b/accel-pppd/ppp/ppp_ccp.c index 5b7715a4..9602f7dd 100644 --- a/accel-pppd/ppp/ppp_ccp.c +++ b/accel-pppd/ppp/ppp_ccp.c @@ -210,7 +210,7 @@ static void ccp_layer_finished(struct ppp_fsm_t *fsm) log_ppp_debug("ccp_layer_finished\n"); if (!ccp->started) - ccp->ld.passive = 1; + ppp_layer_passive(ccp->ppp, &ccp->ld); else if (!ccp->ppp->terminating) ppp_terminate(ccp->ppp, TERM_USER_ERROR, 0); } diff --git a/accel-pppd/ppp/ppp_ipcp.c b/accel-pppd/ppp/ppp_ipcp.c index 7a424911..3a944169 100644 --- a/accel-pppd/ppp/ppp_ipcp.c +++ b/accel-pppd/ppp/ppp_ipcp.c @@ -117,8 +117,9 @@ static void ipcp_start_timeout(struct triton_timer_t *t) struct ppp_ipcp_t *ipcp = container_of(t, typeof(*ipcp), timeout); triton_timer_del(t); - - ppp_terminate(ipcp->ppp, TERM_USER_ERROR, 0); + + if (ipcp->ppp->state == PPP_STATE_STARTING) + ppp_terminate(ipcp->ppp, TERM_USER_ERROR, 0); } int ipcp_layer_start(struct ppp_layer_data_t *ld) @@ -202,7 +203,7 @@ static void ipcp_layer_finished(struct ppp_fsm_t *fsm) if (conf_ipv4 == IPV4_REQUIRE) ppp_terminate(ipcp->ppp, TERM_USER_ERROR, 0); else - ipcp->ld.passive = 1; + ppp_layer_passive(ipcp->ppp, &ipcp->ld); } else if (!ipcp->ppp->terminating) ppp_terminate(ipcp->ppp, TERM_USER_ERROR, 0); } diff --git a/accel-pppd/ppp/ppp_ipv6cp.c b/accel-pppd/ppp/ppp_ipv6cp.c index 554eacb2..1a9a334b 100644 --- a/accel-pppd/ppp/ppp_ipv6cp.c +++ b/accel-pppd/ppp/ppp_ipv6cp.c @@ -118,7 +118,8 @@ static void ipv6cp_start_timeout(struct triton_timer_t *t) triton_timer_del(t); - ppp_terminate(ipv6cp->ppp, TERM_USER_ERROR, 0); + if (ipv6cp->ppp->state == PPP_STATE_STARTING) + ppp_terminate(ipv6cp->ppp, TERM_USER_ERROR, 0); } int ipv6cp_layer_start(struct ppp_layer_data_t *ld) @@ -202,7 +203,7 @@ static void ipv6cp_layer_finished(struct ppp_fsm_t *fsm) if (conf_ipv6 == IPV6_REQUIRE) ppp_terminate(ipv6cp->ppp, TERM_USER_ERROR, 0); else - ipv6cp->ld.passive = 1; + ppp_layer_passive(ipv6cp->ppp, &ipv6cp->ld); } else if (!ipv6cp->ppp->terminating) ppp_terminate(ipv6cp->ppp, TERM_USER_ERROR, 0); } |