From 1d108b400fd27dd726471255853681f866c5c7a8 Mon Sep 17 00:00:00 2001 From: Sylvain Rochet Date: Mon, 20 Jun 2016 00:25:59 +0200 Subject: [PATCH] PPP, move various connect cleanup from ppp_clear to ppp_start What we really need here is to cleanup the PPP environment before starting LCP, we don't care about the PPP state before LCP is started. Move cleanups from ppp_clear to ppp_start to clean them just before we need them cleaned. --- src/netif/ppp/ppp.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/netif/ppp/ppp.c b/src/netif/ppp/ppp.c index 95cc22b0..99d2572f 100644 --- a/src/netif/ppp/ppp.c +++ b/src/netif/ppp/ppp.c @@ -703,6 +703,12 @@ ppp_pcb *ppp_new(struct netif *pppif, const struct link_callbacks *callbacks, vo /* Set a PPP PCB to its initial state */ void ppp_clear(ppp_pcb *pcb) { LWIP_ASSERT("pcb->phase == PPP_PHASE_DEAD || pcb->phase == PPP_PHASE_HOLDOFF", pcb->phase == PPP_PHASE_DEAD || pcb->phase == PPP_PHASE_HOLDOFF); + new_phase(pcb, PPP_PHASE_INITIALIZE); +} + +/** Initiate LCP open request */ +void ppp_start(ppp_pcb *pcb) { + PPPDEBUG(LOG_DEBUG, ("ppp_start[%d]\n", pcb->netif->num)); /* Clean data not taken care by anything else, mostly shared data. */ #if PPP_STATS_SUPPORT @@ -717,13 +723,8 @@ void ppp_clear(ppp_pcb *pcb) { vj_compress_init(&pcb->vj_comp); #endif /* VJ_SUPPORT && LWIP_TCP */ - new_phase(pcb, PPP_PHASE_INITIALIZE); -} - -/** Initiate LCP open request */ -void ppp_start(ppp_pcb *pcb) { - PPPDEBUG(LOG_DEBUG, ("ppp_start[%d]\n", pcb->netif->num)); - lcp_open(pcb); /* Start protocol */ + /* Start protocol */ + lcp_open(pcb); lcp_lowerup(pcb); PPPDEBUG(LOG_DEBUG, ("ppp_start[%d]: finished\n", pcb->netif->num)); }