mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-09-13 10:15:43 +00:00
PPP, PPPoS, TCPIP: add packet input path for point to point interfaces (only PPPoS for now) through the TCPIP API
!NO_SYS users may now use as well the TCPIP API for PPPoS input data, this way they can disable PPP_INPROC_MULTITHREADED and run pppos_input() inside the lwIP thread, which fixes, at least for them, all the threading issues related to PPP_INPROC_MULTITHREADED.
This commit is contained in:
parent
636ff411f1
commit
9778b1411c
@ -114,6 +114,13 @@ tcpip_thread(void *arg)
|
|||||||
ethernet_input(msg->msg.inp.p, msg->msg.inp.netif);
|
ethernet_input(msg->msg.inp.p, msg->msg.inp.netif);
|
||||||
} else
|
} else
|
||||||
#endif /* LWIP_ETHERNET */
|
#endif /* LWIP_ETHERNET */
|
||||||
|
#if PPPOS_SUPPORT
|
||||||
|
/* FIXME: can be generalized to all point to point interfaces */
|
||||||
|
if ((msg->msg.inp.netif->flags & NETIF_FLAG_BROADCAST) == 0
|
||||||
|
&& msg->msg.inp.netif->input) {
|
||||||
|
msg->msg.inp.netif->input(msg->msg.inp.p, msg->msg.inp.netif);
|
||||||
|
} else
|
||||||
|
#endif /* PPPOS_SUPPORT */
|
||||||
#if LWIP_IPV6
|
#if LWIP_IPV6
|
||||||
if (((*(u8_t*)(msg->msg.inp.p->payload)) & 0xf0) == 0x60) {
|
if (((*(u8_t*)(msg->msg.inp.p->payload)) & 0xf0) == 0x60) {
|
||||||
ip6_input(msg->msg.inp.p, msg->msg.inp.netif);
|
ip6_input(msg->msg.inp.p, msg->msg.inp.netif);
|
||||||
|
@ -68,6 +68,9 @@ static err_t pppos_netif_input(ppp_pcb *ppp, void *ctx, struct pbuf *p, u16_t pr
|
|||||||
#endif /* VJ_SUPPORT */
|
#endif /* VJ_SUPPORT */
|
||||||
|
|
||||||
/* Prototypes for procedures local to this file. */
|
/* Prototypes for procedures local to this file. */
|
||||||
|
#if !NO_SYS
|
||||||
|
static err_t pppos_input_sys(struct pbuf *p, struct netif *inp);
|
||||||
|
#endif /* !NO_SYS */
|
||||||
#if PPP_INPROC_MULTITHREADED
|
#if PPP_INPROC_MULTITHREADED
|
||||||
static void pppos_input_callback(void *arg);
|
static void pppos_input_callback(void *arg);
|
||||||
#endif /* PPP_INPROC_MULTITHREADED */
|
#endif /* PPP_INPROC_MULTITHREADED */
|
||||||
@ -200,6 +203,9 @@ ppp_pcb *pppos_create(struct netif *pppif, sio_fd_t fd,
|
|||||||
|
|
||||||
pppos->ppp = ppp;
|
pppos->ppp = ppp;
|
||||||
pppos->fd = fd;
|
pppos->fd = fd;
|
||||||
|
#if !NO_SYS
|
||||||
|
ppp->netif->input = pppos_input_sys;
|
||||||
|
#endif /* !NO_SYS */
|
||||||
ppp_link_set_callbacks(ppp, &pppos_callbacks, pppos);
|
ppp_link_set_callbacks(ppp, &pppos_callbacks, pppos);
|
||||||
return ppp;
|
return ppp;
|
||||||
}
|
}
|
||||||
@ -521,6 +527,19 @@ pppos_destroy(ppp_pcb *ppp, void *ctx)
|
|||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !NO_SYS
|
||||||
|
static err_t pppos_input_sys(struct pbuf *p, struct netif *inp) {
|
||||||
|
ppp_pcb *ppp = (ppp_pcb*)inp->state;
|
||||||
|
struct pbuf *n;
|
||||||
|
|
||||||
|
for (n = p; n; n = n->next) {
|
||||||
|
pppos_input(ppp, (u8_t*)n->payload, n->len);
|
||||||
|
}
|
||||||
|
pbuf_free(p);
|
||||||
|
return ERR_OK;
|
||||||
|
}
|
||||||
|
#endif /* !NO_SYS */
|
||||||
|
|
||||||
/** PPPoS input helper struct, must be packed since it is stored
|
/** PPPoS input helper struct, must be packed since it is stored
|
||||||
* to pbuf->payload, which might be unaligned. */
|
* to pbuf->payload, which might be unaligned. */
|
||||||
#if PPP_INPROC_MULTITHREADED
|
#if PPP_INPROC_MULTITHREADED
|
||||||
|
Loading…
Reference in New Issue
Block a user