summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJulien Gilli <julien.gilli@joyent.com>2015-03-02 15:50:25 -0800
committerRod Vagg <rod@vagg.org>2015-08-04 11:56:10 -0700
commit9bc2e2672094fe4f3e4c8b00fabce8a8811bc7be (patch)
treebce3f6614e98741fa499733870bfe9f5b723461c /lib
parentdf1994fe53754bd0a191239a704c6a656f210392 (diff)
downloadandroid-node-v8-9bc2e2672094fe4f3e4c8b00fabce8a8811bc7be.tar.gz
android-node-v8-9bc2e2672094fe4f3e4c8b00fabce8a8811bc7be.tar.bz2
android-node-v8-9bc2e2672094fe4f3e4c8b00fabce8a8811bc7be.zip
net: do not set V4MAPPED on FreeBSD
V4MAPPED is not supported on recent FreeBSD versions, at least on 10.1. Thus, do not set this flag in net.connect on FreeBSD. Fixes: https://github.com/joyent/node/issues/8540 Fixes: https://github.com/joyent/node/issues/9204 PR-URL: https://github.com/joyent/node/pull/18204 PR-URL: https://github.com/iojs/io.js/pull/1555 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Fedor Indutny <fedor@indutny.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Diffstat (limited to 'lib')
-rw-r--r--lib/net.js12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/net.js b/lib/net.js
index c144caaf7d..6146029d3c 100644
--- a/lib/net.js
+++ b/lib/net.js
@@ -941,8 +941,16 @@ function lookupAndConnect(self, options) {
hints: 0
};
- if (dnsopts.family !== 4 && dnsopts.family !== 6)
- dnsopts.hints = dns.ADDRCONFIG | dns.V4MAPPED;
+ if (dnsopts.family !== 4 && dnsopts.family !== 6) {
+ dnsopts.hints = dns.ADDRCONFIG;
+ // The AI_V4MAPPED hint is not supported on FreeBSD, and getaddrinfo
+ // returns EAI_BADFLAGS. However, it seems to be supported on most other
+ // systems. See
+ // http://lists.freebsd.org/pipermail/freebsd-bugs/2008-February/028260.html
+ // for more information on the lack of support for FreeBSD.
+ if (process.platform !== 'freebsd')
+ dnsopts.hints |= dns.V4MAPPED;
+ }
debug('connect: find host ' + host);
debug('connect: dns options', dnsopts);