Kernel: Tear down connections when we receive an RST packet

This commit is contained in:
Gunnar Beutner 2021-04-30 22:08:40 +02:00 committed by Andreas Kling
parent c03cbf83ab
commit e0ac611a08
Notes: sideshowbarker 2024-07-18 18:51:10 +09:00

View file

@ -528,6 +528,11 @@ void handle_tcp(const IPv4Packet& ipv4_packet, const Time& packet_timestamp)
return;
}
case TCPSocket::State::Established:
if (tcp_packet.has_rst()) {
socket->set_state(TCPSocket::State::Closed);
return;
}
if (tcp_packet.has_fin()) {
if (payload_size != 0)
socket->did_receive(ipv4_packet.source(), tcp_packet.source_port(), KBuffer::copy(&ipv4_packet, sizeof(IPv4Packet) + ipv4_packet.payload_size()), packet_timestamp);