mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-15 17:43:51 +01:00
net/util: make use of dns_query()
This commit is contained in:
parent
9a9abb4f58
commit
e128736014
@ -20,9 +20,9 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "net/utils.h"
|
#include "net/utils.h"
|
||||||
#if defined(MODULE_SOCK_DNS) || defined(MODULE_SOCK_DNS_MOCK)
|
#if defined(MODULE_DNS)
|
||||||
#include "net/af.h"
|
#include "net/af.h"
|
||||||
#include "net/sock/dns.h"
|
#include "net/dns.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* get the next netif, returns true if there are more */
|
/* get the next netif, returns true if there are more */
|
||||||
@ -48,7 +48,7 @@ int netutils_get_ipv4(ipv4_addr_t *addr, const char *hostname)
|
|||||||
/* once we see an invalid character for an IPv4 address try to
|
/* once we see an invalid character for an IPv4 address try to
|
||||||
* resolve the hostname by DNS */
|
* resolve the hostname by DNS */
|
||||||
if (is_not_ipv4) {
|
if (is_not_ipv4) {
|
||||||
int res = sock_dns_query(hostname, addr, AF_INET);
|
int res = dns_query(hostname, addr, AF_INET);
|
||||||
if (res < 0) {
|
if (res < 0) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@ -80,7 +80,7 @@ int netutils_get_ipv6(ipv6_addr_t *addr, netif_t **netif, const char *hostname)
|
|||||||
#if defined(MODULE_SOCK_DNS) || defined(MODULE_SOCK_DNS_MOCK)
|
#if defined(MODULE_SOCK_DNS) || defined(MODULE_SOCK_DNS_MOCK)
|
||||||
/* hostname is not an IPv6 address */
|
/* hostname is not an IPv6 address */
|
||||||
if (strchr(hostname, ':') == NULL) {
|
if (strchr(hostname, ':') == NULL) {
|
||||||
int res = sock_dns_query(hostname, addr, AF_INET6);
|
int res = dns_query(hostname, addr, AF_INET6);
|
||||||
if (res < 0) {
|
if (res < 0) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -29,8 +29,8 @@
|
|||||||
#include "net/sock/udp.h"
|
#include "net/sock/udp.h"
|
||||||
#include "net/sock/util.h"
|
#include "net/sock/util.h"
|
||||||
|
|
||||||
#if defined(MODULE_SOCK_DNS) || defined(MODULE_SOCK_DNS_MOCK)
|
#if defined(MODULE_DNS)
|
||||||
#include "net/sock/dns.h"
|
#include "net/dns.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef MODULE_FMT
|
#ifdef MODULE_FMT
|
||||||
@ -306,7 +306,7 @@ int sock_tl_name2ep(struct _sock_tl_ep *ep_out, const char *str)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (sock_dns_query(host, &ep_out->addr, family)) {
|
switch (dns_query(host, &ep_out->addr, family)) {
|
||||||
#ifdef SOCK_HAS_IPV4
|
#ifdef SOCK_HAS_IPV4
|
||||||
case 4:
|
case 4:
|
||||||
ep_out->family = AF_INET;
|
ep_out->family = AF_INET;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user