mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2026-05-18 22:26:41 +08:00
PPP: moved netif out of PPP control block
Users might want to share a netif control block between an Ethernet interface and a PPPoS interface (I want actually) in case PPP is just used as redundancy if Ethernet is down (eg. PPPoS GPRS fail over). Moved netif out of PPP control block in a similar way it is currently done for Ethernet interfaces. Furthermore, this is a first step on removing the "new/create/free/delete" API which is awful but currently necessary to handle fail over from PPPoX to another PPPoX (eg. from PPoE on xDSL to PPPoS on GPRS fail over) without free()ing the netif which might be used on udp_sendto() or L2TP VPN links.
This commit is contained in:
@@ -46,6 +46,9 @@ struct pppapi_msg_msg {
|
||||
int err;
|
||||
ppp_pcb *ppp;
|
||||
union {
|
||||
struct {
|
||||
struct netif *pppif;
|
||||
} pppnew;
|
||||
struct {
|
||||
u8_t authtype;
|
||||
const char *user;
|
||||
@@ -111,7 +114,7 @@ struct pppapi_msg {
|
||||
};
|
||||
|
||||
/* API for application */
|
||||
ppp_pcb *pppapi_new(void);
|
||||
ppp_pcb *pppapi_new(struct netif *pppif);
|
||||
void pppapi_set_default(ppp_pcb *pcb);
|
||||
void pppapi_set_auth(ppp_pcb *pcb, u8_t authtype, const char *user, const char *passwd);
|
||||
#if PPP_NOTIFY_PHASE
|
||||
|
||||
@@ -366,7 +366,7 @@ struct ppp_pcb_s {
|
||||
void (*notify_phase_cb)(ppp_pcb *pcb, u8_t phase, void *ctx); /* Notify phase callback */
|
||||
#endif /* PPP_NOTIFY_PHASE */
|
||||
void *ctx_cb; /* Callbacks optional pointer */
|
||||
struct netif netif; /* PPP interface */
|
||||
struct netif *netif; /* PPP interface */
|
||||
|
||||
/* -- below are data that will be cleared between two sessions */
|
||||
|
||||
@@ -478,7 +478,7 @@ struct ppp_pcb_s {
|
||||
* Return a new PPP connection control block pointer
|
||||
* on success or a null pointer on failure.
|
||||
*/
|
||||
ppp_pcb *ppp_new(void);
|
||||
ppp_pcb *ppp_new(struct netif *pppif);
|
||||
|
||||
/*
|
||||
* Set a PPP interface as the default network interface
|
||||
@@ -625,7 +625,7 @@ void pppos_input(ppp_pcb *pcb, u_char* data, int len);
|
||||
#endif /* PPPOS_SUPPORT */
|
||||
|
||||
/* Get the PPP netif interface */
|
||||
#define ppp_netif(ppp) (&(ppp)->netif)
|
||||
#define ppp_netif(ppp) (ppp->netif)
|
||||
|
||||
/* Get the PPP addresses */
|
||||
#define ppp_addrs(ppp) (&(ppp)->addrs)
|
||||
|
||||
Reference in New Issue
Block a user