From d60ff9b6f6ce761ca2683246cf06126c574d186b Mon Sep 17 00:00:00 2001 From: Liu Han Date: Tue, 13 Dec 2016 09:52:29 +0800 Subject: [PATCH] components/tcpip_adapter: Fix set static IP address issue Set static IP address, clear current DNS servers. --- components/tcpip_adapter/tcpip_adapter_lwip.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/components/tcpip_adapter/tcpip_adapter_lwip.c b/components/tcpip_adapter/tcpip_adapter_lwip.c index c20fea5059..8b51471390 100644 --- a/components/tcpip_adapter/tcpip_adapter_lwip.c +++ b/components/tcpip_adapter/tcpip_adapter_lwip.c @@ -25,6 +25,9 @@ #include "lwip/ip_addr.h" #include "lwip/ip6_addr.h" #include "lwip/nd6.h" +#if LWIP_DNS /* don't build if not configured for use in lwipopts.h */ +#include "lwip/dns.h" +#endif #include "netif/wlanif.h" #include "netif/ethernetif.h" @@ -229,6 +232,12 @@ esp_err_t tcpip_adapter_set_ip_info(tcpip_adapter_if_t tcpip_if, tcpip_adapter_i if (status != TCPIP_ADAPTER_DHCP_STOPPED) { return ESP_ERR_TCPIP_ADAPTER_DHCP_NOT_STOPPED; } +#if LWIP_DNS /* don't build if not configured for use in lwipopts.h */ + u8_t numdns = 0; + for (numdns = 0; numdns < DNS_MAX_SERVERS; numdns ++) { + dns_setserver(numdns, NULL); + } +#endif } ip4_addr_copy(esp_ip[tcpip_if].ip, ip_info->ip);