Merge branch 'optimization/get_dns_server_and_add_dns_enable_ipv6_dns_retrieval' into 'release/v3.3'

lw-ip:optimization get dns server and add dns enable ipv6 dns retrieval

See merge request espressif/esp-idf!7643
This commit is contained in:
Jiang Jiang Jian 2020-02-21 18:20:52 +08:00
commit a55cd0e7f3
4 changed files with 23 additions and 4 deletions

@ -1 +1 @@
Subproject commit 057f7f6a8ca3cd736009cc80d4f429f42b0db254
Subproject commit da2740fa8d56b9b9e8a10602f38df1ea4dbd9b74

View File

@ -660,6 +660,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 DNS_MAX_SERVERS
/*
---------------------------------------
---------- Hook options ---------------

View File

@ -775,6 +775,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) {
@ -793,7 +794,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();
}

View File

@ -454,6 +454,7 @@ esp_err_t esp_modem_remove_event_handler(modem_dte_t *dte, esp_event_handler_t h
static void on_ppp_status_changed(ppp_pcb *pcb, int err_code, void *ctx)
{
struct netif *pppif = ppp_netif(pcb);
const ip_addr_t *dest_ip = NULL;
modem_dte_t *dte = (modem_dte_t *)(ctx);
esp_modem_dte_t *esp_dte = __containerof(dte, esp_modem_dte_t, parent);
ppp_client_ip_info_t ipinfo = {0};
@ -462,8 +463,15 @@ static void on_ppp_status_changed(ppp_pcb *pcb, int err_code, void *ctx)
ipinfo.ip = pppif->ip_addr.u_addr.ip4;
ipinfo.gw = pppif->gw.u_addr.ip4;
ipinfo.netmask = pppif->netmask.u_addr.ip4;
ipinfo.ns1 = dns_getserver(0).u_addr.ip4;
ipinfo.ns2 = dns_getserver(1).u_addr.ip4;
dest_ip = dns_getserver(0);
if(dest_ip != NULL) {
ipinfo.ns1 = dest_ip->u_addr.ip4;
}
dest_ip = dns_getserver(1);
if(dest_ip != NULL) {
ipinfo.ns2 = dest_ip->u_addr.ip4;
}
esp_event_post_to(esp_dte->event_loop_hdl, ESP_MODEM_EVENT, MODEM_EVENT_PPP_CONNECT, &ipinfo, sizeof(ipinfo), 0);
break;
case PPPERR_PARAM: