Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp2062251pxb; Fri, 25 Mar 2022 10:24:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzNDsYp0fPEk7VaKbkrkCObUjOqXqmYfMiERwLolIjFuAmf5j1R62JExxqcAos39d2BzrXt X-Received: by 2002:a05:6214:2603:b0:441:1177:10e6 with SMTP id gu3-20020a056214260300b00441117710e6mr9828686qvb.36.1648229095328; Fri, 25 Mar 2022 10:24:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648229095; cv=none; d=google.com; s=arc-20160816; b=LSzBnWf7TBEBctQkl9ZFFXUEQpJ43j2nvNLt+MPUlqdGQsHK0QOYXzclbr3O6yWKZl GQfrmcTc9TpmJUuF7PBKqguVgmqkYVlZ+SBEBqJnxQQGi6aXcZLfubwiYCYLUS9kgHYB xuRkSPj9IucvG33cXA7RQ1oHO2H61QN0mV59N/Y+f4qtwjthNd6KEFWGTNGlt/TbTVIk 1wcZuSIWuCOURnFIPK11wqTJXHvzQU1vjvf3tI0kyl8ROe6bqZ3CPsqvcJU3iHj8GlyV eT82fD4hwDFdfz1Y+ly6TRXQR8qF1HvXAQ9IJR/hbNg0UA5AnA6djqyJuy8V3biFIVAp XjHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject:from :user-agent:mime-version:date:message-id:dkim-signature; bh=OnmOfUBdKQbwRlX1LWHo0ubJzFiPKwBtV/QjBVGq0nI=; b=oLQSdR+smZY9ToHwQh+YnM2gyUlKP06wurCy4YMN+oEBVuLNcGHYGHxej5if8jYv4K 3+WhZQWsUJU6XSalIhpxzoRDYJIm3R6KDLzRBMN9q9ax3R5ejcwdrap4X/AO0rnqTAtH WZ5hvcpnEjo83F3LiEpGkcB91mEt0vRj0uTxWX6PuVb3jmY5yJuJk8cr09UzDQnL1dqv T2O/UKlYw3VQjBEfphxQZyf/jkpv0Utm+Aew0Zb5kS3aqfEB3cf58FoMe4d074bqA6Pz S9wU+zznT/0htfja5lOvX3eiBj8uVVvZL0LzdQO5J11VQLISxjI8fb94s4WPkOvVdLVi +sbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=hQ5acSUS; 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=NONE dis=NONE) header.from=163.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id e20-20020ac84e54000000b002e1fbf3bf20si2106803qtw.273.2022.03.25.10.24.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Mar 2022 10:24:55 -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=@163.com header.s=s110527 header.b=hQ5acSUS; 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=NONE dis=NONE) header.from=163.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 95E9EF55FE; Fri, 25 Mar 2022 10:19:54 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244217AbiCWNW3 (ORCPT + 99 others); Wed, 23 Mar 2022 09:22:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229482AbiCWNW1 (ORCPT ); Wed, 23 Mar 2022 09:22:27 -0400 Received: from m12-16.163.com (m12-16.163.com [220.181.12.16]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 926C23FDA1; Wed, 23 Mar 2022 06:20:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=Message-ID:Date:MIME-Version:From:Subject; bh=OnmOf UBdKQbwRlX1LWHo0ubJzFiPKwBtV/QjBVGq0nI=; b=hQ5acSUS4vaaav8E84Bjo hS8HNKbReVfH3Kv+SUXnqF9QNyEhE23KSedwffGie47O8/9Dmw+OdQWlbjVnryIm ShNWTsjO2UpKUSyGIBrMCwWuthlVpSahB2BdVfrNYXLSVJrM5m/GBw2yz+AkHOz4 rJ4p2D0bkx+5WsC/1x4pRE= Received: from [10.8.162.29] (unknown [36.111.140.141]) by smtp12 (Coremail) with SMTP id EMCowACXTxn4Gjtity+UAg--.41S2; Wed, 23 Mar 2022 21:04:57 +0800 (CST) Message-ID: <3eb95fd0-2046-c000-9c0b-c7c7e05ce04a@163.com> Date: Wed, 23 Mar 2022 21:04:57 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 From: Jianguo Wu Subject: [PATCH net-next] tcp: make tcp_rcv_state_process() drop monitor friendly To: dsahern@kernel.org, Jakub Kicinski , menglong8.dong@gmail.com Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, edumazet@google.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-CM-TRANSID: EMCowACXTxn4Gjtity+UAg--.41S2 X-Coremail-Antispam: 1Uf129KBjvJXoW7Ww4fKw4UKrW8ZFW5Cr4fGrg_yoW8GrWDpa 1DKr4DJr4kWFWUua43KFykXr1ag395Ary3GrWqvw13uw1DKr4fKFs5tr1ayrs8GF4vkw4a qFyIq3Z8WF1rurDanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jniSdUUUUU= X-Originating-IP: [36.111.140.141] X-CM-SenderInfo: 5zxmxt5qjx0iiqw6il2tof0z/xtbB9xbMkF2MctVChAAAsN 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: Jianguo Wu In tcp_rcv_state_process(), should not call tcp_drop() for same case, like after process ACK packet in TCP_LAST_ACK state, it should call consume_skb() instead of tcp_drop() to be drop monitor friendly, otherwise every last ack will be report as dropped packet by drop monitor. Signed-off-by: Jianguo Wu --- net/ipv4/tcp_input.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 2088f93..feb6f83 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -6574,7 +6574,8 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb) inet_csk_reset_keepalive_timer(sk, tmo); } else { tcp_time_wait(sk, TCP_FIN_WAIT2, tmo); - goto discard; + consume_skb(skb); + return 0; } break; } @@ -6582,7 +6583,8 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb) case TCP_CLOSING: if (tp->snd_una == tp->write_seq) { tcp_time_wait(sk, TCP_TIME_WAIT, 0); - goto discard; + consume_skb(skb); + return 0; } break; @@ -6590,7 +6592,8 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb) if (tp->snd_una == tp->write_seq) { tcp_update_metrics(sk); tcp_done(sk); - goto discard; + consume_skb(skb); + return 0; } break; } -- 1.8.3.1