mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-15 09:33:50 +01:00
sys/dns: select appropriate address family if AF_UNSPEC
This commit is contained in:
parent
eea954cc22
commit
5986d8f371
@ -74,6 +74,15 @@ static inline int dns_query(const char *domain_name, void *addr_out, int family)
|
|||||||
{
|
{
|
||||||
int res = -ENOTSUP;
|
int res = -ENOTSUP;
|
||||||
|
|
||||||
|
if (family == AF_UNSPEC) {
|
||||||
|
if (!IS_USED(MODULE_IPV4_ADDR)) {
|
||||||
|
family = AF_INET6;
|
||||||
|
}
|
||||||
|
else if (!IS_USED(MODULE_IPV6_ADDR)) {
|
||||||
|
family = AF_INET;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (res <= 0 && IS_USED(MODULE_GCOAP_DNS)) {
|
if (res <= 0 && IS_USED(MODULE_GCOAP_DNS)) {
|
||||||
res = gcoap_dns_query(domain_name, addr_out, family);
|
res = gcoap_dns_query(domain_name, addr_out, family);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user