From 9b5b2546200c15541bff38b9f22eb7682e68d70a Mon Sep 17 00:00:00 2001 From: Adam Strzelecki Date: Wed, 30 Sep 2015 12:20:56 +0200 Subject: rawsockets: Fix getaddrinfo on FreeBSD Currently due bug in FreeBSD passing AI_V4MAPPED to addrinfo.ai_flags causes getaddrinfo to fail with EAI_BADFLAGS ("Invalid value for ai_flags"). That's why we should disable this flag for now on FreeBSD. https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=198092 --- lib/pure/rawsockets.nim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/pure/rawsockets.nim b/lib/pure/rawsockets.nim index f5860ef28..2d7b0e5ea 100644 --- a/lib/pure/rawsockets.nim +++ b/lib/pure/rawsockets.nim @@ -201,7 +201,9 @@ proc getAddrInfo*(address: string, port: Port, domain: Domain = AF_INET, hints.ai_family = toInt(domain) hints.ai_socktype = toInt(sockType) hints.ai_protocol = toInt(protocol) - hints.ai_flags = AI_V4MAPPED + # https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=198092 + when not defined(freebsd): + hints.ai_flags = AI_V4MAPPED var gaiResult = getaddrinfo(address, $port, addr(hints), result) if gaiResult != 0'i32: when useWinVersion: -- cgit 1.4.1-2-gfad0