forked from espressif/esp-idf
Merge branch 'bufix/Backport_some_lwip_bugs_for_4.2_0417' into 'release/v4.2'
lwip: Add security fixes and other features and bufixes to v4.2 See merge request espressif/esp-idf!23238
This commit is contained in:
@@ -245,6 +245,14 @@ menu "LWIP"
|
|||||||
server. Last valid DHCP configuration is stored in nvs and restored after reset/power-up. If IP is still
|
server. Last valid DHCP configuration is stored in nvs and restored after reset/power-up. If IP is still
|
||||||
available, there is no need for sending discovery message to DHCP server and save some time.
|
available, there is no need for sending discovery message to DHCP server and save some time.
|
||||||
|
|
||||||
|
config LWIP_DHCP_COARSE_TIMER_SECS
|
||||||
|
int "DHCP coarse timer interval(s)"
|
||||||
|
default 1
|
||||||
|
range 1 10
|
||||||
|
help
|
||||||
|
Set DHCP coarse interval in seconds.
|
||||||
|
A higher value will be less precise but cost less power consumption.
|
||||||
|
|
||||||
menu "DHCP server"
|
menu "DHCP server"
|
||||||
|
|
||||||
config LWIP_DHCPS_LEASE_UNIT
|
config LWIP_DHCPS_LEASE_UNIT
|
||||||
@@ -420,7 +428,13 @@ menu "LWIP"
|
|||||||
int "Maximum segment lifetime (MSL)"
|
int "Maximum segment lifetime (MSL)"
|
||||||
default 60000
|
default 60000
|
||||||
help
|
help
|
||||||
Set maximum segment lifetime in in milliseconds.
|
Set maximum segment lifetime in milliseconds.
|
||||||
|
|
||||||
|
config LWIP_TCP_FIN_WAIT_TIMEOUT
|
||||||
|
int "Maximum FIN segment lifetime"
|
||||||
|
default 20000
|
||||||
|
help
|
||||||
|
Set maximum segment lifetime in milliseconds.
|
||||||
|
|
||||||
config LWIP_TCP_SND_BUF_DEFAULT
|
config LWIP_TCP_SND_BUF_DEFAULT
|
||||||
int "Default send buffer size"
|
int "Default send buffer size"
|
||||||
|
Submodule components/lwip/lwip updated: 2195f7416f...6bb132e379
@@ -46,6 +46,12 @@
|
|||||||
#include "sntp.h"
|
#include "sntp.h"
|
||||||
#include "netif/dhcp_state.h"
|
#include "netif/dhcp_state.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* Enable all Espressif-only options */
|
/* Enable all Espressif-only options */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -255,6 +261,33 @@
|
|||||||
*/
|
*/
|
||||||
#define ESP_DHCP_DISABLE_CLIENT_ID CONFIG_LWIP_DHCP_DISABLE_CLIENT_ID
|
#define ESP_DHCP_DISABLE_CLIENT_ID CONFIG_LWIP_DHCP_DISABLE_CLIENT_ID
|
||||||
|
|
||||||
|
#define DHCP_DEFINE_CUSTOM_TIMEOUTS 1
|
||||||
|
/* Since for embedded devices it's not that hard to miss a discover packet, so lower
|
||||||
|
* the discover retry backoff time from (2,4,8,16,32,60,60)s to (500m,1,2,4,8,15,15)s.
|
||||||
|
*/
|
||||||
|
#define DHCP_REQUEST_TIMEOUT_SEQUENCE(state, tries) (state == DHCP_STATE_REQUESTING ? \
|
||||||
|
(uint16_t)(1 * 1000) : \
|
||||||
|
(uint16_t)(((tries) < 6 ? 1 << (tries) : 60) * 250))
|
||||||
|
|
||||||
|
#define DHCP_COARSE_TIMER_SECS CONFIG_LWIP_DHCP_COARSE_TIMER_SECS
|
||||||
|
|
||||||
|
static inline uint32_t timeout_from_offered(uint32_t lease, uint32_t min)
|
||||||
|
{
|
||||||
|
uint32_t timeout = lease;
|
||||||
|
if (timeout == 0) {
|
||||||
|
timeout = min;
|
||||||
|
}
|
||||||
|
timeout = (timeout + DHCP_COARSE_TIMER_SECS - 1) / DHCP_COARSE_TIMER_SECS;
|
||||||
|
return timeout;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define DHCP_CALC_TIMEOUT_FROM_OFFERED_T0_LEASE(dhcp) \
|
||||||
|
timeout_from_offered((dhcp)->offered_t0_lease, 120)
|
||||||
|
#define DHCP_CALC_TIMEOUT_FROM_OFFERED_T1_RENEW(dhcp) \
|
||||||
|
timeout_from_offered((dhcp)->offered_t1_renew, (dhcp)->t0_timeout >> 1 /* 50% */)
|
||||||
|
#define DHCP_CALC_TIMEOUT_FROM_OFFERED_T2_REBIND(dhcp) \
|
||||||
|
timeout_from_offered((dhcp)->offered_t2_rebind, ((dhcp)->t0_timeout / 8) * 7 /* 87.5% */)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CONFIG_LWIP_DHCP_RESTORE_LAST_IP==1: Last valid IP address obtained from DHCP server
|
* CONFIG_LWIP_DHCP_RESTORE_LAST_IP==1: Last valid IP address obtained from DHCP server
|
||||||
* is restored after reset/power-up.
|
* is restored after reset/power-up.
|
||||||
@@ -367,6 +400,11 @@
|
|||||||
*/
|
*/
|
||||||
#define TCP_MSS CONFIG_LWIP_TCP_MSS
|
#define TCP_MSS CONFIG_LWIP_TCP_MSS
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TCP_FIN_WAIT_TIMEOUT: The maximum FIN segment lifetime in milliseconds
|
||||||
|
*/
|
||||||
|
#define TCP_FIN_WAIT_TIMEOUT CONFIG_LWIP_TCP_FIN_WAIT_TIMEOUT
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TCP_TMR_INTERVAL: TCP timer interval
|
* TCP_TMR_INTERVAL: TCP timer interval
|
||||||
*/
|
*/
|
||||||
@@ -899,9 +937,25 @@ u32_t lwip_hook_tcp_isn(const struct ip_addr *local_ip, u16_t local_port,
|
|||||||
#ifdef CONFIG_LWIP_TIMERS_ONDEMAND
|
#ifdef CONFIG_LWIP_TIMERS_ONDEMAND
|
||||||
#define ESP_LWIP_IGMP_TIMERS_ONDEMAND 1
|
#define ESP_LWIP_IGMP_TIMERS_ONDEMAND 1
|
||||||
#define ESP_LWIP_MLD6_TIMERS_ONDEMAND 1
|
#define ESP_LWIP_MLD6_TIMERS_ONDEMAND 1
|
||||||
|
#define ESP_LWIP_DHCP_FINE_TIMERS_ONDEMAND 1
|
||||||
|
#define ESP_LWIP_DNS_TIMERS_ONDEMAND 1
|
||||||
|
#if IP_REASSEMBLY
|
||||||
|
#define ESP_LWIP_IP4_REASSEMBLY_TIMERS_ONDEMAND 1
|
||||||
|
#endif /* IP_REASSEMBLY */
|
||||||
|
#if LWIP_IPV6_REASS
|
||||||
|
#define ESP_LWIP_IP6_REASSEMBLY_TIMERS_ONDEMAND 1
|
||||||
|
#endif /* LWIP_IPV6_REASS */
|
||||||
#else
|
#else
|
||||||
#define ESP_LWIP_IGMP_TIMERS_ONDEMAND 0
|
#define ESP_LWIP_IGMP_TIMERS_ONDEMAND 0
|
||||||
#define ESP_LWIP_MLD6_TIMERS_ONDEMAND 0
|
#define ESP_LWIP_MLD6_TIMERS_ONDEMAND 0
|
||||||
|
#define ESP_LWIP_DHCP_FINE_TIMERS_ONDEMAND 0
|
||||||
|
#define ESP_LWIP_DNS_TIMERS_ONDEMAND 0
|
||||||
|
#if IP_REASSEMBLY
|
||||||
|
#define ESP_LWIP_IP4_REASSEMBLY_TIMERS_ONDEMAND 0
|
||||||
|
#endif /* IP_REASSEMBLY */
|
||||||
|
#if LWIP_IPV6_REASS
|
||||||
|
#define ESP_LWIP_IP6_REASSEMBLY_TIMERS_ONDEMAND 0
|
||||||
|
#endif /* LWIP_IPV6_REASS */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define TCP_SND_BUF CONFIG_LWIP_TCP_SND_BUF_DEFAULT
|
#define TCP_SND_BUF CONFIG_LWIP_TCP_SND_BUF_DEFAULT
|
||||||
@@ -960,4 +1014,8 @@ u32_t lwip_hook_tcp_isn(const struct ip_addr *local_ip, u16_t local_port,
|
|||||||
|
|
||||||
#define SOC_SEND_LOG //printf
|
#define SOC_SEND_LOG //printf
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* __LWIPOPTS_H__ */
|
#endif /* __LWIPOPTS_H__ */
|
||||||
|
1
components/lwip/test_afl_host/sdkconfig.defaults
Normal file
1
components/lwip/test_afl_host/sdkconfig.defaults
Normal file
@@ -0,0 +1 @@
|
|||||||
|
CONFIG_LWIP_TIMERS_ONDEMAND=n
|
@@ -374,6 +374,7 @@ Most lwIP RAM usage is on-demand, as RAM is allocated from the heap as needed. T
|
|||||||
|
|
||||||
- Reducing :ref:`CONFIG_LWIP_MAX_SOCKETS` reduces the maximum number of sockets in the system. This will also cause TCP sockets in the ``WAIT_CLOSE`` state to be closed and recycled more rapidly (if needed to open a new socket), further reducing peak RAM usage.
|
- Reducing :ref:`CONFIG_LWIP_MAX_SOCKETS` reduces the maximum number of sockets in the system. This will also cause TCP sockets in the ``WAIT_CLOSE`` state to be closed and recycled more rapidly (if needed to open a new socket), further reducing peak RAM usage.
|
||||||
- Reducing :ref:`CONFIG_LWIP_TCPIP_RECVMBOX_SIZE`, :ref:`CONFIG_LWIP_TCP_RECVMBOX_SIZE` and :ref:`CONFIG_LWIP_UDP_RECVMBOX_SIZE` reduce memory usage at the expense of throughput, depending on usage.
|
- Reducing :ref:`CONFIG_LWIP_TCPIP_RECVMBOX_SIZE`, :ref:`CONFIG_LWIP_TCP_RECVMBOX_SIZE` and :ref:`CONFIG_LWIP_UDP_RECVMBOX_SIZE` reduce memory usage at the expense of throughput, depending on usage.
|
||||||
|
- Reducing :ref:`CONFIG_LWIP_TCP_MSL`, :ref:`CONFIG_LWIP_TCP_FIN_WAIT_TIMEOUT` reduces the maximum segment lifetime in the system. This will also cause TCP sockets in the ``TIME_WAIT``, ``FIN_WAIT_2`` state to be closed and recycled more rapidly
|
||||||
|
|
||||||
If using Wi-Fi, please also refer to :ref:`wifi-buffer-usage`.
|
If using Wi-Fi, please also refer to :ref:`wifi-buffer-usage`.
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user