Skip to content

TUN inbound: Log IPv6 setup errors (gateway, dns and autoSystemRoutingTable) instead of exiting on Windows when DisabledComponents turns IPv6 off, with autoSystemWfpBlockLeak's "misconfigtun" blocking IPv6 then - #7341

Merged
RPRX merged 6 commits into
mainfrom
windows-tun-ipv6-disabled
Nov 8, 2026

Conversation

@patterniha

@patterniha patterniha commented Nov 6, 2026 •

Copy link
Copy Markdown
Collaborator

Follow-up to #7332 (#7332 (comment)), reworked as in #7341 (comment).

With IPv6 turned off by DisabledComponents (0x10, the non-tunnel interfaces, the TUN among them; 0xFF includes it), IPv6 for gateway, dns and autoSystemRoutingTable is set up as usual, and errors doing so, clearing its DNS servers included, are only logged. Otherwise they exit, also for a config without IPv6 entries, which replaces the skips of #6874, #7325 and #7332.

"misconfigtun" then blocks IPv6 outside the TUN whatever the routes, because Windows applies DisabledComponents only after a reboot, and until then IPv6 still works. For this, "misconfigtun" acts as if autoSystemRoutingTable had no IPv6 routes, which gives the same filters as "[::/0]:all". A literal "[::/0]:all" isn't used, as Xray counts "all" as blocking DNS, which needs dns to be set, so a config without dns would no longer start.

The README now recommends at least "dns" and "misconfigtun" for autoSystemWfpBlockLeak (#7332 (comment)).

Tested on Windows 11 with Wintun 0.14.1, with the registry value and the IPv6 failures simulated in a test build. Before the reboot, routed IPv6 went through the TUN, and with "misconfigtun" other programs' IPv6 (TCP, UDP, ping) couldn't leave through Wi-Fi or through an IPv6 adapter added after the TUN started, while IPv4, IPv6 loopback and Xray's own IPv6 still worked. After the reboot (no IPv6 interface, or its DNS servers refused), the TUN starts at once with the errors logged. Without the registry value, the same failures exit. On a real system, with DisabledComponents set to 0x01 alone and a reboot, the TUN still gets its IPv6 address, route and DNS servers, so 0x10 is the bit that turns the TUN's IPv6 off. go test ./proxy/tun/ passes, run as administrator.

Docs: XTLS/Xray-docs-next#903

🤖 Generated with Claude Code

StarProxima and others added 3 commits November 6, 2026 18:45
… turns IPv6 off on all interfaces

#7332 (comment)

With IPv6 off on all interfaces by DisabledComponents (0x01 and 0x10 both
set, as in 0xFF), the IPv6 entries of gateway, dns and
autoSystemRoutingTable are ignored and the TUN starts with IPv4 only, so
one config works either way. The value takes effect at the next boot only,
so ignored IPv6 routes add "[::/0]:misconfigtun" to autoSystemWfpBlockLeak:
until the reboot, IPv6 the TUN would have taken cannot leave outside it,
also through interfaces connected later.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@RPRX

RPRX commented Nov 7, 2026

Copy link
Copy Markdown
Member

逻辑不太对,#7325 #7332 的逻辑全部推翻,改为

gateway、dns、autoSystemRoutingTable:若注册表...,则操作 IPv6 时遇到错误仅报错、不退出(包括清空/设置 dns)

autoSystemWfpBlockLeak "misconfigtun":若注册表...,则一定 block "[::/0]:all"(作为此 PR 之前它的逻辑的补充逻辑)

…onents` turns IPv6 off, with "misconfigtun" blocking IPv6 then

#7341 (comment)

IPv6 entries are no longer left out. With IPv6 turned off by
DisabledComponents (0x10, the non-tunnel interfaces, the TUN among them,
as in 0xFF), IPv6 is set up as usual, and errors doing so, clearing its
DNS servers included, are only logged; otherwise they exit, also for a
config without IPv6 entries, which replaces the skips of #6874, #7325 and
#7332. "misconfigtun" then blocks IPv6 outside the TUN whatever the routes,
as IPv6 still works until the reboot that applies the value.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
patterniha added a commit to patterniha/Xray-docs-next that referenced this pull request Nov 7, 2026
…onents` turns IPv6 off, with "misconfigtun" blocking IPv6 then

XTLS/Xray-core#7341 (comment)

IPv6 entries are no longer left out. With IPv6 turned off by
DisabledComponents (0x10, the non-tunnel interfaces, the TUN among them,
as in 0xFF), IPv6 is set up as usual, and errors doing so, clearing its
DNS servers included, are only logged; otherwise they exit, also for a
config without IPv6 entries, which replaces the skips of #6874, #7325 and
#7332. "misconfigtun" then blocks IPv6 outside the TUN whatever the routes,
as IPv6 still works until the reboot that applies the value.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@patterniha patterniha changed the title TUN inbound: Ignore IPv6 entries on Windows when DisabledComponents turns IPv6 off on all interfaces TUN inbound: Only log IPv6 setup errors on Windows when DisabledComponents turns IPv6 off, with "misconfigtun" blocking IPv6 then Nov 7, 2026
@patterniha

Copy link
Copy Markdown
Collaborator Author

逻辑不太对,#7325 #7332 的逻辑全部推翻,改为

gateway、dns、autoSystemRoutingTable:若注册表...,则操作 IPv6 时遇到错误仅报错、不退出(包括清空/设置 dns)

autoSystemWfpBlockLeak "misconfigtun":若注册表...,则一定 block "[::/0]:all"(作为此 PR 之前它的逻辑的补充逻辑)

OK, the code, README, docs, PR title and PR description are updated with the new logic.

…terface error on Windows

Like the other IPv6 steps, so that an ignored missing IPv6 interface no
longer logs as a bare "Element not found."

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@RPRX RPRX changed the title TUN inbound: Only log IPv6 setup errors on Windows when DisabledComponents turns IPv6 off, with "misconfigtun" blocking IPv6 then TUN inbound: Log IPv6 setup errors instead of exiting on Windows when DisabledComponents turns IPv6 off, with "misconfigtun" blocking IPv6 then Nov 8, 2026
@RPRX
RPRX merged commit b2cc206 into main Nov 8, 2026
46 checks passed
@RPRX RPRX changed the title TUN inbound: Log IPv6 setup errors instead of exiting on Windows when DisabledComponents turns IPv6 off, with "misconfigtun" blocking IPv6 then TUN inbound: Log IPv6 setup errors (gateway, dns and autoSystemRoutingTable) instead of exiting on Windows when DisabledComponents turns IPv6 off, with autoSystemWfpBlockLeak's "misconfigtun" blocking IPv6 then Nov 8, 2026
RPRX pushed a commit that referenced this pull request Nov 8, 2026
…outingTable`) instead of exiting on Windows when `DisabledComponents` turns IPv6 off, with `autoSystemWfpBlockLeak`'s "misconfigtun" blocking IPv6 then (#7341)

#7325 (comment)
#7332 (comment)
#7341 (comment)

Replaces #7332, #7325 and #6874

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
@RPRX
RPRX deleted the windows-tun-ipv6-disabled branch November 19, 2026 12:25
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.

3 participants