Skip to content

Bound blackholed upstream connections with TCP_USER_TIMEOUT - #2

Merged
timdoug-convex merged 1 commit into
masterfrom
timdoug/tcp-user-timeout
Jul 30, 2026
Merged

timdoug-convex merged 1 commit into
masterfrom
timdoug/tcp-user-timeout

Conversation

@timdoug-convex

Copy link
Copy Markdown

An upstream that stops acknowledging otherwise holds its CONNECT tunnel for tcp_retries2's ~16 minutes, and clients keep reusing it. Defaults to 30s, overridable with --upstream-tcp-user-timeout.

Tested at the 30s default with iptables blackholes over a CONNECT tunnel. An unreachable peer is dropped after ~30s whether data is in flight, the receive window is closed, the SYN goes unanswered, or nothing is in flight at all. A reachable peer acknowledges at the TCP layer well before its application replies, so a response that takes 45s still arrives. A peer whose TCP stack answers while its application is gone stays undetected and needs an app-layer probe, which we're doing with HTTP2 keepalives in the Rust clients.


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

An upstream that stops acknowledging otherwise holds its CONNECT tunnel
for tcp_retries2's ~16 minutes, and clients keep reusing it. Defaults to
30s, overridable with --upstream-tcp-user-timeout.

Tested at the 30s default with iptables blackholes over a CONNECT tunnel.
An unreachable peer is dropped after ~30s whether data is in flight, the
receive window is closed, the SYN goes unanswered, or nothing is in flight
at all. A reachable peer acknowledges at the TCP layer well before its
application replies, so a response that takes 45s still arrives. A peer
whose TCP stack answers while its application is gone stays undetected and
needs an app-layer probe, which we're doing with HTTP2 keepalives in the
Rust clients.
@timdoug-convex timdoug-convex self-assigned this Jul 30, 2026
@coveralls

Copy link
Copy Markdown

Coverage Report for CI Build 30508961051

Coverage increased (+0.001%) to 54.376%

Details

  • Coverage increased (+0.001%) from the base build.
  • Patch coverage: 10 uncovered changes across 2 files (13 of 23 lines covered, 56.52%).
  • No coverage regressions found.

Uncovered Changes

File Changed Covered %
cmd/smokescreen.go 8 0 0.0%
pkg/smokescreen/smokescreen.go 14 12 85.71%
Total (3 files) 23 13 56.52%

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 2685
Covered Lines: 1460
Line Coverage: 54.38%
Coverage Strength: 37.4 hits per line

💛 - Coveralls

@timdoug-convex
timdoug-convex merged commit 1e1ab1e into master Jul 30, 2026
8 checks passed
@timdoug-convex
timdoug-convex deleted the timdoug/tcp-user-timeout branch July 30, 2026 18:04
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.

3 participants