Bug 138046 - [tcp] tcp sockets stay in SYN_SENT even after receiving RST. never time out as well.
Summary: [tcp] tcp sockets stay in SYN_SENT even after receiving RST. never time out a...
Status: Closed Overcome By Events
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 8.0-BETA2
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-net (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-08-21 21:50 UTC by H. Steuer
Modified: 2016-12-24 08:54 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description H. Steuer 2009-08-21 21:50:04 UTC
when a tcp connection is made to a existing host but a non-listening port, the tcp connection will stay in state SYN_SENT and will never be closed unless the process gets killed.

tcpdump shows a SYN packet answered by a RST. so the RST should close the socket.
the second problem is that at least the socket should time out in some way which isnt the case either.

i have written a small tcp client that you can download at http://skywalker.patronas.de/tcpclient.c

it connects 50 times, so after running that app, you will see 50 sockets in SYN_ACK state.

How-To-Repeat: download http://skywalker.patronas.de/tcpclient.c
compile
run against exisiting host and non-listening port
while the process is alive, netstat -an | grep [port]
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2009-08-24 05:08:39 UTC
Responsible Changed
From-To: freebsd-i386->freebsd-net

This does not sound i386-specific.
Comment 2 Andre Oppermann freebsd_committer freebsd_triage 2010-08-10 23:18:15 UTC
Responsible Changed
From-To: freebsd-net->andre

Take over.
Comment 3 Hiren Panchasara freebsd_committer freebsd_triage 2016-12-23 07:51:35 UTC
Need to evaluate if this is still the case.
Comment 4 Michael Tuexen freebsd_committer freebsd_triage 2016-12-23 13:04:52 UTC
Hi Hiren,

if the response to the SYN is a pure RST (without an ACK bit set), it should be ignored. If it is a RST-ACK, it should be accepted if and only if it acks the SYN.

This is tested in https://github.com/freebsd-net/tcp-testsuite/blob/master/state-event-engine/rcv-rst-syn-sent/README.md and https://github.com/freebsd-net/tcp-testsuite/blob/master/state-event-engine/rcv-rst-ack-syn-sent/README.md.

I found no issues using the test scripts.

Best regards
Michael
Comment 5 Hiren Panchasara freebsd_committer freebsd_triage 2016-12-24 08:54:48 UTC
Michael,
Thanks a lot for checking.