Repository navigation
TUN inbound: Ignore dns IPv6 setup error when neither gateway nor autoSystemRoutingTable has an IPv6 entry on Windows - #7325
Conversation
…not be set Instead of the checks of the previous commit, IPv6 that neither gateway nor autoSystemRoutingTable has is skipped when setting its DNS servers fails, as when the adapter has no IPv6 interface. Everything else is set up as before. Skipping SetDNS for an IP version without an address in gateway left dns unapplied without gateway, where Windows gives the TUN link-local addresses, and winipcfg's SetDNS already keeps only the servers of the IP version given. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
I pushed a simpler fix: if neither |
|
Thanks for the simpler fix — I agree with it completely, and it is clearly better than what I submitted. The part I find most elegant is that it does not try to predict the interface state at all. My version skipped I learned a lot from this: fix at the point where it actually fails, use the narrowest condition, and do not re-implement what the called library already guarantees. Thank you for taking the time to push a cleaner patch instead of just asking me to redo it. I would love to keep learning from your reviews and changes in this repo. |
dns IPv6 setup error when neither gateway nor autoSystemRoutingTable has an IPv6 entry on Windows
|
@patterniha 更新文档 XTLS/Xray-docs-next#903 虽然这么改跟 况且 再说如果 IPv6 被系统级 disable 了,
|
|
|
Xray sets the TUN's IPv6 DNS on every start, and just clears it when But you're right that |
… cannot be set up, as in `gateway` and `autoSystemRoutingTable` (#7332) #7325 (comment) #7332 (comment) #7332 (comment) --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
…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]>
… `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]>
…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]>
Problem Description
On Windows 11 24H2 (OS Build 26100+), starting Xray in native TUN mode fails with:
Root Cause Analysis
DisabledComponents = 0x28.t.luid.IPInterface(windows.AF_INET6)returnsnilinstead ofwindows.ERROR_NOT_FOUND.t.luid.SetDNS(windows.AF_INET6, dns, nil), which invokesSetInterfaceDnsSettingswithDNS_INTERFACE_SETTINGS_VERSION1andDNS_SETTING_IPV6.ERROR_ACCESS_DENIED) because the Wintun interface possesses no unicast IPv6 address (unicastAddressesis empty).Changes in this PR
addressnorrouteis present, safely skipIPInterfaceandSetDNS.SetDNS()on families without assigned unicast IP addresses, which prevents Win32 Error 5.familyDNS. If an addressed family is provided with an empty DNS list, it still passes the empty slice toSetDNS()to clear existing DNS servers, maintaining proper DNS lifecycle semantics.Test Verification
Tested on Windows 11 24H2 (Build 26100.2161) with Wintun 0.14.1 across 6 scenarios:
Access is denied.::/0): Sets IPv4 DNS while skipping IPv6SetDNSon unaddressed IPv6 interface.