Skip to content

TUN inbound: IPv6 entries in dns exit the core on Windows when IPv6 cannot be set up, as in gateway and autoSystemRoutingTable - #7332

Merged
RPRX merged 1 commit into
mainfrom
windows-tun-dns-ipv6
Nov 6, 2026
Merged

RPRX merged 1 commit into
mainfrom
windows-tun-dns-ipv6

Conversation

@patterniha

Copy link
Copy Markdown
Collaborator

#7325 (comment)

An IPv6 server in dns now counts like IPv6 in gateway and autoSystemRoutingTable: when IPv6 can't be set up, the TUN doesn't start, instead of silently dropping that server.

…ows when IPv6 cannot be set up, as in `gateway` and `autoSystemRoutingTable`

Follow-up to #7325: an IPv6 server in dns now asks for IPv6 as well.
When the adapter has no IPv6 interface, or refuses its IPv6 DNS servers,
the TUN fails to start instead of starting without them. Without IPv6 in
any of the three, both are still skipped: the IPv6 DNS servers that Xray
sets on every start are none then.

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

RPRX commented Nov 4, 2026

Copy link
Copy Markdown
Member

这和回退到 #7325 之前的行为有什么区别?

@patterniha

patterniha commented Nov 4, 2026 •

Copy link
Copy Markdown
Collaborator Author

How is this different from reverting to the behavior prior to #7325 ?

Setting no IPv6 DNS in the dns list doesn't mean doing nothing for IPv6 DNS; it means clearing it.

So before #7325, on some systems with globally disabled IPv6 or where changing IPv6 settings is prohibited, we encountered an error when setting up the TUN, because Xray tried to clear IPv6 DNS that doesn't exist at all or that we don't have access to.

Now, with this PR, when users don't set IPv6 at all (in gateway, autoSystemRoutingTable or dns), we just ignore the error from clearing the IPv6 DNS. Otherwise we still return the error.

In #7325, we only looked at gateway and autoSystemRoutingTable, and if they had no IPv6, we ignored the error from setting the IPv6 DNS. The change relative to #7325: now, if users set IPv6 in the dns list, we don't ignore the error from setting the IPv6 DNS, even if gateway and autoSystemRoutingTable have no IPv6.

@RPRX

RPRX commented Nov 6, 2026

Copy link
Copy Markdown
Member

也就是说 TUN dns 若无 IPv6 则会尝试从 Wintun 虚拟网卡上清除它,若系统层面 disable 了 IPv6,在 #7325 之前会报错退出,但若 TUN dns 有 IPv6 且另外两项无 IPv6,设置它时遇到的错误也被 #7325 忽略了,如我所述不该搞特殊,这个 PR 改了

我会先合并这个 PR,但接着 #7325 (comment) 最后一行,我觉得同一份 TUN 配置不能通用的话有点麻烦,改成读取注册表?

@RPRX RPRX changed the title TUN inbound: IPv6 entries in dns keep the TUN from starting on Windows when IPv6 cannot be set up, as in gateway and autoSystemRoutingTable TUN inbound: IPv6 entries in dns exit the core on Windows when IPv6 cannot be set up, as in gateway and autoSystemRoutingTable Nov 6, 2026
@RPRX
RPRX merged commit 36756ad into main Nov 6, 2026
50 of 51 checks passed
@patterniha

patterniha commented Nov 6, 2026 •

Copy link
Copy Markdown
Collaborator Author

我会先合并这个 PR,但接着 #7325 (comment) 最后一行,我觉得同一份 TUN 配置不能通用的话有点麻烦,改成读取注册表?

the current solution was opus idea, but yes, we can look at registry to see IPv6 is disabled at the system level or not, if yes then we remove all ipv6 from settings (gateway, autoSystemRoutingTable, dns).

also we should add misconfigtun to autoSystemWfpBlockLeak to prevent leak from further changes and also because registry values may not be reliable because they only affects after reboot.

i ask opus to implement this idea in next PR ...

@RPRX

RPRX commented Nov 6, 2026

Copy link
Copy Markdown
Member

@patterniha 文档 XTLS/Xray-docs-next#903 可以改成“建议至少配置"dns"和"misconfigtun"”,v2rayN 一开始就是这样做的

@darabzadzahra-lang

Copy link
Copy Markdown

aetrher

patterniha added a commit that referenced this pull request Nov 6, 2026
patterniha added a commit to patterniha/Xray-docs-next that referenced this pull request Nov 6, 2026
patterniha added a commit that referenced this pull request Nov 7, 2026
…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]>
RPRX pushed a commit that referenced this pull request Nov 8, 2026
… `DisabledComponents` turns IPv6 off, with "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 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-dns-ipv6 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