Skip to content

Commit 3d2517b

Browse files
committed
pkg/portfwd: Remove SO_REUSEPORT
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 <norio.nomura@gmail.com>
1 parent 5839d36 commit 3d2517b

File tree

1 file changed

+0
-5
lines changed

1 file changed

+0
-5
lines changed

pkg/portfwd/control_others.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,6 @@ func Control(_, _ string, c syscall.RawConn) (err error) {
1717
if err != nil {
1818
return
1919
}
20-
21-
err = unix.SetsockoptInt(int(fd), unix.SOL_SOCKET, unix.SO_REUSEPORT, 1)
22-
if err != nil {
23-
return
24-
}
2520
})
2621
if controlErr != nil {
2722
err = controlErr

0 commit comments

Comments
 (0)