mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-02 04:04:31 +02:00
lwip: provide configuration option to enable TCP ISN hook
This commit is contained in:
@@ -4,6 +4,7 @@ set(include_dirs
|
|||||||
lwip/src/include
|
lwip/src/include
|
||||||
port/esp32/include
|
port/esp32/include
|
||||||
port/esp32/include/arch
|
port/esp32/include/arch
|
||||||
|
port/esp32/tcp_isn
|
||||||
)
|
)
|
||||||
|
|
||||||
set(srcs
|
set(srcs
|
||||||
@@ -135,6 +136,10 @@ else()
|
|||||||
list(APPEND srcs "port/esp32/no_vfs_syscalls.c")
|
list(APPEND srcs "port/esp32/no_vfs_syscalls.c")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(CONFIG_LWIP_TCP_ISN_HOOK)
|
||||||
|
list(APPEND srcs "port/esp32/tcp_isn/tcp_isn.c")
|
||||||
|
endif()
|
||||||
|
|
||||||
idf_component_register(SRCS "${srcs}"
|
idf_component_register(SRCS "${srcs}"
|
||||||
INCLUDE_DIRS "${include_dirs}"
|
INCLUDE_DIRS "${include_dirs}"
|
||||||
LDFRAGMENTS linker.lf
|
LDFRAGMENTS linker.lf
|
||||||
|
@@ -327,6 +327,17 @@ menu "LWIP"
|
|||||||
|
|
||||||
menu "TCP"
|
menu "TCP"
|
||||||
|
|
||||||
|
config LWIP_TCP_ISN_HOOK
|
||||||
|
bool "Enable TCP ISN Hook"
|
||||||
|
default y
|
||||||
|
help
|
||||||
|
Enables custom TCP ISN hook to randomize initial sequence
|
||||||
|
number in TCP connection. This is recommended as default
|
||||||
|
lwIP implementation (`tcp_next_iss`) is not very strong,
|
||||||
|
as it does not take into consideration any platform
|
||||||
|
specific entropy source.
|
||||||
|
|
||||||
|
|
||||||
config LWIP_MAX_ACTIVE_TCP
|
config LWIP_MAX_ACTIVE_TCP
|
||||||
int "Maximum active TCP Connections"
|
int "Maximum active TCP Connections"
|
||||||
range 1 1024
|
range 1 1024
|
||||||
|
@@ -8,7 +8,8 @@ COMPONENT_ADD_INCLUDEDIRS := \
|
|||||||
include/apps/sntp \
|
include/apps/sntp \
|
||||||
lwip/src/include \
|
lwip/src/include \
|
||||||
port/esp32/include \
|
port/esp32/include \
|
||||||
port/esp32/include/arch
|
port/esp32/include/arch \
|
||||||
|
port/esp32/tcp_isn
|
||||||
|
|
||||||
COMPONENT_SRCDIRS := \
|
COMPONENT_SRCDIRS := \
|
||||||
apps/dhcpserver \
|
apps/dhcpserver \
|
||||||
@@ -39,6 +40,10 @@ ifdef CONFIG_LWIP_PPP_SUPPORT
|
|||||||
COMPONENT_SRCDIRS += lwip/src/netif/ppp lwip/src/netif/ppp/polarssl
|
COMPONENT_SRCDIRS += lwip/src/netif/ppp lwip/src/netif/ppp/polarssl
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifdef CONFIG_LWIP_TCP_ISN_HOOK
|
||||||
|
COMPONENT_SRCDIRS += port/esp32/tcp_isn
|
||||||
|
endif
|
||||||
|
|
||||||
CFLAGS += -Wno-address # lots of LWIP source files evaluate macros that check address of stack variables
|
CFLAGS += -Wno-address # lots of LWIP source files evaluate macros that check address of stack variables
|
||||||
|
|
||||||
lwip/src/netif/ppp/ppp.o: CFLAGS += -Wno-uninitialized
|
lwip/src/netif/ppp/ppp.o: CFLAGS += -Wno-uninitialized
|
||||||
|
@@ -420,6 +420,17 @@
|
|||||||
*/
|
*/
|
||||||
#define LWIP_TCP_RTO_TIME CONFIG_LWIP_TCP_RTO_TIME
|
#define LWIP_TCP_RTO_TIME CONFIG_LWIP_TCP_RTO_TIME
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set TCP hook for Initial Sequence Number (ISN)
|
||||||
|
*/
|
||||||
|
#ifdef CONFIG_LWIP_TCP_ISN_HOOK
|
||||||
|
#include <lwip/arch.h>
|
||||||
|
struct ip_addr;
|
||||||
|
u32_t lwip_hook_tcp_isn(const struct ip_addr *local_ip, u16_t local_port,
|
||||||
|
const struct ip_addr *remote_ip, u16_t remote_port);
|
||||||
|
#define LWIP_HOOK_TCP_ISN lwip_hook_tcp_isn
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
----------------------------------
|
----------------------------------
|
||||||
---------- Pbuf options ----------
|
---------- Pbuf options ----------
|
||||||
|
Reference in New Issue
Block a user