From 33f9a5329a9259bc361f925a09633674878650be Mon Sep 17 00:00:00 2001 From: Rob Murray Date: Mon, 13 May 2024 11:11:20 +0100 Subject: [PATCH] Default to "windows-dns-proxy":true In 26.1, we added daemon feature flag "windows-dns-proxy" which could be set to "true" to make "nslookup" work in Windows containers, by forwarding requests from the internal resolver to the container's external DNS servers. This changes the default to forwarding-enabled - it can be disabled by via daemon.json using ... "features": { "windows-dns-proxy": false } Signed-off-by: Rob Murray --- daemon/container_operations_windows.go | 8 ++++---- integration/networking/resolvconf_test.go | 7 ++----- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/daemon/container_operations_windows.go b/daemon/container_operations_windows.go index 0e7b51167b019..54097953cc2fe 100644 --- a/daemon/container_operations_windows.go +++ b/daemon/container_operations_windows.go @@ -164,10 +164,10 @@ func serviceDiscoveryOnDefaultNetwork() bool { } func buildSandboxPlatformOptions(container *container.Container, cfg *config.Config, sboxOptions *[]libnetwork.SandboxOption) error { - // By default, the Windows internal resolver does not forward requests to - // external resolvers - but forwarding can be enabled using feature flag - // "windows-dns-proxy":true. - if doproxy, exists := cfg.Features["windows-dns-proxy"]; !exists || !doproxy { + // By default, the Windows internal resolver forwards requests to external + // resolvers - but forwarding can be disabled using feature flag + // "windows-dns-proxy":false. + if doproxy, exists := cfg.Features["windows-dns-proxy"]; exists && !doproxy { *sboxOptions = append(*sboxOptions, libnetwork.OptionDNSNoProxy()) } return nil diff --git a/integration/networking/resolvconf_test.go b/integration/networking/resolvconf_test.go index ad89954b55afa..bc707d6b0682e 100644 --- a/integration/networking/resolvconf_test.go +++ b/integration/networking/resolvconf_test.go @@ -150,10 +150,7 @@ func TestNslookupWindows(t *testing.T) { defer c.ContainerRemove(ctx, res.ContainerID, containertypes.RemoveOptions{Force: true}) assert.Check(t, is.Equal(res.ExitCode, 0)) - // Current default is to not-forward requests to external servers, which + // Current default is to forward requests to external servers, which // can only be changed in daemon.json using feature flag "windows-dns-proxy". - // So, expect the lookup to fail... - assert.Check(t, is.Contains(res.Stderr.String(), "Server failed")) - // When the default behaviour is changed, nslookup should succeed... - //assert.Check(t, is.Contains(res.Stdout.String(), "Addresses:")) + assert.Check(t, is.Contains(res.Stdout.String(), "Addresses:")) }