Skip to content

net: fallback to IPv6-only when dual-stack bind fails - #65669

Open
suii2210 wants to merge 1 commit into
nodejs:mainfrom
suii2210:fix-ipv6-only-bind
Open

net: fallback to IPv6-only when dual-stack bind fails#65669
suii2210 wants to merge 1 commit into
nodejs:mainfrom
suii2210:fix-ipv6-only-bind

Conversation

@suii2210

Copy link
Copy Markdown

Summary

When IPv4 is unavailable, Node.js may fail while creating the default IPv6 dual-stack listening socket. Setting IPV6_V6ONLY=0 can return EAFNOSUPPORT, after which the existing code falls back to IPv4, which is also unavailable.

This change retries the IPv6 bind with UV_TCP_IPV6ONLY enabled before falling back to IPv4.

Tests

  • Added test/sequential/test-net-server-listen-ipv6-only-system.js
  • tools/test.py test/sequential/test-net-server-listen-ipv6-only-system.js
  • make lint

Refs: #65400

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/net

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. net Issues and PRs related to the net subsystem. labels Aug 30, 2026
@suii2210
suii2210 force-pushed the fix-ipv6-only-bind branch 3 times, most recently from 434e58f to feaf676 Compare August 30, 2026 17:09
@MikeMcC399

Copy link
Copy Markdown
Contributor

Please make sure you have read and understood the following documents:

The advice in the above documents says that you may use the Slack channel if your PR is not getting attention. That means you should be patient and wait. Posting to Slack 20 minutes after opening your PR is too fast by a long way.

Signed-off-by: suii2210 <work8758@gmail.com>
@suii2210
suii2210 force-pushed the fix-ipv6-only-bind branch from feaf676 to 4d6af84 Compare August 30, 2026 17:25
@suii2210

Copy link
Copy Markdown
Author

Please make sure you have read and understood the following documents:

The advice in the above documents says that you may use the Slack channel if your PR is not getting attention. That means you should be patient and wait. Posting to Slack 20 minutes after opening your PR is too fast by a long way.

I’m really sorry for the inconvenience 🥺. I’ll be more patient from now on and will make sure I don’t repeat this mistake again.

@codecov

codecov Bot commented Aug 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.04%. Comparing base (7aaf9b4) to head (4d6af84).
⚠️ Report is 83 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #65669      +/-   ##
==========================================
- Coverage   90.13%   90.04%   -0.10%     
==========================================
  Files         751      754       +3     
  Lines      253639   255761    +2122     
  Branches    47790    48328     +538     
==========================================
+ Hits       228618   230293    +1675     
- Misses      16264    16590     +326     
- Partials     8757     8878     +121     
Files with missing lines Coverage Δ
lib/net.js 94.58% <100.00%> (+0.02%) ⬆️

... and 98 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ci PRs that need a full CI run. net Issues and PRs related to the net subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants