* [PATCH] net:ipv4: send an ack when seg.ack > snd.nxt
@ 2022-03-19 9:01 zhouzhouyi
2022-03-19 10:04 ` Florian Westphal
0 siblings, 1 reply; 3+ messages in thread
From: zhouzhouyi @ 2022-03-19 9:01 UTC (permalink / raw
To: edumazet, davem, yoshfuji, dsahern, kuba, pabeni, netdev,
linux-kernel
Cc: Zhouyi Zhou, Wei Xu
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] net:ipv4: send an ack when seg.ack > snd.nxt
2022-03-19 9:01 [PATCH] net:ipv4: send an ack when seg.ack > snd.nxt zhouzhouyi
@ 2022-03-19 10:04 ` Florian Westphal
2022-03-19 10:34 ` Zhouyi Zhou
0 siblings, 1 reply; 3+ messages in thread
From: Florian Westphal @ 2022-03-19 10:04 UTC (permalink / raw
To: zhouzhouyi
Cc: edumazet, davem, yoshfuji, dsahern, kuba, pabeni, netdev,
linux-kernel, Wei Xu
zhouzhouyi@gmail.com <zhouzhouyi@gmail.com> wrote:
> - if (after(ack, tp->snd_nxt))
> + if (after(ack, tp->snd_nxt)) {
> + tcp_send_ack(sk);
> return -1;
> + }
If we really need to do this we need to
if (!(flag & FLAG_NO_CHALLENGE_ACK))
tcp_send_challenge_ack(sk);
... else this might result in two acks?
Whats the problem thats being fixed here?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] net:ipv4: send an ack when seg.ack > snd.nxt
2022-03-19 10:04 ` Florian Westphal
@ 2022-03-19 10:34 ` Zhouyi Zhou
0 siblings, 0 replies; 3+ messages in thread
From: Zhouyi Zhou @ 2022-03-19 10:34 UTC (permalink / raw
To: Florian Westphal
Cc: Eric Dumazet, David Miller, yoshfuji, dsahern, Jakub Kicinski,
pabeni, netdev, linux-kernel, Wei Xu
Dear Florian
Thank you for reviewing my patch ;-)
On Sat, Mar 19, 2022 at 6:04 PM Florian Westphal <fw@strlen.de> wrote:
>
> zhouzhouyi@gmail.com <zhouzhouyi@gmail.com> wrote:
> > - if (after(ack, tp->snd_nxt))
> > + if (after(ack, tp->snd_nxt)) {
> > + tcp_send_ack(sk);
> > return -1;
> > + }
>
> If we really need to do this we need to
> if (!(flag & FLAG_NO_CHALLENGE_ACK))
Yes, we need to check FLAG_NO_CHALLENGE_ACK here to avoid two acks.
> tcp_send_challenge_ack(sk);
>
> ... else this might result in two acks?
> Whats the problem thats being fixed here?
We fix the code to let it match what RFC 793 page 72 has described. I
guess this is also what the intermediate internet devices (routers,
firewalls for example) expect us to do ;-)
Thanks again
Zhouyi
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-03-19 10:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-19 9:01 [PATCH] net:ipv4: send an ack when seg.ack > snd.nxt zhouzhouyi
2022-03-19 10:04 ` Florian Westphal
2022-03-19 10:34 ` Zhouyi Zhou
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).