diff --git a/sys/net/netutils/util.c b/sys/net/netutils/util.c index 34cf1bec56..0e1105ca2b 100644 --- a/sys/net/netutils/util.c +++ b/sys/net/netutils/util.c @@ -22,8 +22,8 @@ #include "net/utils.h" #if defined(MODULE_DNS) #include "net/af.h" -#include "net/dns.h" #endif +#include "net/dns.h" /* get the next netif, returns true if there are more */ static bool _netif_get(netif_t **current_netif) @@ -44,7 +44,6 @@ int netutils_get_ipv4(ipv4_addr_t *addr, const char *hostname) for (size_t i = 0; i < strlen(hostname); i++) { bool is_not_ipv4 = (hostname[i] < '0' || hostname[i] > '9') && hostname[i] != '.'; -#if defined(MODULE_SOCK_DNS) || defined(MODULE_SOCK_DNS_MOCK) /* once we see an invalid character for an IPv4 address try to * resolve the hostname by DNS */ if (is_not_ipv4) { @@ -54,11 +53,6 @@ int netutils_get_ipv4(ipv4_addr_t *addr, const char *hostname) } return 0; } -#else - if (is_not_ipv4) { - return -EINVAL; - } -#endif } size_t len = strlen(hostname); @@ -77,7 +71,6 @@ int netutils_get_ipv6(ipv6_addr_t *addr, netif_t **netif, const char *hostname) return -EINVAL; } -#if defined(MODULE_SOCK_DNS) || defined(MODULE_SOCK_DNS_MOCK) /* hostname is not an IPv6 address */ if (strchr(hostname, ':') == NULL) { int res = dns_query(hostname, addr, AF_INET6); @@ -86,7 +79,6 @@ int netutils_get_ipv6(ipv6_addr_t *addr, netif_t **netif, const char *hostname) } return 0; } -#endif /* search for interface ID */ size_t len = strlen(hostname);