summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConrad Pankoff <deoxxa@fknsrs.biz>2019-09-08 17:02:40 +1000
committerAndreas Kling <awesomekling@gmail.com>2019-09-08 12:34:20 +0200
commit706e04d3407df827bd45c71f768a4a7562621ee6 (patch)
treed733d6ca94c90d8c6f075b0eb7253c7d322a8cca
parent749719b4d0e8e7f6c1933ee943abecbffa4a2b97 (diff)
downloadserenity-706e04d3407df827bd45c71f768a4a7562621ee6.zip
Kernel: Don't increment ACK number without SYN, FIN, or data
-rw-r--r--Kernel/Net/NetworkTask.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/Kernel/Net/NetworkTask.cpp b/Kernel/Net/NetworkTask.cpp
index 72938bce74..c3de17cf62 100644
--- a/Kernel/Net/NetworkTask.cpp
+++ b/Kernel/Net/NetworkTask.cpp
@@ -437,7 +437,7 @@ void handle_tcp(const IPv4Packet& ipv4_packet)
socket->set_setup_state(Socket::SetupState::Completed);
return;
case TCPFlags::ACK | TCPFlags::RST:
- socket->set_ack_number(tcp_packet.sequence_number() + payload_size + 1);
+ socket->set_ack_number(tcp_packet.sequence_number() + payload_size);
socket->send_tcp_packet(TCPFlags::ACK);
socket->set_state(TCPSocket::State::Closed);
socket->set_error(TCPSocket::Error::RSTDuringConnect);
@@ -454,7 +454,7 @@ void handle_tcp(const IPv4Packet& ipv4_packet)
case TCPSocket::State::SynReceived:
switch (tcp_packet.flags()) {
case TCPFlags::ACK:
- socket->set_ack_number(tcp_packet.sequence_number() + payload_size + 1);
+ socket->set_ack_number(tcp_packet.sequence_number() + payload_size);
socket->set_state(TCPSocket::State::Established);
if (socket->direction() == TCPSocket::Direction::Outgoing) {
socket->set_setup_state(Socket::SetupState::Completed);
@@ -478,7 +478,7 @@ void handle_tcp(const IPv4Packet& ipv4_packet)
case TCPSocket::State::LastAck:
switch (tcp_packet.flags()) {
case TCPFlags::ACK:
- socket->set_ack_number(tcp_packet.sequence_number() + payload_size + 1);
+ socket->set_ack_number(tcp_packet.sequence_number() + payload_size);
socket->set_state(TCPSocket::State::Closed);
return;
default:
@@ -490,7 +490,7 @@ void handle_tcp(const IPv4Packet& ipv4_packet)
case TCPSocket::State::FinWait1:
switch (tcp_packet.flags()) {
case TCPFlags::ACK:
- socket->set_ack_number(tcp_packet.sequence_number() + payload_size + 1);
+ socket->set_ack_number(tcp_packet.sequence_number() + payload_size);
socket->set_state(TCPSocket::State::FinWait2);
return;
case TCPFlags::FIN:
@@ -518,7 +518,7 @@ void handle_tcp(const IPv4Packet& ipv4_packet)
case TCPSocket::State::Closing:
switch (tcp_packet.flags()) {
case TCPFlags::ACK:
- socket->set_ack_number(tcp_packet.sequence_number() + payload_size + 1);
+ socket->set_ack_number(tcp_packet.sequence_number() + payload_size);
socket->set_state(TCPSocket::State::TimeWait);
return;
default: