feat(lwip): add fall back dns config in menuconfig

This commit is contained in:
zhangyanjiao 2024-01-25 11:05:53 +08:00 committed by BOT
parent ce93d231e9
commit 99093b8743
3 changed files with 39 additions and 3 deletions

View File

@ -1001,6 +1001,33 @@ menu "LWIP"
help help
Set maximum number of ports a bridge can consists of. Set maximum number of ports a bridge can consists of.
menu "DNS"
config LWIP_DNS_MAX_SERVERS
int "Maximum number of DNS servers"
default 3
range 1 4
help
Set maximum number of DNS servers.
If fallback DNS servers are supported,
the number of DNS servers needs to be greater than or equal to 3.
config LWIP_FALLBACK_DNS_SERVER_SUPPORT
bool "Enable DNS fallback server support"
default n
depends on LWIP_DNS_MAX_SERVERS >= 3
help
Enable this feature to support DNS fallback server.
config LWIP_FALLBACK_DNS_SERVER_ADDRESS
string "DNS fallback server address"
default "114.114.114.114"
depends on LWIP_FALLBACK_DNS_SERVER_SUPPORT
help
This option allows you to config dns fallback server address.
endmenu # DNS
config LWIP_ESP_LWIP_ASSERT config LWIP_ESP_LWIP_ASSERT
bool "Enable LWIP ASSERT checks" bool "Enable LWIP ASSERT checks"
default y default y

@ -1 +1 @@
Subproject commit 542ba2997f6cc14fe9c3d781bf9b0d890cd70bb1 Subproject commit f79221431fa9042b3572d271d687de66da7560c4

View File

@ -3,7 +3,7 @@
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
* *
* SPDX-FileContributor: 2015-2023 Espressif Systems (Shanghai) CO LTD * SPDX-FileContributor: 2015-2024 Espressif Systems (Shanghai) CO LTD
*/ */
#ifndef LWIP_HDR_ESP_LWIPOPTS_H #ifndef LWIP_HDR_ESP_LWIPOPTS_H
#define LWIP_HDR_ESP_LWIPOPTS_H #define LWIP_HDR_ESP_LWIPOPTS_H
@ -457,7 +457,7 @@ static inline uint32_t timeout_from_offered(uint32_t lease, uint32_t min)
/** The maximum of DNS servers /** The maximum of DNS servers
*/ */
#define DNS_MAX_SERVERS 3 #define DNS_MAX_SERVERS CONFIG_LWIP_DNS_MAX_SERVERS
/** ESP specific option only applicable if ESP_DNS=1 /** ESP specific option only applicable if ESP_DNS=1
* *
@ -476,6 +476,14 @@ static inline uint32_t timeout_from_offered(uint32_t lease, uint32_t min)
#define LWIP_DNS_SUPPORT_MDNS_QUERIES 0 #define LWIP_DNS_SUPPORT_MDNS_QUERIES 0
#endif #endif
#ifdef CONFIG_LWIP_FALLBACK_DNS_SERVER_SUPPORT
#define FALLBACK_DNS_SERVER_ADDRESS(address) \
do { ip_addr_t *server_dns = address; \
char server_ip[] = CONFIG_LWIP_FALLBACK_DNS_SERVER_ADDRESS; \
ipaddr_aton(server_ip, server_dns); \
} while (0)
#endif /* CONFIG_LWIP_FALLBACK_DNS_SERVER_SUPPORT */
/* /*
--------------------------------- ---------------------------------
---------- UDP options ---------- ---------- UDP options ----------
@ -1543,6 +1551,7 @@ static inline uint32_t timeout_from_offered(uint32_t lease, uint32_t min)
#define ESP_LWIP_LOCK 1 #define ESP_LWIP_LOCK 1
#define ESP_THREAD_PROTECTION 1 #define ESP_THREAD_PROTECTION 1
#define LWIP_SUPPORT_CUSTOM_PBUF 1 #define LWIP_SUPPORT_CUSTOM_PBUF 1
#define ESP_LWIP_FALLBACK_DNS_PREFER_IPV4 0
/* /*
----------------------------------------- -----------------------------------------