Skip to content

Handle offlink default gateways in GNS - #41130

Merged
Ben Hillis (benhillis) merged 1 commit into
microsoft:masterfrom
benhillis:user/benhill/fix-wslc-vpn-offlink-gateway
Jul 23, 2026
Merged

Handle offlink default gateways in GNS#41130
Ben Hillis (benhillis) merged 1 commit into
microsoft:masterfrom
benhillis:user/benhill/fix-wslc-vpn-offlink-gateway

Conversation

@benhillis

Copy link
Copy Markdown
Member

Summary

WSLC session startup can fail with E_UNEXPECTED when a VPN exposes its interface as a /32 and provides a non-link-local gateway outside that prefix. Mark host-supplied default gateways as on-link so the Linux kernel accepts the route through the specified interface.

Fixes #41082

Root cause

The issue trace shows the guest receiving 100.96.5.160/32 followed by default via 100.96.5.161. The kernel rejects the default route with ENETUNREACH because the gateway is outside the interface prefix. The earlier fix in #41003 only covered link-local gateways, while Cloudflare WARP and Tailscale use non-link-local gateways.

Testing

  • Full x64 Debug build
  • NetworkTests::AddDefaultRouteWithOfflinkGateway
  • NetworkTests::RemoveAndAddDefaultRoute

Copilot-Session: a404d085-142f-448f-b7fa-7ccc6528e844
Copilot AI review requested due to automatic review settings July 21, 2026 18:59
@benhillis
Ben Hillis (benhillis) requested a review from a team as a code owner July 21, 2026 18:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses a WSLC startup failure (E_UNEXPECTED) caused by Linux rejecting a host-supplied default route when the guest interface is configured as a /32 and the provided gateway is outside that prefix (common with certain VPNs). The fix ensures host-provided default gateways are treated as on-link so the kernel accepts the route through the specified interface.

Changes:

  • Mark default routes with an explicit gateway as RTNH_F_ONLINK in the netlink route message so Linux accepts “off-prefix” gateways.
  • Add a Windows networking test case that reproduces the /32 + offlink gateway scenario (e.g., 100.96.5.160/32 with default via 100.96.5.161).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/linux/netlinkutil/RoutingTable.cpp Extends RTNH_F_ONLINK behavior to cover host-supplied default gateways (not just link-local gateways).
test/windows/NetworkTests.cpp Adds a regression test for adding a default route via an off-prefix (offlink) gateway with a /32 interface address.

@benhillis
Ben Hillis (benhillis) merged commit 4b1eeb8 into microsoft:master Jul 23, 2026
9 checks 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.

wslc - Catastrophic failure - Error code: E_UNEXPECTED

3 participants