mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-03-13 07:14:31 +00:00
PPP, PPPoE, improved removal from linked list
Replaced naive link list removal code to a more clever one.
This commit is contained in:
parent
4ad60b477c
commit
18074ff98f
@ -300,26 +300,16 @@ static err_t pppoe_link_netif_output_callback(void *pcb, struct pbuf *p, u_short
|
|||||||
static err_t
|
static err_t
|
||||||
pppoe_destroy(struct pppoe_softc *sc)
|
pppoe_destroy(struct pppoe_softc *sc)
|
||||||
{
|
{
|
||||||
struct pppoe_softc *cur, *prev = NULL;
|
struct pppoe_softc **copp, *freep;
|
||||||
|
|
||||||
/* find previous linked list entry */
|
|
||||||
for (cur = pppoe_softc_list; cur != NULL; prev = cur, cur = cur->next) {
|
|
||||||
if (sc == cur) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cur != sc) {
|
|
||||||
return ERR_IF;
|
|
||||||
}
|
|
||||||
|
|
||||||
sys_untimeout(pppoe_timeout, sc);
|
sys_untimeout(pppoe_timeout, sc);
|
||||||
if (prev == NULL) {
|
|
||||||
/* remove sc from the head of the list */
|
/* remove interface from list */
|
||||||
pppoe_softc_list = sc->next;
|
for (copp = &pppoe_softc_list; (freep = *copp); copp = &freep->next) {
|
||||||
} else {
|
if (freep == sc) {
|
||||||
/* remove sc from the list */
|
*copp = freep->next;
|
||||||
prev->next = sc->next;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PPPOE_TODO
|
#ifdef PPPOE_TODO
|
||||||
|
Loading…
x
Reference in New Issue
Block a user