From e0ac611a08adb5906b853dcc9d6c689f9f6427c9 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Fri, 30 Apr 2021 22:08:40 +0200 Subject: Kernel: Tear down connections when we receive an RST packet --- Kernel/Net/NetworkTask.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'Kernel/Net/NetworkTask.cpp') diff --git a/Kernel/Net/NetworkTask.cpp b/Kernel/Net/NetworkTask.cpp index 92dd3aca6b..cf8f617e7e 100644 --- a/Kernel/Net/NetworkTask.cpp +++ b/Kernel/Net/NetworkTask.cpp @@ -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); -- cgit v1.2.3