From: Zhouyi Zhou <zhouzhouyi@gmail.com>
To: Eric Dumazet <edumazet@google.com>
Cc: Florian Westphal <fw@strlen.de>,
David Miller <davem@davemloft.net>,
yoshfuji@linux-ipv6.org, dsahern@kernel.org,
Jakub Kicinski <kuba@kernel.org>,
pabeni@redhat.com, netdev@vger.kernel.org,
linux-kernel <linux-kernel@vger.kernel.org>,
Wei Xu <xuweihf@ustc.edu.cn>
Subject: Re: [PATCH v2] net:ipv4: send an ack when seg.ack > snd.nxt
Date: Sat, 19 Mar 2022 19:34:40 +0800 [thread overview]
Message-ID: <CAABZP2yK2vCJcReJ_VvcqbkuEekvBpBJCyZ2geG=f83fv_RC=Q@mail.gmail.com> (raw)
In-Reply-To: <CANn89iK46rw910CUJV3Kgf=M=HA32_ctd0xragwcRnHCV_VhmQ@mail.gmail.com>
Thanks for reviewing my patch
On Sat, Mar 19, 2022 at 7:14 PM Eric Dumazet <edumazet@google.com> wrote:
>
> On Sat, Mar 19, 2022 at 4:04 AM <zhouzhouyi@gmail.com> wrote:
> >
> > 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>
> > ---
> > Thank Florian Westphal for pointing out
> > the potential duplicated ack bug in patch version 1.
>
> I am travelling this week, but I think your patch is not necessary and
> might actually be bad.
>
> Please provide more details of why nobody complained of this until today.
>
> Also I doubt you actually fully tested this patch, sending a V2 30
> minutes after V1.
>
> If yes, please provide a packetdrill test.
I am a beginner to TCP, although I have submitted once a patch to
netdev in 2013 (aaa0c23cb90141309f5076ba5e3bfbd39544b985), this is
first time I learned packetdrill test.
I think I should do the packetdrill test in the coming days, and
provide more details of how this (RFC793 related) can happen.
Apologize sincerely in advance if I have made noise.
Thank you for your time
Sincerely
Zhouyi
>
> Thank you.
>
> > --
> > net/ipv4/tcp_input.c | 21 +++++++++++++--------
> > 1 file changed, 13 insertions(+), 8 deletions(-)
> >
> > diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
> > index bfe4112e000c..4bbf85d7ea8c 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 page 72).
> > */
> > - if (after(ack, tp->snd_nxt))
> > - return -1;
> > + if (after(ack, tp->snd_nxt)) {
> > + tcp_send_ack(sk);
> > + return -2;
> > + }
> >
> > if (after(ack, prior_snd_una)) {
> > flag |= FLAG_SND_UNA_ADVANCED;
> > @@ -6385,6 +6387,7 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb)
> > struct request_sock *req;
> > int queued = 0;
> > bool acceptable;
> > + int ret;
> >
> > switch (sk->sk_state) {
> > case TCP_CLOSE:
> > @@ -6451,14 +6454,16 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb)
> > return 0;
> >
> > /* step 5: check the ACK field */
> > - acceptable = tcp_ack(sk, skb, FLAG_SLOWPATH |
> > - FLAG_UPDATE_TS_RECENT |
> > - FLAG_NO_CHALLENGE_ACK) > 0;
> > + ret = tcp_ack(sk, skb, FLAG_SLOWPATH |
> > + FLAG_UPDATE_TS_RECENT |
> > + FLAG_NO_CHALLENGE_ACK);
> > + acceptable = ret > 0;
> >
> > if (!acceptable) {
> > if (sk->sk_state == TCP_SYN_RECV)
> > return 1; /* send one RST */
> > - tcp_send_challenge_ack(sk);
> > + if (ret > -2)
> > + tcp_send_challenge_ack(sk);
> > goto discard;
> > }
> > switch (sk->sk_state) {
> > --
> > 2.25.1
> >
next prev parent reply other threads:[~2022-03-19 11:35 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-19 11:04 [PATCH v2] net:ipv4: send an ack when seg.ack > snd.nxt zhouzhouyi
2022-03-19 11:14 ` Eric Dumazet
2022-03-19 11:34 ` Zhouyi Zhou [this message]
2022-03-19 13:57 ` Neal Cardwell
2022-03-19 15:31 ` Zhouyi Zhou
2022-05-07 1:19 ` Zhouyi Zhou
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAABZP2yK2vCJcReJ_VvcqbkuEekvBpBJCyZ2geG=f83fv_RC=Q@mail.gmail.com' \
--to=zhouzhouyi@gmail.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=fw@strlen.de \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=xuweihf@ustc.edu.cn \
--cc=yoshfuji@linux-ipv6.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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 NNTP newsgroup(s).