From ad98ffd42babc9e740a388e6734632fa33e88a05 Mon Sep 17 00:00:00 2001 From: Lyu Bingrong <129352855+YOIMIYA66@users.noreply.github.com> Date: Wed, 4 Nov 2026 02:20:31 -0800 Subject: [PATCH] TUN inbound: Ignore `dns` IPv6 setup error when neither `gateway` nor `autoSystemRoutingTable` has an IPv6 entry on Windows (#7325) https://github.com/XTLS/Xray-core/pull/7325#issuecomment-6619158295 --------- Co-authored-by: patterniha <71074308+patterniha@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 --- proxy/tun/tun_windows.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/proxy/tun/tun_windows.go b/proxy/tun/tun_windows.go index e84ebbb65..81fc149e1 100644 --- a/proxy/tun/tun_windows.go +++ b/proxy/tun/tun_windows.go @@ -201,6 +201,12 @@ startOver: } err = t.luid.SetDNS(family, dns, nil) if err != nil { + // Skip IPv6 the config does not ask for also when setting its DNS + // servers fails, as reported on Windows 11 24H2 with IPv6 disabled + // (Access is denied). + if family == windows.AF_INET6 && !address6 && !route6 { + continue + } firstErr = errors.New("unable to set DNS").Base(err) if err == windows.ERROR_NOT_FOUND { goto startOver