From patchwork Wed Jan 16 23:05:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yuchung Cheng X-Patchwork-Id: 1026254 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="CQJUpOnn"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 43g2r95lWMz9sBn for ; Thu, 17 Jan 2019 10:06:01 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387963AbfAPXGA (ORCPT ); Wed, 16 Jan 2019 18:06:00 -0500 Received: from mail-pg1-f194.google.com ([209.85.215.194]:40840 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387944AbfAPXF5 (ORCPT ); Wed, 16 Jan 2019 18:05:57 -0500 Received: by mail-pg1-f194.google.com with SMTP id z10so3494292pgp.7 for ; Wed, 16 Jan 2019 15:05:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=TlSiXHUnzohCuOrsGIq/DUsUipOvuYAYR3rWHV93A70=; b=CQJUpOnnizFoV+qltYUJvnhvPW5ZoFPh5QtcsO9+XpSH2FtjOUtVa5kE6pxYDONq/Z /LJLVYkHHnYLqo/sTafW0kjMZ0+v7OXxYrDW/l6QYGOeg88v8HDNnyGm0E+Vl7BFA463 T43I3DDSq/aljbGUFcMyXkWKzCFZl/I3UmrAaQSv9xlpbErt9saOfUGRhIhZYzq/PFkX J+UlYdP8IcfIlF/UdQUQBGGZxKN6FCf5qpX1Jf3RqRgI8tcXkpucXlDfCyYKZMK8kzMR EAuQXkcR3S6pCdUawVzgiNrjgYeTFK1un3Occ0wzKCi0lDsWcxFK3hyDrV9LI1UegNbH ACzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=TlSiXHUnzohCuOrsGIq/DUsUipOvuYAYR3rWHV93A70=; b=VKC5A6sHOQ3266feRQ1gV/uIj6yq2s5kdslmBHrGsWHLlWVLDriucuY3P+n/vWGLmx ai7tn0B8mAxzn/yZSEJcYmRtT/szMpvxgU/c3heDne9UoRRWDWwF4ls7QnowZGOnPuZ7 y/selxJDJIUdmf17hXQfg/WQT9GYbxWF0cjrEs2OKoE4SJ7/9tRtCLFL3xe5AsHW8vO5 o7FL3kO0Ta39TCuKt20Y7pE1ppWIs+AIYVC4GQ50WKnhWsI7wv9aLYF0+hbR7cM/Gal5 5AE2FUWbgHLvkAMWokFhqZaEOol7SkO1TuqR2tV89UFnbgBgeT69v94hj9ZuHr/Wrrs9 STKg== X-Gm-Message-State: AJcUukedzI4IpztXZeAaU8C40l9VxaK8HfBDNyEPb4s1dq3jr6eS+hNs 5eM94JyQJX8B+BswMFERaUxU5cxwKGLXyg== X-Google-Smtp-Source: ALg8bN7SoSrHWMxANM2PYNCIeNqmhBw7jRE2U+9ocAkKV3y606sqpQH2fqolFLratAZsoTDy2714uw== X-Received: by 2002:a63:902:: with SMTP id 2mr10483581pgj.219.1547679956216; Wed, 16 Jan 2019 15:05:56 -0800 (PST) Received: from ycheng2.svl.corp.google.com ([2620:15c:2c4:201:d660:6c0b:8a4f:4c77]) by smtp.gmail.com with ESMTPSA id k186sm8481087pge.13.2019.01.16.15.05.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 16 Jan 2019 15:05:55 -0800 (PST) From: Yuchung Cheng To: davem@davemloft.net, edumazet@google.com Cc: netdev@vger.kernel.org, ncardwell@google.com, soheil@google.com, Yuchung Cheng Subject: [PATCH net-next 4/8] tcp: properly track retry time on passive Fast Open Date: Wed, 16 Jan 2019 15:05:31 -0800 Message-Id: <20190116230535.162758-5-ycheng@google.com> X-Mailer: git-send-email 2.20.1.97.g81188d93c3-goog In-Reply-To: <20190116230535.162758-1-ycheng@google.com> References: <20190116230535.162758-1-ycheng@google.com> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This patch addresses a corner issue on timeout behavior of a passive Fast Open socket. A passive Fast Open server may write and close the socket when it is re-trying SYN-ACK to complete the handshake. After the handshake is completely, the server does not properly stamp the recovery start time (tp->retrans_stamp is 0), and the socket may abort immediately on the very first FIN timeout, instead of retying until it passes the system or user specified limit. Signed-off-by: Yuchung Cheng Signed-off-by: Eric Dumazet Reviewed-by: Neal Cardwell Reviewed-by: Soheil Hassas Yeganeh --- net/ipv4/tcp_timer.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c index 1e61f0bd6e24..074de38bafbd 100644 --- a/net/ipv4/tcp_timer.c +++ b/net/ipv4/tcp_timer.c @@ -378,6 +378,7 @@ static void tcp_fastopen_synack_timer(struct sock *sk) struct inet_connection_sock *icsk = inet_csk(sk); int max_retries = icsk->icsk_syn_retries ? : sock_net(sk)->ipv4.sysctl_tcp_synack_retries + 1; /* add one more retry for fastopen */ + struct tcp_sock *tp = tcp_sk(sk); struct request_sock *req; req = tcp_sk(sk)->fastopen_rsk; @@ -395,6 +396,8 @@ static void tcp_fastopen_synack_timer(struct sock *sk) inet_rtx_syn_ack(sk, req); req->num_timeout++; icsk->icsk_retransmits++; + if (!tp->retrans_stamp) + tp->retrans_stamp = tcp_time_stamp(tp); inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS, TCP_TIMEOUT_INIT << req->num_timeout, TCP_RTO_MAX); }