eyalabraham / 8bit-TCPIP

An 8bit Intel 8088/8086 campatible TCP/IP stack
MIT License
4 stars 0 forks source link

When using tcp_close() stack is shut down before completing TCP state transitions #9

Closed eyalabraham closed 4 years ago

eyalabraham commented 4 years ago

When using tcp_close() the stack is shut down before completing the TCP state transitions, which results in not ACK-ing remote FINs. In tcp.c, check if TCP_EVENT_CLOSE signal is sent at the appropriate time, or if a TCP_EVENT_CLOSING and TCP_EVENT_CLOSED signals need to be created to match TCP stack states.

eyalabraham commented 4 years ago

Changed event notification of TCP_EVENT_CLOSE to trigger only when a FIN segment arrives while on ESTABLISHED or SYN_RECEIVED states, and the handler transitions to CLOSE_WAIT. Any other situations mean that the app initiated the FIN segment and there is not need to send a notification to the app when the remote responds with a FIN_ACK. See implementation in the telnet utility.