diff options
author | Andreas Kling <kling@serenityos.org> | 2020-02-08 14:09:02 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-02-08 14:09:02 +0100 |
commit | 1037a1d2badb21ecb32606699cd54b9a3b8ff3ed (patch) | |
tree | a4cec70a2f4c59a40f374baeaf2e5428f5743e2b /Kernel/Net/NetworkTask.cpp | |
parent | 48f13f2a813b90426662854c4eb993ebee223b0a (diff) | |
download | serenity-1037a1d2badb21ecb32606699cd54b9a3b8ff3ed.zip |
IPv4: Don't ACK empty TCP packets
Wireshark was complaining about duplicate ACK's and this was why.
Diffstat (limited to 'Kernel/Net/NetworkTask.cpp')
-rw-r--r-- | Kernel/Net/NetworkTask.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/Kernel/Net/NetworkTask.cpp b/Kernel/Net/NetworkTask.cpp index 262c13cc5d..1c52923fcb 100644 --- a/Kernel/Net/NetworkTask.cpp +++ b/Kernel/Net/NetworkTask.cpp @@ -617,12 +617,9 @@ void handle_tcp(const IPv4Packet& ipv4_packet) socket->sequence_number()); #endif - bool should_ack = true; - if (payload_size != 0) { - should_ack = socket->did_receive(ipv4_packet.source(), tcp_packet.source_port(), KBuffer::copy(&ipv4_packet, sizeof(IPv4Packet) + ipv4_packet.payload_size())); + if (payload_size) { + if (socket->did_receive(ipv4_packet.source(), tcp_packet.source_port(), KBuffer::copy(&ipv4_packet, sizeof(IPv4Packet) + ipv4_packet.payload_size()))) + socket->send_tcp_packet(TCPFlags::ACK); } - - if (should_ack) - socket->send_tcp_packet(TCPFlags::ACK); } } |