diff options
author | Gunnar Beutner <gbeutner@serenityos.org> | 2021-04-30 22:08:40 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-04-30 23:11:56 +0200 |
commit | e0ac611a08adb5906b853dcc9d6c689f9f6427c9 (patch) | |
tree | 7c316f9626079f95682762169f3a717d1b8d7b5d | |
parent | c03cbf83abcb969ab135eb73e566e85d7e9314c4 (diff) | |
download | serenity-e0ac611a08adb5906b853dcc9d6c689f9f6427c9.zip |
Kernel: Tear down connections when we receive an RST packet
-rw-r--r-- | Kernel/Net/NetworkTask.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
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); |