1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 13:45:07 +00:00

Kernel: Properly ack segments in the half-close state

We didn't proberly ack incoming packets while in the FinWait2. This fix
addresses that.
This commit is contained in:
jared 2023-12-29 17:08:52 -05:00 committed by Andrew Kaster
parent 7244369aff
commit 3dfd8defa9

View file

@ -614,9 +614,8 @@ void handle_tcp(IPv4Packet const& ipv4_packet, UnixDateTime const& packet_timest
socket->set_state(TCPSocket::State::Closed);
return;
case TCPFlags::ACK:
socket->set_duplicate_acks(0);
if (payload_size) {
if (socket->did_receive(ipv4_packet.source(), tcp_packet.source_port(), { &ipv4_packet, sizeof(IPv4Packet) + ipv4_packet.payload_size() }, packet_timestamp)) {
if (socket->did_receive(ipv4_packet.source(), tcp_packet.source_port(), { &ipv4_packet, sizeof(IPv4Packet) + ipv4_packet.payload_size() + 1 }, packet_timestamp)) {
socket->set_ack_number(tcp_packet.sequence_number() + payload_size);
dbgln_if(TCP_DEBUG, "Got packet with ack_no={}, seq_no={}, payload_size={}, acking it with new ack_no={}, seq_no={}",
tcp_packet.ack_number(), tcp_packet.sequence_number(), payload_size, socket->ack_number(), socket->sequence_number());