Skip to content

Conversation

norio-nomura
Copy link
Contributor

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.

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>
@AkihiroSuda AkihiroSuda added this to the v2.0.0 milestone Oct 7, 2025
@AkihiroSuda AkihiroSuda requested a review from balajiv113 October 7, 2025 06:35
@norio-nomura
Copy link
Contributor Author

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.

This also may happen in guest OS on test-port-forwarding.pl because netcat-openbsd (nc in Ubuntu) uses SO_REUSEPORT.
https://git.launchpad.net/ubuntu/+source/netcat-openbsd/tree/netcat.c?h=ubuntu/plucky#n1055

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants