From 3d2517b66a4fd4cb2ba65ab7f136b1534311f5d3 Mon Sep 17 00:00:00 2001 From: Norio Nomura Date: Mon, 6 Oct 2025 17:42:14 +0900 Subject: [PATCH] pkg/portfwd: Remove `SO_REUSEPORT` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since we’re using a single accepting go routine on the port forwarder’s listener, `SO_REUSEPORT` is unnecessary. Applying this change prevents the port forwarder from binding if the listening port is already listened by another process with `SO_REUSEPORT`, resulting in a "bind: address already in use" error. Previously, if the listening port was listened by another process with `SO_REUSEPORT`, the port forwarder succeeded in binding, but the client’s connection could be handled by another process, leading to port forwarding issues without errors. Signed-off-by: Norio Nomura --- pkg/portfwd/control_others.go | 5 ----- 1 file changed, 5 deletions(-) diff --git a/pkg/portfwd/control_others.go b/pkg/portfwd/control_others.go index 529b07503e6..723862d0893 100644 --- a/pkg/portfwd/control_others.go +++ b/pkg/portfwd/control_others.go @@ -17,11 +17,6 @@ func Control(_, _ string, c syscall.RawConn) (err error) { if err != nil { return } - - err = unix.SetsockoptInt(int(fd), unix.SOL_SOCKET, unix.SO_REUSEPORT, 1) - if err != nil { - return - } }) if controlErr != nil { err = controlErr