mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-12-26 12:13:47 +00:00
PPP, PPPoE: add support for disconnecting in link initiation state in disconnect callback
Disconnect callback does not currently support a disconnect event while initiation is in progress. Retry timer is not stopped and PADT frame is sent whatever the current state is. PADT frame can only be sent if we received a PADS frame, otherwise sc_session is 0 and sending a PADT frame is meaningless. Fix both issues to allow calling the disconnect callback whatever the PPPoE state is.
This commit is contained in:
parent
d15ebc6a4c
commit
7c02a85424
@ -952,7 +952,12 @@ pppoe_disconnect(ppp_pcb *ppp, void *ctx)
|
|||||||
struct pppoe_softc *sc = (struct pppoe_softc *)ctx;
|
struct pppoe_softc *sc = (struct pppoe_softc *)ctx;
|
||||||
|
|
||||||
PPPDEBUG(LOG_DEBUG, ("pppoe: %c%c%"U16_F": disconnecting\n", sc->sc_ethif->name[0], sc->sc_ethif->name[1], sc->sc_ethif->num));
|
PPPDEBUG(LOG_DEBUG, ("pppoe: %c%c%"U16_F": disconnecting\n", sc->sc_ethif->name[0], sc->sc_ethif->name[1], sc->sc_ethif->num));
|
||||||
|
if (sc->sc_state == PPPOE_STATE_SESSION) {
|
||||||
pppoe_send_padt(sc->sc_ethif, sc->sc_session, (const u8_t *)&sc->sc_dest);
|
pppoe_send_padt(sc->sc_ethif, sc->sc_session, (const u8_t *)&sc->sc_dest);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* stop any timer, disconnect can be called while initiating is in progress */
|
||||||
|
sys_untimeout(pppoe_timeout, sc);
|
||||||
|
|
||||||
/* cleanup softc */
|
/* cleanup softc */
|
||||||
sc->sc_state = PPPOE_STATE_INITIAL;
|
sc->sc_state = PPPOE_STATE_INITIAL;
|
||||||
|
Loading…
Reference in New Issue
Block a user