This repository was archived by the owner on Apr 22, 2023. It is now read-only.
Commit 1d47b40 Julien Gilli
committed
1 parent f99eaef commit 1d47b40 Copy full SHA for 1d47b40
File tree 2 files changed +15
-4
lines changed
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`.
259
259
of addresses supported by the current system. For example, IPv4 addresses
260
260
are only returned if the current system has at least one IPv4 address
261
261
configured. 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).
264
265
265
266
## Implementation considerations
266
267
Original file line number Diff line number Diff line change @@ -917,8 +917,18 @@ Socket.prototype.connect = function(options, cb) {
917
917
throw new RangeError ( 'port should be >= 0 and < 65536: ' +
918
918
options . port ) ;
919
919
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
+ }
922
932
923
933
debug ( 'connect: find host ' + host ) ;
924
934
debug ( 'connect: dns options ' + dnsopts ) ;
You can’t perform that action at this time.
0 commit comments