Fix name resolution
The ai_addr must be cast into sockaddr_in6 and the sin6_addr member must be passed to inet_ntop.
This commit is contained in:
parent
45ed3e085f
commit
98ddf1679b
@ -250,7 +250,9 @@ bool name_lookup(const std::string& host, std::string* addr_out, std::string* er
|
||||
{
|
||||
// getaddrinfo may return multiple result addresses. Only consider the first.
|
||||
char buf[INET6_ADDRSTRLEN];
|
||||
if (inet_ntop(AF_INET6, results->ai_addr, buf, sizeof(buf)))
|
||||
in6_addr* addr = &((sockaddr_in6*)results->ai_addr)->sin6_addr;
|
||||
|
||||
if (inet_ntop(AF_INET6, addr, buf, sizeof(buf)))
|
||||
{
|
||||
*addr_out = buf;
|
||||
success = true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user