Kernel: Fix bug in TCP state handling in SynSent

When receiving SYN while in SynSent, we now reply with SYN|ACK in
addition to the SynSent->SynReceived transition.
This commit is contained in:
Jamie Mansfield 2022-02-07 00:12:14 +00:00 committed by Andreas Kling
parent cda56f8049
commit 8964f754f5
Notes: sideshowbarker 2024-07-17 19:40:31 +09:00

View file

@ -472,7 +472,7 @@ void handle_tcp(IPv4Packet const& ipv4_packet, Time const& packet_timestamp)
switch (tcp_packet.flags()) {
case TCPFlags::SYN:
socket->set_ack_number(tcp_packet.sequence_number() + payload_size + 1);
(void)socket->send_ack(true);
(void)socket->send_tcp_packet(TCPFlags::SYN | TCPFlags::ACK);
socket->set_state(TCPSocket::State::SynReceived);
return;
case TCPFlags::ACK | TCPFlags::SYN: