Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 24, 2025

Summary of the Pull Request

Fixes Linux kernel dmesg warning: ip_local_port_range: prefer different parity for start/end values.

The kernel generates this warning when /proc/sys/net/ipv4/ip_local_port_range is set with both values having the same parity. The ephemeral range was configured as (10000, 20000) — both even.

Changes:

  • c_ephemeralPortRange: (10000, 20000)(10000, 20001) for different parity
  • CONTAINER_PORT_RANGE: (20000, 65535)(20002, 65535) to maintain non-overlapping ranges and satisfy static_assert(c_ephemeralPortRange.second < CONTAINER_PORT_RANGE.first)

PR Checklist

  • Communication: I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected
  • Tests: Added/updated if needed and all pass
  • Localization: All end user facing strings can be localized
  • Dev docs: Added/updated if needed
  • Documentation updated: If checked, please file a pull request on our docs repo and link it here: #xxx

Detailed Description of the Pull Request / Additional comments

The ephemeral port range is written to the kernel in WSLAInit.cpp:891-892:

WriteToFile("/proc/sys/net/ipv4/ip_local_port_range",
    std::format("{} {}", c_ephemeralPortRange.first, c_ephemeralPortRange.second).c_str())

With (10000, 20001), the kernel receives start=10000 (even), end=20001 (odd), eliminating the parity warning. The container port range adjustment ensures no port allocation overlap.

Validation Steps Performed

  • Code formatting validation passed
  • Static assertion verified: 20001 < 20002 evaluates to true
  • Code review and security scan completed with no issues

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits December 24, 2025 00:23
- Changed c_ephemeralPortRange from (10000, 20000) to (10000, 20001) to fix parity
  - 10000 is even, 20001 is odd - different parity eliminates dmesg warning
- Changed CONTAINER_PORT_RANGE from (20000, 65535) to (20002, 65535)
  - Ensures non-overlapping ranges and static_assert passes (20001 < 20002)
  - Reverts incorrect change from previous commit that set it to 20000

Co-authored-by: benhillis <17727402+benhillis@users.noreply.github.com>
Co-authored-by: benhillis <17727402+benhillis@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix default CONTAINER_PORT_RANGE to resolve dmesg warning Fix ephemeral port range parity to eliminate kernel warning Dec 24, 2025
Copilot AI requested a review from benhillis December 24, 2025 00:26
@benhillis benhillis marked this pull request as ready for review December 24, 2025 06:06
@benhillis benhillis requested a review from a team as a code owner December 24, 2025 06:06
@benhillis benhillis merged commit 51d9760 into user/benhill/wsla_port_range_parity Dec 24, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants