Commit 8486a281 authored by Dominik Charousset's avatar Dominik Charousset Committed by Dominik Charousset

Enable IPv4 mapping rather then exluding OpenBSD

Listing each OS that hasn't AI_V4MAPPED defined is both verbose and
brittle. Simply checking whether AI_V4MAPPED exists before attempting to
use it always works, regardless of the OS.
parent 620ffc0b
...@@ -288,7 +288,7 @@ bool interfaces::get_endpoint(const std::string& host, uint16_t port, ...@@ -288,7 +288,7 @@ bool interfaces::get_endpoint(const std::string& host, uint16_t port,
hint.ai_socktype = SOCK_DGRAM; hint.ai_socktype = SOCK_DGRAM;
if (preferred) if (preferred)
hint.ai_family = *preferred == protocol::network::ipv4 ? AF_INET : AF_INET6; hint.ai_family = *preferred == protocol::network::ipv4 ? AF_INET : AF_INET6;
#ifndef __OpenBSD__ #ifdef AI_V4MAPPED
if (hint.ai_family == AF_INET6) if (hint.ai_family == AF_INET6)
hint.ai_flags = AI_V4MAPPED; hint.ai_flags = AI_V4MAPPED;
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment