From 20ca866271027b549edcd612b994d42b4b6f04a5 Mon Sep 17 00:00:00 2001 From: Fedor Indutny Date: Tue, 13 Jan 2015 16:16:15 +0300 Subject: [PATCH] dns: remove AI_V4MAPPED hint flag on FreeBSD FreeBSD does not support V4MAPPED. PR-URL: https://github.com/iojs/io.js/pull/332 Reviewed-By: Ben Noordhuis --- lib/dns.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/dns.js b/lib/dns.js index 18023fab162..1afc07c99d2 100644 --- a/lib/dns.js +++ b/lib/dns.js @@ -125,6 +125,11 @@ exports.lookup = function lookup(hostname, options, callback) { hints !== (exports.ADDRCONFIG | exports.V4MAPPED)) { throw new TypeError('invalid argument: hints must use valid flags'); } + + // FIXME(indutny): V4MAPPED on FreeBSD results in EAI_BADFLAGS, because + // the libc does not support it + if (process.platform === 'freebsd' && family !== 6) + hints &= ~exports.V4MAPPED; } else { family = options >>> 0; }