Skip to content

ssping: use close+recreate instead of connect(AF_UNSPEC) for reliable TCP cleanup#8664

Draft
Copilot wants to merge 3 commits intoptaffet/snapshot-ping-tcpfrom
copilot/sub-pr-8657
Draft

ssping: use close+recreate instead of connect(AF_UNSPEC) for reliable TCP cleanup#8664
Copilot wants to merge 3 commits intoptaffet/snapshot-ping-tcpfrom
copilot/sub-pr-8657

Conversation

Copy link
Contributor

Copilot AI commented Mar 3, 2026

connect(AF_UNSPEC) on TCP sockets is a Linux-specific tcp_disconnect() extension that does not reliably send RST/FIN in all connection states, leaving stale TCP state at the remote end.

Replace with close() + fresh socket() which guarantees FIN delivery for established connections and proper kernel cleanup for SYN_SENT.

  • fd_ssping.cremove_fdesc_idx() now closes the socket and creates a fresh nonblocking TCP socket with TCP_NODELAY, instead of attempting connect(AF_UNSPEC)
  • fd_snapct_tile.seccomppolicy — Allow close and setsockopt(TCP_NODELAY) on ping fds (previously blocked to match the socket-reuse design)
  • fd_snapct_tile_seccomp.h — Regenerated (8 fewer BPF instructions from removed ping fd range exclusions)
/* Before: non-standard, unreliable on TCP */
connect( fdesc, &(struct sockaddr_in){ .sin_family = AF_UNSPEC }, ... );

/* After: standard close sends FIN, then fresh socket for reuse */
close( fdesc );
fdesc = socket( AF_INET, SOCK_STREAM|SOCK_NONBLOCK, 0 );
setsockopt( fdesc, SOL_TCP, TCP_NODELAY, &tcp_nodelay, sizeof(int) );

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

… TCP cleanup

Co-authored-by: ripatel-fd <113896534+ripatel-fd@users.noreply.github.com>
Copilot AI changed the title [WIP] Update snapct to use tcp-based ping for peer reachability ssping: use close+recreate instead of connect(AF_UNSPEC) for reliable TCP cleanup Mar 3, 2026
@ptaffet-jump ptaffet-jump force-pushed the ptaffet/snapshot-ping-tcp branch from e13d6cc to 92cfb91 Compare March 3, 2026 21:52
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