From 22f213b518cff0537389b3b8a117d7cbd028466c Mon Sep 17 00:00:00 2001 From: David Cermak Date: Mon, 15 Apr 2024 12:35:11 +0200 Subject: [PATCH] feat(lwip): Add support for lwip 2.2.0-esp release --- components/lwip/CMakeLists.txt | 1 + components/lwip/lwip | 2 +- components/lwip/port/include/lwipopts.h | 18 +++++++++++------- components/lwip/port/include/netinet/in.h | 2 -- tools/ci/check_public_headers_exceptions.txt | 2 ++ 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/components/lwip/CMakeLists.txt b/components/lwip/CMakeLists.txt index 8c55884277..a8ce574e59 100644 --- a/components/lwip/CMakeLists.txt +++ b/components/lwip/CMakeLists.txt @@ -57,6 +57,7 @@ if(CONFIG_LWIP_ENABLE) "lwip/src/core/ipv4/ip4_napt.c" "lwip/src/core/ipv4/ip4_addr.c" "lwip/src/core/ipv4/ip4_frag.c" + "lwip/src/core/ipv4/acd.c" "lwip/src/core/ipv6/dhcp6.c" "lwip/src/core/ipv6/ethip6.c" "lwip/src/core/ipv6/icmp6.c" diff --git a/components/lwip/lwip b/components/lwip/lwip index 0606eed9d8..3cc917682b 160000 --- a/components/lwip/lwip +++ b/components/lwip/lwip @@ -1 +1 @@ -Subproject commit 0606eed9d8b98a797514fdf6eabb4daf1c8c8cd9 +Subproject commit 3cc917682b4d15b2539ae900e8091c8057eb6768 diff --git a/components/lwip/port/include/lwipopts.h b/components/lwip/port/include/lwipopts.h index b58214c373..db455ce0f4 100644 --- a/components/lwip/port/include/lwipopts.h +++ b/components/lwip/port/include/lwipopts.h @@ -381,7 +381,7 @@ extern "C" { /* Since for embedded devices it's not that hard to miss a discover packet, so lower * the discover and request retry backoff time from (2,4,8,16,32,60,60)s to (500m,1,2,4,4,4,4)s. */ -#define DHCP_REQUEST_TIMEOUT_SEQUENCE(tries) ((uint16_t)(((tries) < 5 ? 1 << (tries) : 16) * 250)) +#define DHCP_REQUEST_BACKOFF_SEQUENCE(state, tries) ((uint16_t)(((tries) < 5 ? 1 << (tries) : 16) * 250)) static inline uint32_t timeout_from_offered(uint32_t lease, uint32_t min) { @@ -393,12 +393,12 @@ static inline uint32_t timeout_from_offered(uint32_t lease, uint32_t min) 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% */ ) +#define DHCP_SET_TIMEOUT_FROM_OFFERED_T0_LEASE(tout, dhcp) do { \ + (tout) = timeout_from_offered((dhcp)->offered_t0_lease, 120); } while(0) +#define DHCP_SET_TIMEOUT_FROM_OFFERED_T1_RENEW(tout, dhcp) do { \ + (tout) = timeout_from_offered((dhcp)->offered_t1_renew, (dhcp)->t0_timeout>>1 /* 50% */ ); } while(0) +#define DHCP_SET_TIMEOUT_FROM_OFFERED_T2_REBIND(tout, dhcp) do { \ + (tout) = timeout_from_offered((dhcp)->offered_t2_rebind, ((dhcp)->t0_timeout/8)*7 /* 87.5% */ ); } while(0) #define LWIP_HOOK_DHCP_PARSE_OPTION(netif, dhcp, state, msg, msg_type, option, len, pbuf, offset) \ do { LWIP_UNUSED_ARG(msg); \ @@ -692,8 +692,12 @@ static inline uint32_t timeout_from_offered(uint32_t lease, uint32_t min) /** * LWIP_NETIF_HOSTNAME==1: use DHCP_OPTION_HOSTNAME with netif's hostname * field. + * LWIP_DHCP_DISCOVER_ADD_HOSTNAME==1: include hostname opt in discover packets. + * If the hostname is not set in the DISCOVER packet, then some servers might issue + * an OFFER with hostname configured and consequently reject the REQUEST with any other hostname. */ #define LWIP_NETIF_HOSTNAME 1 +#define LWIP_DHCP_DISCOVER_ADD_HOSTNAME 1 /** * LWIP_NETIF_API==1: Support netif api (in netifapi.c) diff --git a/components/lwip/port/include/netinet/in.h b/components/lwip/port/include/netinet/in.h index e8f01bf918..2a30cfe781 100644 --- a/components/lwip/port/include/netinet/in.h +++ b/components/lwip/port/include/netinet/in.h @@ -9,6 +9,4 @@ #include "lwip/inet.h" -#define IN6_IS_ADDR_MULTICAST(a) IN_MULTICAST(a) - #endif /* IN_H_ */ diff --git a/tools/ci/check_public_headers_exceptions.txt b/tools/ci/check_public_headers_exceptions.txt index 397518950e..84b0202179 100644 --- a/tools/ci/check_public_headers_exceptions.txt +++ b/tools/ci/check_public_headers_exceptions.txt @@ -24,6 +24,8 @@ components/lwip/lwip/src/include/lwip/priv/memp_std.h components/lwip/include/lwip/sockets.h components/lwip/lwip/src/include/lwip/prot/nd6.h components/lwip/lwip/src/include/netif/ppp/ +components/lwip/lwip/src/include/lwip/apps/tftp_server.h +components/lwip/lwip/src/include/lwip/apps/tftp_client.h components/spi_flash/include/spi_flash_chip_issi.h components/spi_flash/include/spi_flash_chip_mxic.h