Add LWIP_ASSERT_CORE_LOCKED() to ppp (see task #14780)

Signed-off-by: goldsimon <goldsimon@gmx.de>
This commit is contained in:
goldsimon 2018-02-03 22:13:32 +01:00
parent ea2e628ac3
commit 9d087ad2d2
3 changed files with 15 additions and 0 deletions

View File

@ -216,6 +216,7 @@ static err_t ppp_netif_output(struct netif *netif, struct pbuf *pb, u16_t protoc
/***********************************/ /***********************************/
#if PPP_AUTH_SUPPORT #if PPP_AUTH_SUPPORT
void ppp_set_auth(ppp_pcb *pcb, u8_t authtype, const char *user, const char *passwd) { void ppp_set_auth(ppp_pcb *pcb, u8_t authtype, const char *user, const char *passwd) {
LWIP_ASSERT_CORE_LOCKED();
#if PAP_SUPPORT #if PAP_SUPPORT
pcb->settings.refuse_pap = !(authtype & PPPAUTHTYPE_PAP); pcb->settings.refuse_pap = !(authtype & PPPAUTHTYPE_PAP);
#endif /* PAP_SUPPORT */ #endif /* PAP_SUPPORT */
@ -268,6 +269,7 @@ void ppp_set_notify_phase_callback(ppp_pcb *pcb, ppp_notify_phase_cb_fn notify_p
* established before calling this. * established before calling this.
*/ */
err_t ppp_connect(ppp_pcb *pcb, u16_t holdoff) { err_t ppp_connect(ppp_pcb *pcb, u16_t holdoff) {
LWIP_ASSERT_CORE_LOCKED();
if (pcb->phase != PPP_PHASE_DEAD) { if (pcb->phase != PPP_PHASE_DEAD) {
return ERR_ALREADY; return ERR_ALREADY;
} }
@ -294,6 +296,7 @@ err_t ppp_connect(ppp_pcb *pcb, u16_t holdoff) {
* established before calling this. * established before calling this.
*/ */
err_t ppp_listen(ppp_pcb *pcb) { err_t ppp_listen(ppp_pcb *pcb) {
LWIP_ASSERT_CORE_LOCKED();
if (pcb->phase != PPP_PHASE_DEAD) { if (pcb->phase != PPP_PHASE_DEAD) {
return ERR_ALREADY; return ERR_ALREADY;
} }
@ -323,6 +326,8 @@ err_t ppp_listen(ppp_pcb *pcb) {
err_t err_t
ppp_close(ppp_pcb *pcb, u8_t nocarrier) ppp_close(ppp_pcb *pcb, u8_t nocarrier)
{ {
LWIP_ASSERT_CORE_LOCKED();
pcb->err_code = PPPERR_USER; pcb->err_code = PPPERR_USER;
/* holdoff phase, cancel the reconnection */ /* holdoff phase, cancel the reconnection */
@ -383,6 +388,7 @@ ppp_close(ppp_pcb *pcb, u8_t nocarrier)
*/ */
err_t ppp_free(ppp_pcb *pcb) { err_t ppp_free(ppp_pcb *pcb) {
err_t err; err_t err;
LWIP_ASSERT_CORE_LOCKED();
if (pcb->phase != PPP_PHASE_DEAD) { if (pcb->phase != PPP_PHASE_DEAD) {
return ERR_CONN; return ERR_CONN;
} }
@ -402,6 +408,7 @@ err_t ppp_free(ppp_pcb *pcb) {
err_t err_t
ppp_ioctl(ppp_pcb *pcb, u8_t cmd, void *arg) ppp_ioctl(ppp_pcb *pcb, u8_t cmd, void *arg)
{ {
LWIP_ASSERT_CORE_LOCKED();
if (pcb == NULL) { if (pcb == NULL) {
return ERR_VAL; return ERR_VAL;
} }

View File

@ -177,6 +177,7 @@ ppp_pcb *pppoe_create(struct netif *pppif,
struct pppoe_softc *sc; struct pppoe_softc *sc;
LWIP_UNUSED_ARG(service_name); LWIP_UNUSED_ARG(service_name);
LWIP_UNUSED_ARG(concentrator_name); LWIP_UNUSED_ARG(concentrator_name);
LWIP_ASSERT_CORE_LOCKED();
sc = (struct pppoe_softc *)LWIP_MEMPOOL_ALLOC(PPPOE_IF); sc = (struct pppoe_softc *)LWIP_MEMPOOL_ALLOC(PPPOE_IF);
if (sc == NULL) { if (sc == NULL) {

View File

@ -176,6 +176,7 @@ ppp_pcb *pppos_create(struct netif *pppif, pppos_output_cb_fn output_cb,
{ {
pppos_pcb *pppos; pppos_pcb *pppos;
ppp_pcb *ppp; ppp_pcb *ppp;
LWIP_ASSERT_CORE_LOCKED();
pppos = (pppos_pcb *)LWIP_MEMPOOL_ALLOC(PPPOS_PCB); pppos = (pppos_pcb *)LWIP_MEMPOOL_ALLOC(PPPOS_PCB);
if (pppos == NULL) { if (pppos == NULL) {
@ -407,6 +408,8 @@ pppos_destroy(ppp_pcb *ppp, void *ctx)
#if !NO_SYS && !PPP_INPROC_IRQ_SAFE #if !NO_SYS && !PPP_INPROC_IRQ_SAFE
/** Pass received raw characters to PPPoS to be decoded through lwIP TCPIP thread. /** Pass received raw characters to PPPoS to be decoded through lwIP TCPIP thread.
*
* This is one of the only functions that may be called outside of the TCPIP thread!
* *
* @param ppp PPP descriptor index, returned by pppos_create() * @param ppp PPP descriptor index, returned by pppos_create()
* @param s received data * @param s received data
@ -435,6 +438,7 @@ pppos_input_tcpip(ppp_pcb *ppp, u8_t *s, int l)
err_t pppos_input_sys(struct pbuf *p, struct netif *inp) { err_t pppos_input_sys(struct pbuf *p, struct netif *inp) {
ppp_pcb *ppp = (ppp_pcb*)inp->state; ppp_pcb *ppp = (ppp_pcb*)inp->state;
struct pbuf *n; struct pbuf *n;
LWIP_ASSERT_CORE_LOCKED();
for (n = p; n; n = n->next) { for (n = p; n; n = n->next) {
pppos_input(ppp, (u8_t*)n->payload, n->len); pppos_input(ppp, (u8_t*)n->payload, n->len);
@ -474,6 +478,9 @@ pppos_input(ppp_pcb *ppp, u8_t *s, int l)
u8_t cur_char; u8_t cur_char;
u8_t escaped; u8_t escaped;
PPPOS_DECL_PROTECT(lev); PPPOS_DECL_PROTECT(lev);
#if PPP_INPROC_IRQ_SAFE
LWIP_ASSERT_CORE_LOCKED();
#endif
PPPDEBUG(LOG_DEBUG, ("pppos_input[%d]: got %d bytes\n", ppp->netif->num, l)); PPPDEBUG(LOG_DEBUG, ("pppos_input[%d]: got %d bytes\n", ppp->netif->num, l));
while (l-- > 0) { while (l-- > 0) {