Skip to content

Fix windows DNS server resolution#62938

Closed
greguintow wants to merge 1 commit intonodejs:mainfrom
greguintow:fix-windows-dns-server-resolution
Closed

Fix windows DNS server resolution#62938
greguintow wants to merge 1 commit intonodejs:mainfrom
greguintow:fix-windows-dns-server-resolution

Conversation

@greguintow
Copy link
Copy Markdown

Summary

This PR addresses a Windows DNS regression observed after the c-ares update in the following nodejs versions:

  • Node.js >= 20.20.0
  • Node.js >= 22.22.0
  • Node.js >= 24.13.0
  • Node.js >= 25.3.0

Where I first realized when trying to connect to MongoDB atlas through VPN in Windows failed.

  • Restore Windows DNS resolver server ordering parity with the previous version for this setup:
    • before fix (regressed): ['127.0.0.1']
    • after fix: ['::ffff:127.0.2.2', '::ffff:127.0.2.3', '127.0.2.2', '127.0.2.3']
  • Keep discovered DNS servers even if Windows suffix parsing fails, preventing
    fallback to loopback-only resolver configuration
  • Windows DNS discovery behavior in get_DNS_Windows() (e.g. GetNetworkParams,
    ordering) as needed for this setup

I believe it was regressed after the c-ares update to v1.34.6:

Testing

Windows validation performed with:

./vcbuild.bat release openssl-no-asm
./Release/node.exe -e "console.log(require('node:dns').getServers())"

Observed results:

  • dns.getServers() now returns:
    ['::ffff:127.0.2.2', '::ffff:127.0.2.3', '127.0.2.2', '127.0.2.3'] just like was before the regression
  • Successfully connects to MongoDB Atlas through VPN with mongodb+srv://

It could also be tested with switching between 24.12 to 24.13 and observing the DNS servers.

Notes

Ideally, the fix would be backdated for all the affected versions (v20, v22, v24, v25)

Thank you for your time and consideration on looking into this 🙏.

@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/net
  • @nodejs/security-wg

@nodejs-github-bot nodejs-github-bot added cares Issues and PRs related to the c-ares dependency or the cares_wrap binding. dependencies Pull requests that update a dependency file. needs-ci PRs that need a full CI run. labels Apr 24, 2026
@ProKashif
Copy link
Copy Markdown

Good job

@MrMuhammadAbdullah1704
Copy link
Copy Markdown

Its definitly going to help me bypass this annoying issue. Would love to see it merged

@greguintow
Copy link
Copy Markdown
Author

@anonrig could you help review this PR please if you have the chance?

@greguintow
Copy link
Copy Markdown
Author

@anonrig
Copy link
Copy Markdown
Member

anonrig commented Apr 29, 2026

@anonrig could you help review this PR please if you have the chance?

Please add a test.

@anonrig
Copy link
Copy Markdown
Member

anonrig commented Apr 29, 2026

Also this change needs to be upstreamed. You're updating deps/cares folder which will get overwritten whenever we update cares.

@greguintow
Copy link
Copy Markdown
Author

greguintow commented Apr 30, 2026

Also this change needs to be upstreamed. You're updating deps/cares folder which will get overwritten whenever we update cares.

Hey @anonrig , thanks for the direction on this! It seems like it was already fixed on c-ares end 2 weeks ago, asked them here if there any soon plans to release, once it's released, I believe nodejs bot would raise a PR updating the lib shortly after.

I believe this PR won't be needed in this case, closing it for now.

Thanks for everything!

@greguintow greguintow closed this Apr 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cares Issues and PRs related to the c-ares dependency or the cares_wrap binding. dependencies Pull requests that update a dependency file. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants