Fix(DNS): Handle EAI_NODATA as success (empty address list) in getaddrinfo#649
Fix(DNS): Handle EAI_NODATA as success (empty address list) in getaddrinfo#649djs55 merged 1 commit intomoby:masterfrom
Conversation
Co-authored-by: Joan Bruguera Micó <joanbrugueram@gmail.com>
|
Looks like something changed that broke the dep solver in the build stage of I'm guessing the package upgrades are unintentional but a side effect of opam-repository updating something.
and it used However this PR's run failed. The commit used was:
and it failed to solve as, amongst other problems, |
|
I think the CI failures are a separate issue. I did a test build locally with @keigoi thanks for the detailed explanation and patch. It looks safe so I'll merge it and we can try to fix the CI separately. |
This pull request addresses a long-standing issue where DNS lookups within containers, especially those running in rootless Docker-in-Docker (DIND) environments using VPNKit, would fail with an
NXDOMAINerror.This often occurred even when valid IP addresses were present in the DNS response, or for specific record types like SRV records.
Problem:
DNS Lookup Errors in Rootless DIND
dind-rootlessmode, DNS lookups would fail withNXDOMAIN.apk addinalpinecontainers would fail due to these DNS errors.NXDOMAIN for SRV Records
NXDOMAINfor SRV record queries, unlikeslirp4netnswhich handled them correctly (VPNKit DNS server returns NXDOMAIN for SRV records #509).The core of the issue stemmed from VPNKit treating the
EAI_NODATAerror code fromgetaddrinfoas a fatal failure.EAI_NODATAindicates that the name exists, but there are no addresses of the requested type (e.g., no AAAA records if IPv6 is filtered out, or no SRV records for a specific query).Solution:
This pull request modifies VPNKit's DNS handling to interpret
EAI_NODATAas a successful result, specifically as an empty address list. By doing so, DNS lookups can complete successfully even when an upstream DNS server returns an empty list for a particular query type.Expected Outcome:
rootless DINDcontainers using VPNKit will now work as expected, even when upstream DNS servers strip IPv6 addresses.NXDOMAINwhen the name exists but no SRV records are found, allowing for proper resolution or indicating an empty SRV record list.Notes
Acknowledgments
Special thanks to @joanbm, who is explicitly listed as a co-author on this commit (the fullname and email address is retrieved from their own public repo).
A special thanks to Tomoya Kawaguchi (@yamoyamoto) for their invaluable help in debugging this issue. Tomoya added debug logs to narrow down the problem and confirmed that nslookup no longer returned NXDOMAIN within the Alpine images in the DIND environment.