From 22f13c24aaf7e11ba3aca7416a1cfe950dea205f Mon Sep 17 00:00:00 2001 From: Sylvain Rochet Date: Wed, 21 Oct 2020 02:11:59 +0200 Subject: [PATCH] PPP: assert if ppp_set_* functions are called when session is not dead ppp_set_* functions that set the PPP session parameters must only be called when the session is in a dead state (i.e. disconnected), otherwise not fatal but surprising results may happen. --- src/netif/ppp/ppp.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/netif/ppp/ppp.c b/src/netif/ppp/ppp.c index 27078f30..6b2b2bd1 100644 --- a/src/netif/ppp/ppp.c +++ b/src/netif/ppp/ppp.c @@ -216,6 +216,8 @@ static err_t ppp_netif_output(struct netif *netif, struct pbuf *pb, u16_t protoc /***********************************/ #if PPP_AUTH_SUPPORT void ppp_set_auth(ppp_pcb *pcb, u8_t authtype, const char *user, const char *passwd) { + LWIP_ASSERT("pcb->phase == PPP_PHASE_DEAD", pcb->phase == PPP_PHASE_DEAD); + #if PAP_SUPPORT pcb->settings.refuse_pap = !(authtype & PPPAUTHTYPE_PAP); #endif /* PAP_SUPPORT */ @@ -237,6 +239,8 @@ void ppp_set_auth(ppp_pcb *pcb, u8_t authtype, const char *user, const char *pas #if MPPE_SUPPORT /* Set MPPE configuration */ void ppp_set_mppe(ppp_pcb *pcb, u8_t flags) { + LWIP_ASSERT("pcb->phase == PPP_PHASE_DEAD", pcb->phase == PPP_PHASE_DEAD); + if (flags == PPP_MPPE_DISABLE) { pcb->settings.require_mppe = 0; return;