Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp2298659pxp; Mon, 21 Mar 2022 16:14:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwKCPTOPaTFB8aOIGdcGsTZIcqwyUP2ISzw2S6ahTecpW+TpS9y0i9tIlPStP7IySM/cybV X-Received: by 2002:a17:902:6b47:b0:150:1f58:44c3 with SMTP id g7-20020a1709026b4700b001501f5844c3mr15510179plt.127.1647904489159; Mon, 21 Mar 2022 16:14:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647904489; cv=none; d=google.com; s=arc-20160816; b=Gct6kxPOElZUGthioWzhf+JPCveilXBotk6OE33dj/aXLLJYDhPqyCdwuVwC8ey3kR hTVKMH+HiEbupedoqfdeK9NkerAe0m20FMtUW8AMir8YqEmIvNt8/t1FDcU6Z8DPW2+i 5B3IGhCIOD9hsI6WpgRQ0ODUSPj7ooHCJrkLu3YqeZemMaDEYV8Ux3LeARekLQXVwnW2 CxqZRi4QKoSgtZAdxfLyyYLNqMgh+9YWjq14+UlgdEx7rw09dyBmj+TALWN+RjORWrxz BHcDZObRMK21BkbCutd0qzv5uO1299Km8RWbwH866mjCTPfL2W1bgPdD4KlnDbYsXBJj CPaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=e/dFcz4P6IgKHiXznx7AmwYwJykX2xkD2n01/GT01yE=; b=oURpDcmBfTylWE9qSqxiQqsI6A4eK7rQlbdR5xih1NuvYB1wmx4i5a6rnO9D0AnoD2 TKbajG0pEHc0EqU3ZHC2f64PX1QRHQWrP/ArrrtDN2m5s1nxmsrszBfJ6F5p+3TFxEWM zJZyPFxW38GaGA+adZ/KwrLW72Kvs0QGdHhBV9mPn5uXxFNS4Zb8o4qnHGDn0phgGZGN ib6m9uegCn33AQoOSI0fN9UNlamsHiL5GcFCG2lL5yHHEujmNr7IlgocBVSCbBz1drwT WkRnUG58Xp37UTmoDnqVyOmPOZ5N5qnhID014Gya15DUnGa82Be4KBTv0fWO/B8khn8J tzJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=jLZibxbr; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id 2-20020a170902c14200b00153c2d4da0asi12242858plj.219.2022.03.21.16.14.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 16:14:49 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=jLZibxbr; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E4AF3442E3A; Mon, 21 Mar 2022 15:12:55 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242505AbiCSJDQ (ORCPT + 99 others); Sat, 19 Mar 2022 05:03:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229801AbiCSJDP (ORCPT ); Sat, 19 Mar 2022 05:03:15 -0400 Received: from mail-pg1-x52a.google.com (mail-pg1-x52a.google.com [IPv6:2607:f8b0:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06B482E8CDA; Sat, 19 Mar 2022 02:01:55 -0700 (PDT) Received: by mail-pg1-x52a.google.com with SMTP id w21so3023988pgm.7; Sat, 19 Mar 2022 02:01:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=e/dFcz4P6IgKHiXznx7AmwYwJykX2xkD2n01/GT01yE=; b=jLZibxbrUBZUjT+x7UEYWA2ErB8y74n498/mD1uLg9vgr0g1tnVUzsOWKHzcMW5i0d vD/E2CFFWDrtasnmXK6Axj30L1YSPQgVbyBY7FrPFLWZzkW6umzF0jWEusrIGcnP6P4N BdJbp3LQGNZTgu0y5LkZrkrdgmoy/KUwaARQMNbr1jfKP3B3iEqeVOy6Y7I2lRdoKgSM u4C7JahBtQ9U/2/2cYuYcSs78Ye53aPklDm3zlcd0txnI6bjhcTVyg2V8dMGJJL6q1a5 tWJ2FU5CWG5MCnkUBEwmpyrova0DYxbuVceeBQc6dEfoWiifwp2HWGyZB5S+a0rJiLve eI8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=e/dFcz4P6IgKHiXznx7AmwYwJykX2xkD2n01/GT01yE=; b=0pnMbMlX3t8rXjakWHzqAU41/fcKKhJr3vmN7UonLqHMzw/wQtnCzE5a8ShqjN2qxl 98YwzVxYiZP8ElNxCMbSi998hiALRrLeQTXiQIgD48d4zyy//aHtBsoD3RQMi5njL5kB kRYJTBvbNgLTRdYCtrihbX24EbkrT0k0UVfNMHOPHmO0XRYLv0wMTLxeqTwM0IGJVkhb 99KOfcO3MomHxIuOXAzTSv6q/rueAw2Jr4PWXW9+9MNv73ltFpA2Utxtb+FUkmGvFJBD mKOPWXHvLqzt/uVmKqwlxfoBO0HLKHRocIJqwkwGzMBKarpwuAMqOx5sVD/x6jX6L5xj Q8LA== X-Gm-Message-State: AOAM532bsy2TDLlIGvsz8c3Y4drPY6NRbLZY4pUAy2/BITgCTX/gV0KA 4qPQAOYbAt9t/rFV+vz8TmM= X-Received: by 2002:a62:840b:0:b0:4fa:31ae:7739 with SMTP id k11-20020a62840b000000b004fa31ae7739mr14288202pfd.6.1647680514448; Sat, 19 Mar 2022 02:01:54 -0700 (PDT) Received: from localhost.localdomain ([85.203.23.81]) by smtp.gmail.com with ESMTPSA id h13-20020a056a00170d00b004f757a795fesm12179415pfc.219.2022.03.19.02.01.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Mar 2022 02:01:53 -0700 (PDT) From: zhouzhouyi@gmail.com To: edumazet@google.com, davem@davemloft.net, yoshfuji@linux-ipv6.org, dsahern@kernel.org, kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Zhouyi Zhou , Wei Xu Subject: [PATCH] net:ipv4: send an ack when seg.ack > snd.nxt Date: Sat, 19 Mar 2022 17:01:42 +0800 Message-Id: <20220319090142.137998-1-zhouzhouyi@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Zhouyi Zhou 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 Signed-off-by: Wei Xu Signed-off-by: Zhouyi Zhou --- 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