Add IPv6 support for hostnames and literal addresses.
Description of the Change
Call getaddrinfo to parse and resolve an internet address before creating the socket. Try in a loop until one address succeeds.
For backwards compatibility, prefer ipv4 addresses: ipv4-only agent should still work even if hostname (e.g. localhost) resolves to both ipv4 and ipv6 address and ipv6 is preferred by the OS. This also matches behavior of Golang.
Alternate Designs
Possible Drawbacks
Address order specified in gai.conf is ignored, which may lead to inconsistencies with other applications.
Verification Process
Additional Notes
Release Notes
Review checklist (to be filled by reviewers)
[ ] Feature or bug fix MUST have appropriate tests (unit, integration, etc...)
[ ] PR title must be written as a CHANGELOG entry (see why)
[ ] Files changes must correspond to the primary purpose of the PR as described in the title (small unrelated changes should have their own PR)
[ ] PR must have one changelog/ label attached. If applicable it should have the backward-incompatible label attached.
[ ] PR should not have do-not-merge/ label attached.
[ ] If Applicable, issue must have kind/ and severity/ labels attached at least.
What does this PR do?
Add IPv6 support for hostnames and literal addresses.
Description of the Change
Call
getaddrinfo
to parse and resolve an internet address before creating the socket. Try in a loop until one address succeeds.For backwards compatibility, prefer ipv4 addresses: ipv4-only agent should still work even if hostname (e.g.
localhost
) resolves to both ipv4 and ipv6 address and ipv6 is preferred by the OS. This also matches behavior of Golang.Alternate Designs
Possible Drawbacks
Address order specified in
gai.conf
is ignored, which may lead to inconsistencies with other applications.Verification Process
Additional Notes
Release Notes
Review checklist (to be filled by reviewers)
changelog/
label attached. If applicable it should have thebackward-incompatible
label attached.do-not-merge/
label attached.kind/
andseverity/
labels attached at least.