Skip to content

Commit

Permalink
sockets: drop AI_ADDRCONFIG from getaddrinfo calls
Browse files Browse the repository at this point in the history
This flag implementation is known to be troublesome:
https://fedoraproject.org/wiki/QA/Networking/NameResolution/ADDRCONFIG

Also, it would prevent users from explicitly requesting for IPv6
addresses on systems where *outbound* IPv6 is not available, which might
be a surprising behavior.

According to Fedora's documentation, glibc will sort the addresses so
that the best address is the first one, so this flag does not give us a
lot in terms of optimization there.
  • Loading branch information
alaviss committed Feb 14, 2024
1 parent 12c5957 commit 44de654
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
2 changes: 1 addition & 1 deletion src/sys/private/sockets_posix.nim
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ template ip4Resolve() {.dirty.} =

let hints = AddrInfo(
ai_family: AF_INET,
ai_flags: AI_NUMERICSERV or AI_ADDRCONFIG
ai_flags: AI_NUMERICSERV
)

let err = getaddrinfo(
Expand Down
1 change: 0 additions & 1 deletion src/sys/private/sockets_windows.nim
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ template ip4Resolve() {.dirty.} =
result = new ResolverResultImpl

let hints = AddrInfoW(
ai_flags: AI_ADDRCONFIG,
ai_family: AF_INET
)

Expand Down

0 comments on commit 44de654

Please sign in to comment.