mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2025-08-04 21:44:38 +08:00
PPP, PPPoS, removed linked list
We don't need anymore the PPPoS linked list since we have callbacks for everything.
This commit is contained in:
parent
29f3f2e1d8
commit
1918914598
@ -50,37 +50,6 @@
|
|||||||
#include "netif/ppp/magic.h"
|
#include "netif/ppp/magic.h"
|
||||||
#include "netif/ppp/vj.h"
|
#include "netif/ppp/vj.h"
|
||||||
|
|
||||||
/*
|
|
||||||
* Linked list of created PPPoS interfaces
|
|
||||||
*
|
|
||||||
* We only need to keep track of existing PPPoS interfaces if PPPoS
|
|
||||||
* is not the only enabled protocol.
|
|
||||||
*
|
|
||||||
* PPP CORE does not have callbacks pointers for all PPPoS callbacks
|
|
||||||
* which should actually be required for PPPoS (VJ config, asyncmap, ...),
|
|
||||||
* there is too much callbacks to create and PPPoS must be kept light,
|
|
||||||
* especially for users who are only using PPPoS.
|
|
||||||
*
|
|
||||||
* But there is a drawback, PPP CORE does not know which
|
|
||||||
* lower protocols it is talking to thanks to the abstraction,
|
|
||||||
* therefore if PPPoS is enabled as well as PPPoE or PPPoL2TP there
|
|
||||||
* might be situation where PPP CORE calls pppos_ config functions
|
|
||||||
* on interfaces which are NOT PPPoS one. This is very unlikely to
|
|
||||||
* happen because protocols not supported by PPPoE or PPPoL2TP are
|
|
||||||
* disabled at LCP/IPCP negotiation but we are better safe than sorry.
|
|
||||||
*
|
|
||||||
* So we check if passed PPP pointer to PPPoS configuration functions
|
|
||||||
* is a PPPoS interface by checking against a linked list of existing
|
|
||||||
* PPPoS interfaces.
|
|
||||||
*/
|
|
||||||
#define PPPOS_PCB_LIST (PPP_LINK_ENABLED_NUMBER > 1)
|
|
||||||
#if PPPOS_PCB_LIST
|
|
||||||
static pppos_pcb *pppos_pcb_list;
|
|
||||||
static u8_t pppos_exist(pppos_pcb *pppos);
|
|
||||||
#else /* PPPOS_PCB_LIST */
|
|
||||||
#define pppos_exist(pppos) 1
|
|
||||||
#endif /* PPPOS_PCB_LIST */
|
|
||||||
|
|
||||||
/* callbacks called from PPP core */
|
/* callbacks called from PPP core */
|
||||||
static err_t pppos_write(ppp_pcb *ppp, void *ctx, struct pbuf *p);
|
static err_t pppos_write(ppp_pcb *ppp, void *ctx, struct pbuf *p);
|
||||||
static err_t pppos_netif_output(ppp_pcb *ppp, void *ctx, struct pbuf *pb, u_short protocol);
|
static err_t pppos_netif_output(ppp_pcb *ppp, void *ctx, struct pbuf *pb, u_short protocol);
|
||||||
@ -220,12 +189,6 @@ ppp_pcb *pppos_create(struct netif *pppif, sio_fd_t fd,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if PPPOS_PCB_LIST
|
|
||||||
/* put the new interface at the head of the list */
|
|
||||||
pppos->next = pppos_pcb_list;
|
|
||||||
pppos_pcb_list = pppos;
|
|
||||||
#endif /* PPPOS_PCB_LIST */
|
|
||||||
|
|
||||||
pppos->ppp = ppp;
|
pppos->ppp = ppp;
|
||||||
pppos->fd = fd;
|
pppos->fd = fd;
|
||||||
ppp_link_set_callbacks(ppp, &pppos_callbacks, pppos);
|
ppp_link_set_callbacks(ppp, &pppos_callbacks, pppos);
|
||||||
@ -415,20 +378,6 @@ pppos_netif_output(ppp_pcb *ppp, void *ctx, struct pbuf *pb, u_short protocol)
|
|||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if PPPOS_PCB_LIST
|
|
||||||
static u8_t
|
|
||||||
pppos_exist(pppos_pcb *pppos)
|
|
||||||
{
|
|
||||||
pppos_pcb *test;
|
|
||||||
for (test = pppos_pcb_list; test != NULL; test = test->next) {
|
|
||||||
if (test == pppos) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif /* PPPOS_PCB_LIST */
|
|
||||||
|
|
||||||
static err_t
|
static err_t
|
||||||
pppos_connect(ppp_pcb *ppp, void *ctx)
|
pppos_connect(ppp_pcb *ppp, void *ctx)
|
||||||
{
|
{
|
||||||
@ -488,21 +437,8 @@ static err_t
|
|||||||
pppos_destroy(ppp_pcb *ppp, void *ctx)
|
pppos_destroy(ppp_pcb *ppp, void *ctx)
|
||||||
{
|
{
|
||||||
pppos_pcb *pppos = (pppos_pcb *)ctx;
|
pppos_pcb *pppos = (pppos_pcb *)ctx;
|
||||||
#if PPPOS_PCB_LIST
|
|
||||||
pppos_pcb **copp, *freep;
|
|
||||||
#endif /* PPPOS_PCB_LIST */
|
|
||||||
LWIP_UNUSED_ARG(ppp);
|
LWIP_UNUSED_ARG(ppp);
|
||||||
|
|
||||||
#if PPPOS_PCB_LIST
|
|
||||||
/* remove interface from list */
|
|
||||||
for (copp = &pppos_pcb_list; (freep = *copp); copp = &freep->next) {
|
|
||||||
if (freep == pppos) {
|
|
||||||
*copp = freep->next;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif /* PPPOS_PCB_LIST */
|
|
||||||
|
|
||||||
/* input pbuf left ? */
|
/* input pbuf left ? */
|
||||||
pppos_free_current_input_packet(pppos);
|
pppos_free_current_input_packet(pppos);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user