This repository was archived by the owner on Apr 22, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -259,8 +259,9 @@ The following flags can be passed as hints to `dns.lookup`.
259259of addresses supported by the current system. For example, IPv4 addresses
260260are only returned if the current system has at least one IPv4 address
261261configured. Loopback addresses are not considered.
262- - ` dns.V4MAPPED ` : If the IPv6 family was specified, but no IPv6 addresses
263- were found, then return IPv4 mapped IPv6 addresses.
262+ - ` dns.V4MAPPED ` : If the IPv6 family was specified, but no IPv6 addresses were
263+ found, then return IPv4 mapped IPv6 addresses. Note that it is not supported
264+ on some operating systems (e.g FreeBSD 10.1).
264265
265266## Implementation considerations
266267
Original file line number Diff line number Diff line change @@ -917,8 +917,18 @@ Socket.prototype.connect = function(options, cb) {
917917 throw new RangeError ( 'port should be >= 0 and < 65536: ' +
918918 options . port ) ;
919919
920- if ( dnsopts . family !== 4 && dnsopts . family !== 6 )
921- dnsopts . hints = dns . ADDRCONFIG | dns . V4MAPPED ;
920+ if ( dnsopts . family !== 4 && dnsopts . family !== 6 ) {
921+ dnsopts . hints = dns . ADDRCONFIG ;
922+ // The AI_V4MAPPED hint is not supported on FreeBSD, and getaddrinfo
923+ // returns EAI_BADFLAGS. However, it seems to be supported on most other
924+ // systems. See
925+ // http://lists.freebsd.org/pipermail/freebsd-bugs/2008-February/028260.html
926+ // and
927+ // https://svnweb.freebsd.org/base/head/lib/libc/net/getaddrinfo.c?r1=172052&r2=175955
928+ // for more information on the lack of support for FreeBSD.
929+ if ( process . platform !== 'freebsd' )
930+ dnsopts . hints |= dns . V4MAPPED ;
931+ }
922932
923933 debug ( 'connect: find host ' + host ) ;
924934 debug ( 'connect: dns options ' + dnsopts ) ;
You can’t perform that action at this time.
0 commit comments