net: tcp: Send a duplicate ACK for out of order data

When out of order data is received, send out a duplicate ACK to notify
the sender that there is data received out of sequence, so it can
retransmit the missing section.

Also avoid sending acknowlegdement to acknowlegdement messages that are
having an out of order sequence number.

Signed-off-by: Sjors Hettinga <s.a.hettinga@gmail.com>
This commit is contained in:
Sjors Hettinga 2022-06-30 11:59:52 +02:00 committed by Fabio Baltieri
parent 52db2d8279
commit 9d772efbbc

View file

@ -2229,12 +2229,18 @@ next_state:
if (th_seq(th) == conn->ack) {
verdict = tcp_data_received(conn, pkt, &len);
} else if (net_tcp_seq_greater(conn->ack, th_seq(th))) {
tcp_out(conn, ACK); /* peer has resent */
if ((len > 0) || FL(&fl, &, SYN)) {
tcp_out(conn, ACK); /* peer has resent */
}
net_stats_update_tcp_seg_ackerr(conn->iface);
} else if (CONFIG_NET_TCP_RECV_QUEUE_TIMEOUT) {
tcp_out_of_order_data(conn, pkt, len,
th_seq(th));
/* Send out a duplicated ACK */
if ((len > 0) || FL(&fl, &, FIN)) {
tcp_out(conn, ACK);
}
}
}
break;