fix bug #2595: "loopif results

in NULL reference for incoming TCP packets". Loopif has to be configured
(using LWIP_LOOPIF_MULTITHREADING) to directly call netif->input()
(multithreading environments, e.g. netif->input() = tcpip_input()) or
putting packets on a list that is fed to the stack by calling loopif_poll()
(single-thread / NO_SYS / polling environment where e.g.
netif->input() = ip_input).
This commit is contained in:
goldsimon
2007-04-23 20:00:29 +00:00
parent 82e579a29d
commit 02e194b15f
5 changed files with 119 additions and 51 deletions

View File

@@ -408,6 +408,17 @@ a lot of data that needs to be copied, this should be set high. */
#define LWIP_HAVE_LOOPIF 0
#endif
/* This switches between directly calling netif->input() (=1 for multithreading
* environments like tcpip.c) or putting the packets on a list and calling
* loopif_poll() in the main application loop (=0 for polling / NO_SYS
* environments).
* Setting this is needed to avoid reentering non-reentrant functions like
* tcp_input().
*/
#ifndef LWIP_LOOPIF_MULTITHREADING
#define LWIP_LOOPIF_MULTITHREADING 1
#endif
#ifndef LWIP_EVENT_API
#define LWIP_EVENT_API 0
#define LWIP_CALLBACK_API 1

View File

@@ -34,6 +34,10 @@
#include "lwip/netif.h"
#if !LWIP_LOOPIF_MULTITHREADING
void loopif_poll(struct netif *netif);
#endif
err_t loopif_init(struct netif *netif);
#endif /* __NETIF_LOOPIF_H__ */