Skip to content

fix: reset tun and transparent inbounds when the dial fails - #3406

Open
kasumikira wants to merge 1 commit into
MetaCubeX:Alphafrom
kasumikira:fix/abort-with-rst
Open

kasumikira wants to merge 1 commit into
MetaCubeX:Alphafrom
kasumikira:fix/abort-with-rst

Conversation

@kasumikira

Copy link
Copy Markdown

handleTCPConn always closed the local connection with Close(), so a failed upstream dial
reached the TUN application as a FIN and a silent EOF, even though the local handshake had
already been completed and connect() succeeded.

The exit path now applies SetLinger(0) when the connection never reached the relay, so
mips, system and mixed send a RST. The abort is limited to TUN, REDIR and TPROXY
inbounds: HTTP CONNECT and SOCKS5 have already written their reply before the tunnel is
called, so an abortive close could discard it. gVisor does not expose SetLinger, so it is
unchanged and needs endpoint.Abort() inside sing-tun.

Refs #2625

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant