From 49202b7f03e1c8dd63ccbb8a9bce7f01949e2973 Mon Sep 17 00:00:00 2001 From: xueyunfei Date: Fri, 27 Mar 2020 17:19:03 +0800 Subject: [PATCH] backport bugfix lwip for v3.2 --- components/lwip/lwip | 2 +- components/lwip/port/esp32/include/lwipopts.h | 7 +++++++ components/tcpip_adapter/tcpip_adapter_lwip.c | 10 +++++++++- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/components/lwip/lwip b/components/lwip/lwip index 39f338547..da2740fa8 160000 --- a/components/lwip/lwip +++ b/components/lwip/lwip @@ -1 +1 @@ -Subproject commit 39f338547ab344e855f94eb922421036bee8e417 +Subproject commit da2740fa8d56b9b9e8a10602f38df1ea4dbd9b74 diff --git a/components/lwip/port/esp32/include/lwipopts.h b/components/lwip/port/esp32/include/lwipopts.h index 7d48f7bdd..be04739a7 100644 --- a/components/lwip/port/esp32/include/lwipopts.h +++ b/components/lwip/port/esp32/include/lwipopts.h @@ -655,6 +655,13 @@ */ #define LWIP_IPV6 1 +/** + * LWIP_ND6_RDNSS_MAX_DNS_SERVERS: Allow IPv6 DNS servers to be retrieved from + * NDP, up to the maximum number of allowed DNS servers (minus fallback slot) + */ +#define LWIP_ND6_RDNSS_MAX_DNS_SERVERS 0 + + /* --------------------------------------- ---------- Hook options --------------- diff --git a/components/tcpip_adapter/tcpip_adapter_lwip.c b/components/tcpip_adapter/tcpip_adapter_lwip.c index 16f80a9a3..153dd5dff 100644 --- a/components/tcpip_adapter/tcpip_adapter_lwip.c +++ b/components/tcpip_adapter/tcpip_adapter_lwip.c @@ -323,6 +323,9 @@ esp_err_t tcpip_adapter_down(tcpip_adapter_if_t tcpip_if) tcpip_adapter_reset_ip_info(tcpip_if); } + for(int8_t i = 0 ;i < LWIP_IPV6_NUM_ADDRESSES ;i++) { + netif_ip6_addr_set(esp_netif[tcpip_if] ,i ,IP6_ADDR_ANY6); + } netif_set_addr(esp_netif[tcpip_if], IP4_ADDR_ANY4, IP4_ADDR_ANY4, IP4_ADDR_ANY4); netif_set_down(esp_netif[tcpip_if]); tcpip_adapter_start_ip_lost_timer(tcpip_if); @@ -771,6 +774,7 @@ esp_err_t tcpip_adapter_get_dns_info(tcpip_adapter_if_t tcpip_if, tcpip_adapter_ dns_param.dns_type = type; dns_param.dns_info = dns; + const ip_addr_t* dns_ip = NULL; TCPIP_ADAPTER_IPC_CALL(tcpip_if, type, 0, &dns_param, tcpip_adapter_get_dns_info_api); if (!dns) { @@ -789,7 +793,10 @@ esp_err_t tcpip_adapter_get_dns_info(tcpip_adapter_if_t tcpip_if, tcpip_adapter_ } if (tcpip_if == TCPIP_ADAPTER_IF_STA || tcpip_if == TCPIP_ADAPTER_IF_ETH) { - dns->ip = dns_getserver(type); + dns_ip = dns_getserver(type); + if (dns_ip != NULL) { + dns->ip = *dns_ip; + } } else { dns->ip.u_addr.ip4 = dhcps_dns_getserver(); } @@ -827,6 +834,7 @@ esp_err_t tcpip_adapter_dhcps_start(tcpip_adapter_if_t tcpip_if) if (p_netif != NULL && netif_is_up(p_netif)) { tcpip_adapter_ip_info_t default_ip; tcpip_adapter_get_ip_info(ESP_IF_WIFI_AP, &default_ip); + dhcps_set_new_lease_cb(tcpip_adapter_dhcps_cb); dhcps_start(p_netif, default_ip.ip); dhcps_status = TCPIP_ADAPTER_DHCP_STARTED; ESP_LOGD(TAG, "dhcp server start successfully");