From b815a2c3a83f3b01a11e65ae9ea8aaa0f7787018 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Tue, 27 Jul 2021 13:55:04 +0900 Subject: [PATCH] tcp_input: Don't put back sndseq on an old ack --- net/tcp/tcp_input.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/net/tcp/tcp_input.c b/net/tcp/tcp_input.c index 96eeb5ac90..56edd7c46d 100644 --- a/net/tcp/tcp_input.c +++ b/net/tcp/tcp_input.c @@ -582,6 +582,7 @@ found: { uint32_t unackseq; uint32_t ackseq; + uint32_t sndseq; /* The next sequence number is equal to the current sequence * number (sndseq) plus the size of the outstanding, unacknowledged @@ -639,11 +640,15 @@ found: * be beyond ackseq. */ - ninfo("sndseq: %08" PRIx32 "->%08" PRIx32 - " unackseq: %08" PRIx32 " new tx_unacked: %" PRId32 "\n", - tcp_getsequence(conn->sndseq), ackseq, unackseq, - (uint32_t)conn->tx_unacked); - tcp_setsequence(conn->sndseq, ackseq); + sndseq = tcp_getsequence(conn->sndseq); + if (TCP_SEQ_LT(sndseq, ackseq)) + { + ninfo("sndseq: %08" PRIx32 "->%08" PRIx32 + " unackseq: %08" PRIx32 " new tx_unacked: %" PRId32 "\n", + tcp_getsequence(conn->sndseq), ackseq, unackseq, + (uint32_t)conn->tx_unacked); + tcp_setsequence(conn->sndseq, ackseq); + } /* Do RTT estimation, unless we have done retransmissions. */