File tree 2 files changed +13
-4
lines changed
2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -267,8 +267,9 @@ The following flags can be passed as hints to `dns.lookup`.
267
267
of addresses supported by the current system. For example, IPv4 addresses
268
268
are only returned if the current system has at least one IPv4 address
269
269
configured. Loopback addresses are not considered.
270
- - ` dns.V4MAPPED ` : If the IPv6 family was specified, but no IPv6 addresses
271
- were found, then return IPv4 mapped IPv6 addresses.
270
+ - ` dns.V4MAPPED ` : If the IPv6 family was specified, but no IPv6 addresses were
271
+ found, then return IPv4 mapped IPv6 addresses. Note that it is not supported
272
+ on some operating systems (e.g FreeBSD 10.1).
272
273
273
274
## Implementation considerations
274
275
Original file line number Diff line number Diff line change @@ -940,8 +940,16 @@ function lookupAndConnect(self, options) {
940
940
hints : 0
941
941
} ;
942
942
943
- if ( dnsopts . family !== 4 && dnsopts . family !== 6 )
944
- dnsopts . hints = dns . ADDRCONFIG | dns . V4MAPPED ;
943
+ if ( dnsopts . family !== 4 && dnsopts . family !== 6 ) {
944
+ dnsopts . hints = dns . ADDRCONFIG ;
945
+ // The AI_V4MAPPED hint is not supported on FreeBSD, and getaddrinfo
946
+ // returns EAI_BADFLAGS. However, it seems to be supported on most other
947
+ // systems. See
948
+ // http://lists.freebsd.org/pipermail/freebsd-bugs/2008-February/028260.html
949
+ // for more information on the lack of support for FreeBSD.
950
+ if ( process . platform !== 'freebsd' )
951
+ dnsopts . hints |= dns . V4MAPPED ;
952
+ }
945
953
946
954
debug ( 'connect: find host ' + host ) ;
947
955
debug ( 'connect: dns options' , dnsopts ) ;
You can’t perform that action at this time.
0 commit comments