mirror of
https://github.com/XTLS/Xray-core.git
synced 2026-10-02 22:06:39 +00:00
TUN inbound: Add autoSystemWfpBlockLeak on Windows (blocks "dns" and "misconfigtun" IPv4/IPv6 traffic leaks outside the TUN); Rename autoSystemDNS to autoSystemDnsToGateway on Linux (and change some behaviors) (#6853)
https://github.com/XTLS/Xray-core/pull/6853#issuecomment-5899791359 https://github.com/XTLS/Xray-core/pull/6853#issuecomment-5901287980 https://github.com/XTLS/Xray-core/pull/6853#issuecomment-5903680113 https://github.com/XTLS/Xray-core/pull/6853#issuecomment-5904123488 https://github.com/XTLS/Xray-core/pull/6853#issuecomment-5904647772 https://github.com/XTLS/Xray-core/pull/6853#issuecomment-5905047424 Fixes https://github.com/XTLS/Xray-core/issues/6454#issuecomment-5863800676 --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
committed by
RPRX
co-authored by
Claude Opus 5.5
parent
0086362663
commit
1f304916bd
@@ -58,9 +58,9 @@ func recorder(t *testing.T, failOn string) *[][]string {
|
||||
func optedInTun() *LinuxTun {
|
||||
return &LinuxTun{
|
||||
options: &Config{
|
||||
Name: "xray_tun",
|
||||
Gateway: []string{"192.168.100.1/30"},
|
||||
AutoSystemDns: true,
|
||||
Name: "xray_tun",
|
||||
Gateway: []string{"192.168.100.1/30"},
|
||||
AutoSystemDnsToGateway: true,
|
||||
},
|
||||
tunLink: testLink("xray_tun"),
|
||||
}
|
||||
@@ -79,7 +79,7 @@ func TestConfigureSystemDNSDisabledByDefault(t *testing.T) {
|
||||
calls := recorder(t, "")
|
||||
|
||||
t1 := optedInTun()
|
||||
t1.options.AutoSystemDns = false
|
||||
t1.options.AutoSystemDnsToGateway = false
|
||||
|
||||
if err := t1.ConfigureSystemDNS(context.Background(), "tun"); err != nil {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
@@ -103,7 +103,7 @@ func TestConfigureSystemDNSNoGateway(t *testing.T) {
|
||||
t1.options.Gateway = nil
|
||||
|
||||
if err := t1.ConfigureSystemDNS(context.Background(), "tun"); err == nil {
|
||||
t.Fatal("expected an error when no IPv4 gateway is configured")
|
||||
t.Fatal("expected an error when no gateway is configured")
|
||||
}
|
||||
if len(*probes) != 0 {
|
||||
t.Errorf("routing probe must not run without a gateway, got %d calls", len(*probes))
|
||||
@@ -351,9 +351,18 @@ func TestSystemDNSAddrs(t *testing.T) {
|
||||
wantOK: false,
|
||||
},
|
||||
{
|
||||
name: "ipv6 only",
|
||||
gateway: []string{"fc00::1/64"},
|
||||
wantOK: false,
|
||||
name: "ipv6 only",
|
||||
gateway: []string{"fc00::1/64"},
|
||||
wantSource: "fc00::1",
|
||||
wantDNS: "fc00::2",
|
||||
wantOK: true,
|
||||
},
|
||||
{
|
||||
name: "first ipv6 without ipv4",
|
||||
gateway: []string{"fc00::1/64", "fd00::1/64"},
|
||||
wantSource: "fc00::1",
|
||||
wantDNS: "fc00::2",
|
||||
wantOK: true,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user