From: Stefan Baranoff Subject: [PATCH] tcp: allow user to create repair socket without window probes Date: Tue, 10 Jul 2018 17:31:10 -0400 Message-ID: <1531258270-1046-1-git-send-email-sbaranoff@gmail.com> Cc: Andrey Vagin , Pavel Emelyanov , Stefan Baranoff , Eric Dumazet , "David S. Miller" , Alexey Kuznetsov , Hideaki YOSHIFUJI To: netdev@vger.kernel.org Return-path: Received: from mail-vk0-f65.google.com ([209.85.213.65]:34219 "EHLO mail-vk0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732261AbeGJVc2 (ORCPT ); Tue, 10 Jul 2018 17:32:28 -0400 Received: by mail-vk0-f65.google.com with SMTP id l143-v6so5961312vke.1 for ; Tue, 10 Jul 2018 14:31:29 -0700 (PDT) Sender: netdev-owner@vger.kernel.org List-ID: Under rare conditions where repair code may be used it is possible that window probes are either unnecessary or undesired. If the user knows that window probes are not wanted or needed this change allows them to skip sending them when a socket comes out of repair. Signed-off-by: Stefan Baranoff --- net/ipv4/tcp.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index e7b53d2a..728ae7a 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -2821,14 +2821,16 @@ static int do_tcp_setsockopt(struct sock *sk, int level, case TCP_REPAIR: if (!tcp_can_repair_sock(sk)) err = -EPERM; - else if (val == 1) { - tp->repair = 1; + /* 1 for normal repair, 2 for no window probes */ + else if (val == 1 || val == 2) { + tp->repair = val; sk->sk_reuse = SK_FORCE_REUSE; tp->repair_queue = TCP_NO_QUEUE; } else if (val == 0) { tp->repair = 0; sk->sk_reuse = SK_NO_REUSE; - tcp_send_window_probe(sk); + if (tp->repair == 1) + tcp_send_window_probe(sk); } else err = -EINVAL; -- 1.8.3.1