dns_recv_response: Fix IPv6 address in an ninfo()

This commit is contained in:
YAMAMOTO Takashi 2021-06-17 14:34:04 +09:00 committed by Xiang Xiao
parent 8f59054ef2
commit 4666b39f9c

View File

@ -518,10 +518,14 @@ static int dns_recv_response(int sd, FAR union dns_addr_u *addr, int naddr,
nameptr += 10 + 16;
ninfo("IPv6 address: %04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n",
ntohs(ans->u.ipv6.s6_addr[7]), ntohs(ans->u.ipv6.s6_addr[6]),
ntohs(ans->u.ipv6.s6_addr[5]), ntohs(ans->u.ipv6.s6_addr[4]),
ntohs(ans->u.ipv6.s6_addr[3]), ntohs(ans->u.ipv6.s6_addr[2]),
ntohs(ans->u.ipv6.s6_addr[1]), ntohs(*ans->u.ipv6.s6_addr));
ntohs(ans->u.ipv6.s6_addr16[0]),
ntohs(ans->u.ipv6.s6_addr16[1]),
ntohs(ans->u.ipv6.s6_addr16[2]),
ntohs(ans->u.ipv6.s6_addr16[3]),
ntohs(ans->u.ipv6.s6_addr16[4]),
ntohs(ans->u.ipv6.s6_addr16[5]),
ntohs(ans->u.ipv6.s6_addr16[6]),
ntohs(ans->u.ipv6.s6_addr16[7]));
inaddr = &addr[naddr_read].ipv6;
inaddr->sin6_family = AF_INET6;