diff --git a/src/core/dns.c b/src/core/dns.c index 58152412..d950c6b7 100644 --- a/src/core/dns.c +++ b/src/core/dns.c @@ -1422,6 +1422,7 @@ err_t dns_gethostbyname(const char *hostname, ip_addr_t *addr, dns_found_callback found, void *callback_arg) { +#if LWIP_IPV4 && LWIP_IPV6 return dns_gethostbyname_addrtype(hostname, addr, found, callback_arg, LWIP_DNS_ADDRTYPE_DEFAULT); } @@ -1435,6 +1436,7 @@ err_t dns_gethostbyname_addrtype(const char *hostname, ip_addr_t *addr, dns_found_callback found, void *callback_arg, u8_t dns_addrtype) { +#endif /* LWIP_IPV4 && LWIP_IPV6 */ size_t hostnamelen; /* not initialized or no valid server yet, or invalid addr pointer * or invalid hostname or invalid hostname length */ @@ -1494,4 +1496,14 @@ dns_gethostbyname_addrtype(const char *hostname, ip_addr_t *addr, dns_found_call return dns_enqueue(hostname, hostnamelen, found, callback_arg LWIP_DNS_ADDRTYPE_ARG(dns_addrtype)); } +#if !LWIP_IPV4 || !LWIP_IPV6 +err_t +dns_gethostbyname_addrtype(const char *hostname, ip_addr_t *addr, dns_found_callback found, + void *callback_arg, u8_t dns_addrtype) +{ + LWIP_UNUSED_ARG(dns_addrtype); + return dns_gethostbyname(hostname, addr, found, callback_arg); +} +#endif /* LWIP_IPV4 && LWIP_IPV6 */ + #endif /* LWIP_DNS */ diff --git a/src/include/lwip/api.h b/src/include/lwip/api.h index c09dee16..7fd9dc75 100644 --- a/src/include/lwip/api.h +++ b/src/include/lwip/api.h @@ -297,7 +297,7 @@ err_t netconn_gethostbyname_addrtype(const char *name, ip_addr_t *addr, u8_t d #define netconn_gethostbyname(name, addr) netconn_gethostbyname_addrtype(name, addr, NETCONN_DNS_DEFAULT) #else /* LWIP_IPV4 && LWIP_IPV6 */ err_t netconn_gethostbyname(const char *name, ip_addr_t *addr); -#define netconn_gethostbyname_addrtype(name, addr, dns_addrtype netconn_gethostbyname(name, addr) +#define netconn_gethostbyname_addrtype(name, addr, dns_addrtype) netconn_gethostbyname(name, addr) #endif /* LWIP_IPV4 && LWIP_IPV6 */ #endif /* LWIP_DNS */