diff --git a/ports/unix/include/arch/cc.h b/ports/unix/include/arch/cc.h index 5de2ec8..b50fcc7 100644 --- a/ports/unix/include/arch/cc.h +++ b/ports/unix/include/arch/cc.h @@ -34,6 +34,7 @@ /* Include some files for defining library routines */ #include +#include /* Define platform endianness */ #ifndef BYTE_ORDER diff --git a/ports/unix/netif/tcpdump.c b/ports/unix/netif/tcpdump.c index a79591d..2b27f4e 100644 --- a/ports/unix/netif/tcpdump.c +++ b/ports/unix/netif/tcpdump.c @@ -37,6 +37,7 @@ #include "lwip/tcp.h" #include "lwip/udp.h" #include "lwip/inet.h" +#include "lwip/inet_chksum.h" static FILE *file = NULL; diff --git a/ports/unix/proj/unixsim/apps/shell.c b/ports/unix/proj/unixsim/apps/shell.c index d38c9ee..04c34a7 100644 --- a/ports/unix/proj/unixsim/apps/shell.c +++ b/ports/unix/proj/unixsim/apps/shell.c @@ -38,6 +38,7 @@ #include "lwip/def.h" #include "lwip/api.h" #include "lwip/stats.h" +#include "lwip/inet.h" static unsigned char buffer[1024]; @@ -307,6 +308,7 @@ static char *stat_formats[STAT_NUM] = { U16_F, /* tcp err */ U16_F, /* tcp cachehit */ + /* FIXME: pbuf stats have moved to memp stats */ U16_F, /* pbuf avail */ U16_F, /* pbuf used */ U16_F, /* pbuf max */ @@ -314,6 +316,7 @@ static char *stat_formats[STAT_NUM] = { U16_F, /* pbuf alloc_locked */ U16_F, /* pbuf refresh_locked */ + /* FIXME: always using 11 memp pools is wrong! */ MEM_SIZE_F, /* mem avail */ MEM_SIZE_F, /* mem used */ MEM_SIZE_F, /* mem max */ @@ -468,18 +471,21 @@ static void *stat_ptrs[STAT_NUM] = { &lwip_stats.tcp.err, &lwip_stats.tcp.cachehit, - &lwip_stats.pbuf.avail, + /* FIXME: pbuf stats have moved to memp stats */ + NULL, NULL, NULL, NULL, NULL, NULL, + /*&lwip_stats.pbuf.avail, &lwip_stats.pbuf.used, &lwip_stats.pbuf.max, &lwip_stats.pbuf.err, &lwip_stats.pbuf.alloc_locked, - &lwip_stats.pbuf.refresh_locked, + &lwip_stats.pbuf.refresh_locked,*/ &lwip_stats.mem.avail, &lwip_stats.mem.used, &lwip_stats.mem.max, &lwip_stats.mem.err, - + + /* FIXME: always using 11 memp pools is wrong! */ &lwip_stats.memp[0].avail, &lwip_stats.memp[0].used, &lwip_stats.memp[0].max, diff --git a/ports/unix/proj/unixsim/lwipopts.h b/ports/unix/proj/unixsim/lwipopts.h index cdb1092..13871cd 100644 --- a/ports/unix/proj/unixsim/lwipopts.h +++ b/ports/unix/proj/unixsim/lwipopts.h @@ -68,11 +68,18 @@ extern unsigned char debug_flags; #define LWIP_DBG_TYPES_ON debug_flags +#define NO_SYS 0 +#define LWIP_SOCKET (NO_SYS==0) +#define LWIP_NETCONN (NO_SYS==0) + + /* ---------- Memory options ---------- */ /* MEM_ALIGNMENT: should be set to the alignment of the CPU for which lwIP is compiled. 4 byte alignment -> define MEM_ALIGNMENT to 4, 2 byte alignment -> define MEM_ALIGNMENT to 2. */ -#define MEM_ALIGNMENT 1 +/* MSVC port: intel processors don't need 4-byte alignment, + but are faster that way! */ +#define MEM_ALIGNMENT 4 /* MEM_SIZE: the size of the heap memory. If the application will send a lot of data that needs to be copied, this should be set high. */ @@ -107,7 +114,7 @@ a lot of data that needs to be copied, this should be set high. */ #define MEMP_NUM_NETBUF 2 /* MEMP_NUM_NETCONN: the number of struct netconns. */ #define MEMP_NUM_NETCONN 10 -/* MEMP_NUM_TCPIP_MSG: the number of struct tcpip_msg, which is used +/* MEMP_NUM_TCPIP_MSG_*: the number of struct tcpip_msg, which is used for sequential API communication and incoming packets. Used in src/api/tcpip.c. */ #define MEMP_NUM_TCPIP_MSG_API 16 @@ -129,7 +136,7 @@ a lot of data that needs to be copied, this should be set high. */ * for certain critical regions during buffer allocation, deallocation and memory * allocation and deallocation. */ -/*#define SYS_LIGHTWEIGHT_PROT 1*/ +#define SYS_LIGHTWEIGHT_PROT 1 /* ---------- TCP options ---------- */ #define LWIP_TCP 1 @@ -147,7 +154,7 @@ a lot of data that needs to be copied, this should be set high. */ /* TCP sender buffer space (pbufs). This must be at least = 2 * TCP_SND_BUF/TCP_MSS for things to work. */ -#define TCP_SND_QUEUELEN 4 * TCP_SND_BUF/TCP_MSS +#define TCP_SND_QUEUELEN (4 * TCP_SND_BUF/TCP_MSS) /* TCP writable space (bytes). This must be less than or equal to TCP_SND_BUF. It is the amount of space which must be @@ -164,8 +171,9 @@ a lot of data that needs to be copied, this should be set high. */ #define TCP_SYNMAXRTX 4 /* ---------- ARP options ---------- */ -#define ARP_TABLE_SIZE 10 -#define ARP_QUEUEING 1 +#define LWIP_ARP 1 +#define ARP_TABLE_SIZE 10 +#define ARP_QUEUEING 1 /* ---------- IP options ---------- */ /* Define IP_FORWARD to 1 if you wish to have the ability to forward @@ -177,6 +185,8 @@ a lot of data that needs to be copied, this should be set high. */ /* IP reassembly and segmentation.These are orthogonal even * if they both deal with IP fragments */ #define IP_REASSEMBLY 1 +#define IP_REASS_MAX_PBUFS 10 +#define MEMP_NUM_REASSDATA 10 #define IP_FRAG 1 /* ---------- ICMP options ---------- */ @@ -191,6 +201,9 @@ a lot of data that needs to be copied, this should be set high. */ (recommended). */ #define DHCP_DOES_ARP_CHECK 1 +/* ---------- AUTOIP options ------- */ +#define LWIP_AUTOIP 0 + /* ---------- SNMP options ---------- */ /** @todo SNMP is experimental for now @note UDP must be available for SNMP transport */ diff --git a/ports/unix/proj/unixsim/simhost.c b/ports/unix/proj/unixsim/simhost.c index c5e969a..e49214e 100644 --- a/ports/unix/proj/unixsim/simhost.c +++ b/ports/unix/proj/unixsim/simhost.c @@ -42,6 +42,8 @@ #include "lwip/stats.h" +#include "lwip/tcp.h" +#include "lwip/inet_chksum.h" #include "lwip/tcpip.h" #include "lwip/sockets.h" @@ -274,7 +276,8 @@ static void ping_recv(int s, struct ip_addr *addr) { char buf[200]; - int fromlen,len; + socklen_t fromlen; + int len; struct sockaddr_in from; len = lwip_recvfrom(s, buf,sizeof(buf),0,(struct sockaddr*)&from,&fromlen);