From 49022e99f5211268c74989c6d5a9331b01ae59e7 Mon Sep 17 00:00:00 2001 From: David Cermak Date: Wed, 5 May 2021 09:14:34 +0200 Subject: [PATCH] lwip: Add config for DHCP client id; Fix DNS server idx assert issue This commit brings two esp-lwip fixes to IDF: 1) Add configuration to disable DHCP client identification https://github.com/espressif/esp-lwip/commit/2195f7416fb3136831babf3e96c027a73075bd4f This config could be used to disable option 61 in DHCP packets, so that clients will be identified by their chaddr only. (This is the lwip upstream original behaviour) 2) Fix server_idx increasing to DNS_MAX_SERVERS and trigger the LWIP_ASSERT https://github.com/espressif/esp-lwip/commit/5a567d52f7b97b1f5e61604636bef555fdd84b8f When lwip doesn't have DNS server and resolve a domain address, the server_idx will increase to DNS_MAX_SERVERS, which will trigger the LWIP_ASSERT and make device crash. Closes https://github.com/espressif/esp-idf/issues/6878 --- components/lwip/Kconfig | 9 +++++++++ components/lwip/lwip | 2 +- components/lwip/port/esp32/include/lwipopts.h | 4 ++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/components/lwip/Kconfig b/components/lwip/Kconfig index ca9e695967..714e1a828e 100644 --- a/components/lwip/Kconfig +++ b/components/lwip/Kconfig @@ -239,6 +239,15 @@ menu "LWIP" Enabling this option performs a check (via ARP request) if the offered IP address is not already in use by another host on the network. + config LWIP_DHCP_DISABLE_CLIENT_ID + bool "DHCP: Disable Use of HW address as client identification" + default n + help + This option could be used to disable DHCP client identification with its MAC address. + (Client id is used by DHCP servers to uniquely identify clients and are included + in the DHCP packets as an option 61) + Set this option to "y" in order to exclude option 61 from DHCP packets. + config LWIP_DHCP_RESTORE_LAST_IP bool "DHCP: Restore last IP obtained from DHCP server" default n diff --git a/components/lwip/lwip b/components/lwip/lwip index 2c9c531f0a..2195f7416f 160000 --- a/components/lwip/lwip +++ b/components/lwip/lwip @@ -1 +1 @@ -Subproject commit 2c9c531f0a7e0ee536db9de4f9dc54e453712087 +Subproject commit 2195f7416fb3136831babf3e96c027a73075bd4f diff --git a/components/lwip/port/esp32/include/lwipopts.h b/components/lwip/port/esp32/include/lwipopts.h index 5b7d9141f0..4d5809517a 100644 --- a/components/lwip/port/esp32/include/lwipopts.h +++ b/components/lwip/port/esp32/include/lwipopts.h @@ -249,6 +249,10 @@ */ #define DHCP_DOES_ARP_CHECK CONFIG_LWIP_DHCP_DOES_ARP_CHECK +/** + * LWIP_DHCP_DISABLE_CLIENT_ID==1: Do not add option 61 (client-id) to DHCP packets + */ +#define ESP_DHCP_DISABLE_CLIENT_ID CONFIG_LWIP_DHCP_DISABLE_CLIENT_ID /** * CONFIG_LWIP_DHCP_RESTORE_LAST_IP==1: Last valid IP address obtained from DHCP server