[LWIP] Correctly synchronize to lwIP 1.4.1 (#6123)

* [TCPIP] Rename lwip library to lwipcore

* [TCPIP] Remove ReactOS-specific code from LWIP library

* [TCPIP] Synchronize LWIP code to 1.4.1

Update to LWIP 1.4.1 should have been done by bd3b0e8ef4
However, I was unable to find the exact revision used in this commit.

So, do the following
- take code from STABLE-1_4_1 commit on https://git.savannah.gnu.org/git/lwip.git
- cherry-pick LWIP 32aa9a41e2013e5ee6eee09317a848647e37badf (CORE-8978)
- cherry-pick LWIP c0b534e5318baf870e2152c70d4d11a3a86181f3
- add a ReactOS-specific change in src/api/tcpip.c (missing include)
- add ReactOS specific file CMakeLists.txt

NOTE: Changes are mostly in unit test files (not used) and CHANGELOG file.

CORE-7140
This commit is contained in:
hpoussin 2023-12-29 13:05:41 +01:00 committed by GitHub
parent d8108a64a4
commit 9cfd8dd918
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
126 changed files with 2251 additions and 1554 deletions

View file

@ -0,0 +1 @@
#pragma pack(push,1)

View file

@ -0,0 +1,61 @@
/* ReactOS-Specific lwIP binding header - by Cameron Gutman */
#include <wdm.h>
/* ROS-specific mem defs */
void *
malloc(size_t size);
void *
calloc(size_t count, size_t size);
void
free(void *mem);
void *
realloc(void *mem, size_t size);
/* mem_trim() must trim the buffer without relocating it.
* Since we can't do that, we just return the buffer passed in unchanged */
#define mem_trim(_m_, _s_) (_m_)
/* Unsigned int types */
typedef unsigned char u8_t;
typedef unsigned short u16_t;
typedef unsigned long u32_t;
/* Signed int types */
typedef signed char s8_t;
typedef signed short s16_t;
typedef signed long s32_t;
/* Memory pointer */
typedef ULONG_PTR mem_ptr_t;
/* Printf/DPRINT formatters */
#define U16_F "hu"
#define S16_F "hd"
#define X16_F "hx"
#define U32_F "lu"
#define S32_F "ld"
#define X32_F "lx"
/* Endianness */
#define BYTE_ORDER LITTLE_ENDIAN
/* Checksum calculation algorithm choice */
#define LWIP_CHKSUM_ALGORITHM 3
/* Diagnostics */
#define LWIP_PLATFORM_DIAG(x) (DbgPrint x)
#define LWIP_PLATFORM_ASSERT(x) ASSERTMSG(x, FALSE)
/* Synchronization */
#define SYS_ARCH_DECL_PROTECT(lev) sys_prot_t (lev)
#define SYS_ARCH_PROTECT(lev) sys_arch_protect(&(lev))
#define SYS_ARCH_UNPROTECT(lev) sys_arch_unprotect(lev)
/* Compiler hints for packing structures */
#define PACK_STRUCT_STRUCT
#define PACK_STRUCT_USE_INCLUDES

View file

@ -0,0 +1 @@
#pragma pack(pop)

View file

@ -0,0 +1,4 @@
/* ReactOS-Specific lwIP binding header - by Cameron Gutman */
#define PERF_START
#define PERF_STOP

View file

@ -0,0 +1,39 @@
/* ReactOS-Specific lwIP binding header - by Cameron Gutman */
/* Implmentation specific structs */
typedef struct _sys_sem_t
{
KEVENT Event;
int Valid;
} sys_sem_t;
typedef struct _sys_mbox_t
{
KSPIN_LOCK Lock;
LIST_ENTRY ListHead;
KEVENT Event;
int Valid;
} sys_mbox_t;
typedef KIRQL sys_prot_t;
typedef u32_t sys_thread_t;
typedef struct _LWIP_MESSAGE_CONTAINER
{
PVOID Message;
LIST_ENTRY ListEntry;
} LWIP_MESSAGE_CONTAINER, *PLWIP_MESSAGE_CONTAINER;
#define sys_jiffies() sys_now()
/* NULL definitions */
#define SYS_MBOX_NULL NULL
#define SYS_SEM_NULL NULL
#define SYS_ARCH_NULL NULL
void
sys_arch_protect(sys_prot_t *lev);
void
sys_arch_unprotect(sys_prot_t lev);

View file

@ -0,0 +1,206 @@
/*
------------------------------------
---------- Memory options ----------
------------------------------------
*/
/* This combo allows us to implement malloc, free, and realloc ourselves */
#define MEM_LIBC_MALLOC 1
#define MEMP_MEM_MALLOC 1
/* Define LWIP_COMPAT_MUTEX if the port has no mutexes and binary semaphores
should be used instead */
#define LWIP_COMPAT_MUTEX 1
#define MEM_ALIGNMENT 4
#define LWIP_ARP 0
#define ARP_QUEUEING 0
#define ETH_PAD_SIZE 2
#define IP_FORWARD 0
#define IP_REASS_MAX_PBUFS 0xFFFFFFFF
#define IP_DEFAULT_TTL 128
#define IP_SOF_BROADCAST 1
#define IP_SOF_BROADCAST_RECV 1
#define LWIP_ICMP 0
#define LWIP_RAW 0
#define LWIP_DHCP 0
#define LWIP_AUTOIP 0
#define LWIP_SNMP 0
#define LWIP_IGMP 0
#define LWIP_DNS 0
#define LWIP_UDP 0
#define LWIP_UDPLITE 0
#define LWIP_TCP 1
#define TCP_QUEUE_OOSEQ 1
#define SO_REUSE 1
#define SO_REUSE_RXTOALL 1
/* FIXME: These MSS and TCP Window definitions assume an MTU
* of 1500. We need to add some code to lwIP which would allow us
* to change these values based upon the interface we are
* using. Currently ReactOS only supports Ethernet so we're
* fine for now but it does need to be fixed later when we
* add support for other transport mediums */
#define TCP_MSS 1460
#define TCP_WND 0xFFFF
#define TCP_SND_BUF TCP_WND
#define TCP_MAXRTX 8
#define TCP_SYNMAXRTX 4
#define TCP_LISTEN_BACKLOG 1
#define LWIP_TCP_TIMESTAMPS 1
#define LWIP_CALLBACK_API 1
#define LWIP_NETIF_API 1
#define LWIP_SOCKET 0
#define LWIP_NETCONN 0
#define LWIP_NETIF_HWADDRHINT 0
#define LWIP_STATS 0
#define ICMP_STATS 0
#define PPP_SUPPORT 0
#define PPPOE_SUPPORT 0
#define PPPOS_SUPPORT 0
/*
---------------------------------------
---------- Debugging options ----------
---------------------------------------
*/
/**
* LWIP_DBG_MIN_LEVEL: After masking, the value of the debug is
* compared against this value. If it is smaller, then debugging
* messages are written.
*/
#define LWIP_DBG_MIN_LEVEL LWIP_DBG_LEVEL_ALL
/**
* LWIP_DBG_TYPES_ON: A mask that can be used to globally enable/disable
* debug messages of certain types.
*/
#define LWIP_DBG_TYPES_ON LWIP_DBG_ON
/**
* NETIF_DEBUG: Enable debugging in netif.c.
*/
#define NETIF_DEBUG LWIP_DBG_OFF
/**
* PBUF_DEBUG: Enable debugging in pbuf.c.
*/
#define PBUF_DEBUG LWIP_DBG_OFF
/**
* INET_DEBUG: Enable debugging in inet.c.
*/
#define INET_DEBUG LWIP_DBG_OFF
/**
* IP_DEBUG: Enable debugging for IP.
*/
#define IP_DEBUG LWIP_DBG_OFF
/**
* IP_REASS_DEBUG: Enable debugging in ip_frag.c for both frag & reass.
*/
#define IP_REASS_DEBUG LWIP_DBG_OFF
/**
* MEM_DEBUG: Enable debugging in mem.c.
*/
#define MEM_DEBUG LWIP_DBG_OFF
/**
* MEMP_DEBUG: Enable debugging in memp.c.
*/
#define MEMP_DEBUG LWIP_DBG_OFF
/**
* SYS_DEBUG: Enable debugging in sys.c.
*/
#define SYS_DEBUG LWIP_DBG_OFF
/**
* TCP_DEBUG: Enable debugging for TCP.
*/
#define TCP_DEBUG LWIP_DBG_ON
/**
* TCP_INPUT_DEBUG: Enable debugging in tcp_in.c for incoming debug.
*/
#define TCP_INPUT_DEBUG LWIP_DBG_OFF
/**
* TCP_FR_DEBUG: Enable debugging in tcp_in.c for fast retransmit.
*/
#define TCP_FR_DEBUG LWIP_DBG_OFF
/**
* TCP_RTO_DEBUG: Enable debugging in TCP for retransmit
* timeout.
*/
#define TCP_RTO_DEBUG LWIP_DBG_OFF
/**
* TCP_CWND_DEBUG: Enable debugging for TCP congestion window.
*/
#define TCP_CWND_DEBUG LWIP_DBG_OFF
/**
* TCP_WND_DEBUG: Enable debugging in tcp_in.c for window updating.
*/
#define TCP_WND_DEBUG LWIP_DBG_OFF
/**
* TCP_OUTPUT_DEBUG: Enable debugging in tcp_out.c output functions.
*/
#define TCP_OUTPUT_DEBUG LWIP_DBG_OFF
/**
* TCP_RST_DEBUG: Enable debugging for TCP with the RST message.
*/
#define TCP_RST_DEBUG LWIP_DBG_OFF
/**
* TCP_QLEN_DEBUG: Enable debugging for TCP queue lengths.
*/
#define TCP_QLEN_DEBUG LWIP_DBG_OFF
/**
* TCPIP_DEBUG: Enable debugging in tcpip.c.
*/
#define TCPIP_DEBUG LWIP_DBG_OFF

View file

@ -0,0 +1,6 @@
#ifndef _LWIP_PCH_
#define _LWIP_PCH_
#include "lwip/opt.h"
#endif /* _LWIP_PCH_ */