From b0b898c235987f8943721d15c3ca45863c8b4dd8 Mon Sep 17 00:00:00 2001 From: Miguel da Costa Martins Marcelino Date: Tue, 14 Apr 2026 16:11:59 +0000 Subject: [PATCH] TUN-10383: Set edge-ip-version to auto To allow pre-checks to test both IPv6 and IPv4, we must change the default value of edge-ip-version's from 4 to auto. This will allows the tunnel (and pre-check) to probe both IPv4 and IPv6 addresses by default, respecting the system's DNS preference. Instead of always preferring IPv4, cloudflared will now use whichever address family the system resolver returns first. --- CHANGES.md | 4 ++++ cmd/cloudflared/tunnel/cmd.go | 2 +- component-tests/test_edge_discovery.py | 17 +++++++++++++---- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index df309b96..5f4de4ef 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,7 @@ +## 2026.4.0 +### Breaking Change +- The default value of `--edge-ip-version` has changed from `4` to `auto`. This means cloudflared will now use whichever address family (IPv4 or IPv6) the system resolver returns first, instead of always preferring IPv4. Users who require IPv4-only connections should explicitly set `--edge-ip-version 4`. + ## 2026.2.0 ### Breaking Change - Removes the `proxy-dns` feature from cloudflared. This feature allowed running a local DNS over HTTPS (DoH) proxy. diff --git a/cmd/cloudflared/tunnel/cmd.go b/cmd/cloudflared/tunnel/cmd.go index 0460174d..6878eefa 100644 --- a/cmd/cloudflared/tunnel/cmd.go +++ b/cmd/cloudflared/tunnel/cmd.go @@ -631,7 +631,7 @@ func tunnelFlags(shouldHide bool) []cli.Flag { Name: cfdflags.EdgeIpVersion, Usage: "Cloudflare Edge IP address version to connect with. {4, 6, auto}", EnvVars: []string{"TUNNEL_EDGE_IP_VERSION"}, - Value: "4", + Value: "auto", Hidden: false, }), altsrc.NewStringFlag(&cli.StringFlag{ diff --git a/component-tests/test_edge_discovery.py b/component-tests/test_edge_discovery.py index 61e036a3..8fd3b036 100644 --- a/component-tests/test_edge_discovery.py +++ b/component-tests/test_edge_discovery.py @@ -20,12 +20,21 @@ class TestEdgeDiscovery: @pytest.mark.parametrize("protocol", protocols()) def test_default_only(self, tmp_path, component_tests_config, protocol): """ - This test runs a tunnel to connect via IPv4-only edge addresses (default is unset "--edge-ip-version 4") + This test runs a tunnel with the default edge-ip-version (auto), which will use + whichever address family the system resolver returns first. """ if self.has_ipv6_only(): - pytest.skip("Host has IPv6 only support and current default is IPv4 only") - self.expect_address_connections( - tmp_path, component_tests_config, protocol, None, self.expect_ipv4_address) + self.expect_address_connections( + tmp_path, component_tests_config, protocol, None, self.expect_ipv6_address) + elif self.has_ipv4_only(): + self.expect_address_connections( + tmp_path, component_tests_config, protocol, None, self.expect_ipv4_address) + elif self.has_dual_stack(address_family_preference=socket.AddressFamily.AF_INET6): + self.expect_address_connections( + tmp_path, component_tests_config, protocol, None, self.expect_ipv6_address) + else: + self.expect_address_connections( + tmp_path, component_tests_config, protocol, None, self.expect_ipv4_address) @pytest.mark.parametrize("protocol", protocols()) def test_ipv4_only(self, tmp_path, component_tests_config, protocol):