tcp: allow user to create repair socket without window probes
authorStefan Baranoff <sbaranoff@gmail.com>
Tue, 10 Jul 2018 21:31:10 +0000 (17:31 -0400)
committerDavid S. Miller <davem@davemloft.net>
Thu, 12 Jul 2018 21:33:45 +0000 (14:33 -0700)
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 <sbaranoff@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/tcp.c

index 0d43705..8e5e2ca 100644 (file)
@@ -2823,14 +2823,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;