From bae67915ab97db3f50a5d136fe81b897c70e7b08 Mon Sep 17 00:00:00 2001 From: Sylvain Rochet Date: Thu, 4 Aug 2016 22:06:45 +0200 Subject: [PATCH] PPP: fix dead phase set too early When we are disconnecting, we should switch to PPP dead phase at the very end, because this is our final disconnection phase allowing reconnect, therefore we should switch to dead phase after the link protocol finished disconnecting. We are currently switching to dead phase when LCP detected that the link is down, this is obviously wrong. Fix this flaw by continuing in disconnect phase until ppp_link_end is called from link protocol. --- src/netif/ppp/auth.c | 1 - src/netif/ppp/ppp.c | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/src/netif/ppp/auth.c b/src/netif/ppp/auth.c index 6e80352c..3c8bc79f 100644 --- a/src/netif/ppp/auth.c +++ b/src/netif/ppp/auth.c @@ -639,7 +639,6 @@ void link_terminated(ppp_pcb *pcb) { lcp_lowerdown(pcb); - new_phase(pcb, PPP_PHASE_DEAD); ppp_link_terminated(pcb); #if 0 /* diff --git a/src/netif/ppp/ppp.c b/src/netif/ppp/ppp.c index d5e317cb..4d14bba3 100644 --- a/src/netif/ppp/ppp.c +++ b/src/netif/ppp/ppp.c @@ -746,6 +746,7 @@ void ppp_link_failed(ppp_pcb *pcb) { /** Called when link is normally down (i.e. it was asked to end) */ void ppp_link_end(ppp_pcb *pcb) { PPPDEBUG(LOG_DEBUG, ("ppp_link_end[%d]\n", pcb->netif->num)); + new_phase(pcb, PPP_PHASE_DEAD); if (pcb->err_code == PPPERR_NONE) { pcb->err_code = PPPERR_CONNECT; }