Question regarding RST packet and the tcp stack

Andrew Schmidt Andrew.Schmidt at impactmobile.com
Thu Nov 14 13:51:19 UTC 2013


I've been testing out a scenario on windows and linux and I have a question for what FreeBSD does or rfc1122 says:  (The code is in java using java.nio)

An application (host) has established a remote connection to another machine.   The OS on the host receives the following packets in order for that socket:

Data packet (6 bytes)
FIN packet
RST packet

At this point the application (host) tries to read from the socket.    On windows,  this causes a "the os has closed the connection" exception and doesn't let you read those 6 bytes.

On Linux, those 6 bytes can be read.

I've looked over the TCP rfc:  http://www.rfc-editor.org/rfc/rfc1122.txt    .  But it's not clear what should happen to 6 bytes once a RST packet arrives.

Does anyone know what the correct behaviour is?  Or point me to freebsd's tcp stack code?

Thanks,


More information about the freebsd-net mailing list