mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-10-01 04:12:07 +00:00
tcpip.c: Initialize tcpip's mbox, and verify if initialized in tcpip_input, tcpip_ethinput, tcpip_callback, tcpip_apimsg, to fix a init problem with network interfaces. Also fix a compiler warning.
This commit is contained in:
parent
b290f0442d
commit
713e89cdb2
@ -67,6 +67,11 @@ HISTORY
|
||||
|
||||
++ Bug fixes:
|
||||
|
||||
2007-03-20 Frédéric Bernon
|
||||
* tcpip.c: Initialize tcpip's mbox, and verify if initialized in tcpip_input,
|
||||
tcpip_ethinput, tcpip_callback, tcpip_apimsg, to fix a init problem with
|
||||
network interfaces. Also fix a compiler warning.
|
||||
|
||||
2007-03-20 Kieran Mansley
|
||||
* udp.c: Only try and use pbuf_header() to make space for headers if
|
||||
not a ROM or REF pbuf.
|
||||
|
@ -48,8 +48,8 @@
|
||||
#include "lwip/igmp.h"
|
||||
|
||||
static void (* tcpip_init_done)(void *arg) = NULL;
|
||||
static void *tcpip_init_done_arg;
|
||||
static sys_mbox_t mbox;
|
||||
static void *tcpip_init_done_arg = NULL;
|
||||
static sys_mbox_t mbox = SYS_MBOX_NULL;
|
||||
|
||||
#if LWIP_TCP
|
||||
static int tcpip_tcp_timer_active = 0;
|
||||
@ -138,7 +138,7 @@ ethernet_input(struct pbuf *p, struct netif *netif)
|
||||
etharp_ip_input( netif, p);
|
||||
#endif
|
||||
/* skip Ethernet header */
|
||||
pbuf_header(p, -sizeof(struct eth_hdr));
|
||||
pbuf_header(p, (s16_t)(-sizeof(struct eth_hdr)));
|
||||
/* pass to IP layer */
|
||||
ip_input(p, netif);
|
||||
break;
|
||||
@ -216,6 +216,7 @@ tcpip_input(struct pbuf *p, struct netif *inp)
|
||||
{
|
||||
struct tcpip_msg *msg;
|
||||
|
||||
if (mbox != SYS_MBOX_NULL) {
|
||||
msg = memp_malloc(MEMP_TCPIP_MSG);
|
||||
if (msg == NULL) {
|
||||
pbuf_free(p);
|
||||
@ -227,6 +228,8 @@ tcpip_input(struct pbuf *p, struct netif *inp)
|
||||
msg->msg.inp.netif = inp;
|
||||
sys_mbox_post(mbox, msg);
|
||||
return ERR_OK;
|
||||
}
|
||||
return ERR_VAL;
|
||||
}
|
||||
#endif /* ETHARP_TCPIP_INPUT */
|
||||
|
||||
@ -236,6 +239,7 @@ tcpip_ethinput(struct pbuf *p, struct netif *inp)
|
||||
{
|
||||
struct tcpip_msg *msg;
|
||||
|
||||
if (mbox != SYS_MBOX_NULL) {
|
||||
msg = memp_malloc(MEMP_TCPIP_MSG);
|
||||
if (msg == NULL) {
|
||||
pbuf_free(p);
|
||||
@ -247,6 +251,8 @@ tcpip_ethinput(struct pbuf *p, struct netif *inp)
|
||||
msg->msg.inp.netif = inp;
|
||||
sys_mbox_post(mbox, msg);
|
||||
return ERR_OK;
|
||||
}
|
||||
return ERR_VAL;
|
||||
}
|
||||
#endif /* ETHARP_TCPIP_ETHINPUT */
|
||||
|
||||
@ -255,6 +261,7 @@ tcpip_callback(void (*f)(void *ctx), void *ctx)
|
||||
{
|
||||
struct tcpip_msg *msg;
|
||||
|
||||
if (mbox != SYS_MBOX_NULL) {
|
||||
msg = memp_malloc(MEMP_TCPIP_MSG);
|
||||
if (msg == NULL) {
|
||||
return ERR_MEM;
|
||||
@ -265,12 +272,16 @@ tcpip_callback(void (*f)(void *ctx), void *ctx)
|
||||
msg->msg.cb.ctx = ctx;
|
||||
sys_mbox_post(mbox, msg);
|
||||
return ERR_OK;
|
||||
}
|
||||
return ERR_VAL;
|
||||
}
|
||||
|
||||
err_t
|
||||
tcpip_apimsg(struct api_msg *apimsg)
|
||||
{
|
||||
struct tcpip_msg *msg;
|
||||
|
||||
if (mbox != SYS_MBOX_NULL) {
|
||||
msg = memp_malloc(MEMP_TCPIP_MSG);
|
||||
if (msg == NULL) {
|
||||
return ERR_MEM;
|
||||
@ -279,6 +290,8 @@ tcpip_apimsg(struct api_msg *apimsg)
|
||||
msg->msg.apimsg = apimsg;
|
||||
sys_mbox_post(mbox, msg);
|
||||
return ERR_OK;
|
||||
}
|
||||
return ERR_VAL;
|
||||
}
|
||||
|
||||
void
|
||||
@ -298,6 +311,3 @@ tcpip_init(void (* initfunc)(void *), void *arg)
|
||||
sys_thread_new(tcpip_thread, NULL, TCPIP_THREAD_PRIO);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user