summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGunnar Beutner <gbeutner@serenityos.org>2021-05-28 00:00:58 +0200
committerAndreas Kling <kling@serenityos.org>2021-05-28 08:01:00 +0200
commit377b06c8ac479cfaa3df13fd182db5957908c6f3 (patch)
tree13e882e675c62935554121ec53a4fbec0422d123
parent3fc75088a219089204ed9256e7559e81f1e058f0 (diff)
downloadserenity-377b06c8ac479cfaa3df13fd182db5957908c6f3.zip
Kernel: Ignore duplicate SYN packets
When receiving a SYN packet for a connection that's in the "SYN received" state we should ignore the duplicate SYN packet instead of closing the connection. This can happen when we didn't accept the connection in time and our peer has sent us another SYN packet because it thought that the initial SYN packet was lost.
-rw-r--r--Kernel/Net/NetworkTask.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/Kernel/Net/NetworkTask.cpp b/Kernel/Net/NetworkTask.cpp
index 8db8da6c08..f7f54061cf 100644
--- a/Kernel/Net/NetworkTask.cpp
+++ b/Kernel/Net/NetworkTask.cpp
@@ -504,6 +504,9 @@ void handle_tcp(const IPv4Packet& ipv4_packet, const Time& packet_timestamp)
}
return;
+ case TCPFlags::SYN:
+ dbgln("handle_tcp: ignoring SYN for partially established connection");
+ return;
default:
dbgln("handle_tcp: unexpected flags in SynReceived state ({:x})", tcp_packet.flags());
unused_rc = socket->send_tcp_packet(TCPFlags::RST);