mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-12-25 09:16:20 +00:00
PPP: close link protocol if LCP is not started in ppp_close
ppp_close might try to close LCP even if LCP is not started, it happens because because the PPP session might be waiting for the link protocol to come up and we do not check that. We say in the PPP documentation that ppp_close() can be called anytime, so, if link protocol is currently trying to connect, we must cancel the link connection. Fix it by calling the link protocol disconnect callback if LCP is not started yet.
This commit is contained in:
parent
7c02a85424
commit
09c22e13fe
@ -341,6 +341,12 @@ ppp_close(ppp_pcb *pcb, u8_t nocarrier)
|
||||
return ERR_INPROGRESS;
|
||||
}
|
||||
|
||||
/* LCP not open, close link protocol */
|
||||
if (pcb->phase < PPP_PHASE_ESTABLISH) {
|
||||
ppp_link_terminated(pcb);
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Only accept carrier lost signal on the stable running phase in order
|
||||
* to prevent changing the PPP phase FSM in transition phases.
|
||||
|
Loading…
Reference in New Issue
Block a user