From 7498e1ea43a634af1708f0561d5e0eb1f6763ef6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Va=C5=A1ek?= Date: Sun, 10 May 2026 01:20:27 +0200 Subject: [PATCH 1/2] fix: use net.Dial in socat for dual-stack support (Happy Eyeballs) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ResolveTCPAddr + DialTCP resolves the hostname to a single address and dials it directly. When DNS returns both A and AAAA records (dual-stack Docker network), the IPv4 address is typically returned first. On IPv6-only pods this fails with "network is unreachable" because the pod has no IPv4 connectivity. Switch to net.Dial which implements Happy Eyeballs (RFC 6555): it resolves all addresses, tries them concurrently with IPv6 preferred, and uses whichever connects first. The tcp4/tcp6 explicit cases are also handled correctly by net.Dial. Signed-off-by: Matej Vašek --- cmd/func-util/socat.go | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/cmd/func-util/socat.go b/cmd/func-util/socat.go index 4fb170840c..c11de86db4 100644 --- a/cmd/func-util/socat.go +++ b/cmd/func-util/socat.go @@ -65,15 +65,9 @@ func createConnection(address string, stdio connection) (connection, error) { switch typ { case "tcp", "tcp4", "tcp6": _, _ = fmt.Fprintln(os.Stderr, "opening connection") - var laddr net.TCPAddr - raddr, err := net.ResolveTCPAddr(typ, addr) - if err != nil { - return nil, fmt.Errorf("name does not resolve: %w", err) - } - - conn, err := net.DialTCP(typ, &laddr, raddr) + conn, err := net.Dial(typ, addr) if err == nil { - _, _ = fmt.Fprintf(os.Stderr, "successfully connected to %v\n", raddr) + _, _ = fmt.Fprintf(os.Stderr, "successfully connected to %v\n", conn.RemoteAddr()) } return conn, err case "open": From de395ea6dec138c063497c606f84f2e35be62bd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Va=C5=A1ek?= Date: Sun, 10 May 2026 01:36:15 +0200 Subject: [PATCH 2/2] fixup test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Matej Vašek --- cmd/func-util/socat_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/func-util/socat_test.go b/cmd/func-util/socat_test.go index fa14739eeb..d2b0356941 100644 --- a/cmd/func-util/socat_test.go +++ b/cmd/func-util/socat_test.go @@ -72,7 +72,7 @@ func TestRootCmd(t *testing.T) { args: args{ args: []string{"-", "TCP:does.not.exist:10000"}, inputString: "tcp-echo", - errOutMatcher: contains("not resolve"), + errOutMatcher: contains("no such host"), wantErr: true, }, },