From 55faff80df2b2be5b0d5f1bd87f9ddced7e3a30e Mon Sep 17 00:00:00 2001 From: Pierre Delagrave Date: Wed, 28 Jun 2023 18:40:44 -0400 Subject: [PATCH] Kernet/Net: Close a TCP connection using FIN|ACK instead of just FIN When initiating a connection termination, the FIN should be sent with a ACK from the last received segment even if that ACK already been sent. --- Kernel/Net/TCPSocket.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Kernel/Net/TCPSocket.cpp b/Kernel/Net/TCPSocket.cpp index f4fc3546e1..2027f969ad 100644 --- a/Kernel/Net/TCPSocket.cpp +++ b/Kernel/Net/TCPSocket.cpp @@ -534,7 +534,7 @@ void TCPSocket::shut_down_for_writing() { if (state() == State::Established) { dbgln_if(TCP_SOCKET_DEBUG, " Sending FIN from Established and moving into FinWait1"); - (void)send_tcp_packet(TCPFlags::FIN); + (void)send_tcp_packet(TCPFlags::FIN | TCPFlags::ACK); set_state(State::FinWait1); } else { dbgln(" Shutting down TCPSocket for writing but not moving to FinWait1 since state is {}", to_string(state()));