diff --git a/src/include/netif/ppp/pppoe.h b/src/include/netif/ppp/pppoe.h index 37a72828..2fbe3115 100644 --- a/src/include/netif/ppp/pppoe.h +++ b/src/include/netif/ppp/pppoe.h @@ -168,7 +168,7 @@ struct pppoe_softc { #define pppoe_init() /* compatibility define, no initialization needed */ err_t pppoe_create(struct netif *ethif, ppp_pcb *pcb, void (*link_status_cb)(ppp_pcb *pcb, int up), struct pppoe_softc **scptr); -err_t pppoe_destroy(struct netif *ifp); +err_t pppoe_destroy(struct pppoe_softc *sc); int pppoe_connect(struct pppoe_softc *sc); void pppoe_disconnect(struct pppoe_softc *sc); diff --git a/src/netif/ppp/ppp.c b/src/netif/ppp/ppp.c index 7e4f6324..12a57ebd 100644 --- a/src/netif/ppp/ppp.c +++ b/src/netif/ppp/ppp.c @@ -540,7 +540,7 @@ int ppp_free(ppp_pcb *pcb) { #if PPPOE_SUPPORT if (pcb->pppoe_sc) { - pppoe_destroy(&pcb->netif); + pppoe_destroy(pcb->pppoe_sc); pcb->pppoe_sc = NULL; } #endif /* PPPOE_SUPPORT */ diff --git a/src/netif/ppp/pppoe.c b/src/netif/ppp/pppoe.c index bf69c680..a5f4bd30 100644 --- a/src/netif/ppp/pppoe.c +++ b/src/netif/ppp/pppoe.c @@ -165,17 +165,18 @@ pppoe_create(struct netif *ethif, ppp_pcb *pcb, void (*link_status_cb)(ppp_pcb * } err_t -pppoe_destroy(struct netif *ifp) +pppoe_destroy(struct pppoe_softc *sc) { - struct pppoe_softc *sc, *prev = NULL; + struct pppoe_softc *cur, *prev = NULL; - for (sc = pppoe_softc_list; sc != NULL; prev = sc, sc = sc->next) { - if (sc->sc_ethif == ifp) { + /* find previous linked list entry */ + for (cur = pppoe_softc_list; cur != NULL; prev = cur, cur = cur->next) { + if (sc == cur) { break; } } - if(!(sc && (sc->sc_ethif == ifp))) { + if (cur != sc) { return ERR_IF; }