dns: Add API to clear dns cache

Picked from espressif/esp-lwip@ee59f77d
Ref IDF-4839
This commit is contained in:
yuanjm
2021-10-12 20:11:42 +08:00
committed by David Cermak
parent 5446609ae9
commit 95048339bf
2 changed files with 10 additions and 3 deletions
+9
View File
@@ -382,6 +382,15 @@ dns_setserver(u8_t numdns, const ip_addr_t *dnsserver)
}
}
/**
* Clears the DNS cache
*/
void
dns_clear_cache(void)
{
memset(dns_table, 0, sizeof(struct dns_table_entry) * DNS_TABLE_SIZE);
}
/**
* @ingroup dns
* Obtain one of the currently configured DNS server.
+1 -3
View File
@@ -111,9 +111,7 @@ err_t dns_gethostbyname(const char *hostname, ip_addr_t *addr,
err_t dns_gethostbyname_addrtype(const char *hostname, ip_addr_t *addr,
dns_found_callback found, void *callback_arg,
u8_t dns_addrtype);
#if ESP_DNS
void dns_clear_servers(bool keep_fallback);
#endif
void dns_clear_cache(void);
#if DNS_LOCAL_HOSTLIST
size_t dns_local_iterate(dns_found_callback iterator_fn, void *iterator_arg);