fix(node:dns): fix three bugs in dns lookup and resolver#6128
Merged
Conversation
- Fix IPv6 addresses returned with family:4 instead of family:6 in dns.lookup() with all:true and family:0 - Fix dns.lookup() with default family:0 only querying AAAA records, now queries both A and AAAA and returns based on dnsOrder - Fix Resolver.resolvePtr typo (was 'esolvePtr') in promises API
|
All contributors have signed the CLA ✍️ ✅ |
Member
Author
|
I have read the CLA Document and I hereby sign the CLA |
This comment was marked as outdated.
This comment was marked as outdated.
Collaborator
|
Ideally this would also include additional tests. |
Member
Author
|
Will add
…On Sat, Feb 21, 2026 at 9:09 AM James M Snell ***@***.***> wrote:
*jasnell* left a comment (cloudflare/workerd#6128)
<#6128 (comment)>
Ideally this would also include additional tests.
—
Reply to this email directly, view it on GitHub
<#6128 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAOJ7AP2SXS7TGLMSSNFBL4NB7LDAVCNFSM6AAAAACV3LBDUSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTSMZZGAZDIOJQGY>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
anonrig
approved these changes
Feb 21, 2026
Member
anonrig
left a comment
There was a problem hiding this comment.
thanks. we can merge after some regression tests.
- lookup all:true family:0 must return family:6 for IPv6 addresses - lookup default family:0 all:false must resolve IPv4-only hosts - Resolver.resolvePtr must exist (was typo 'esolvePtr')
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes three bugs in the
node:dnsimplementation:IPv6 family mismatch:
dns.lookup()withall: trueandfamily: 0returned IPv6 (AAAA) addresses withfamily: 4instead offamily: 6. Both the type annotation and runtime value were wrong — copy-paste from the IPv4 block above.Default lookup only queried AAAA:
dns.lookup()with defaultfamily: 0andall: falseusedfamily === 4 ? 'A' : 'AAAA', which fell through to AAAA-only queries. This meantdns.lookup('example.com', callback)would fail for IPv4-only hosts. Now queries both A and AAAA and returns the first result based ondnsOrder.Resolver.resolvePtrtypo: The promisesResolverclass hadesolvePtr(missing leadingr), makingresolver.resolvePtr()throw at runtime.*** AI CREATED ***