lkml.org 
[lkml]   [2022]   [Mar]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] net:ipv4: send an ack when seg.ack > snd.nxt
Date
From: Zhouyi Zhou <zhouzhouyi@gmail.com>

In RFC 793, page 72: If the ACK acks something not yet sent
(SEG.ACK > SND.NXT) then send an ACK, drop the segment,
and return. Fix Linux's behavior according to RFC 793.

Reported-by: Wei Xu <xuweihf@ustc.edu.cn>
Signed-off-by: Wei Xu <xuweihf@ustc.edu.cn>
Signed-off-by: Zhouyi Zhou <zhouzhouyi@gmail.com>
---
net/ipv4/tcp_input.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index bfe4112e000c..c10f84599655 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -3771,11 +3771,13 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag)
goto old_ack;
}

- /* If the ack includes data we haven't sent yet, discard
- * this segment (RFC793 Section 3.9).
+ /* If the ack includes data we haven't sent yet, then send
+ * an ack, drop this segment, and return (RFC793 Section 3.9).
*/
- if (after(ack, tp->snd_nxt))
+ if (after(ack, tp->snd_nxt)) {
+ tcp_send_ack(sk);
return -1;
+ }

if (after(ack, prior_snd_una)) {
flag |= FLAG_SND_UNA_ADVANCED;
--
2.25.1
\
 
 \ /
  Last update: 2022-03-19 10:02    [W:0.037 / U:0.072 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site