Commit 31048d7a authored by Stefan Baranoff's avatar Stefan Baranoff Committed by David S. Miller

tcp: Fix broken repair socket window probe patch

Correct previous bad attempt at allowing sockets to come out of TCP
repair without sending window probes. To avoid changing size of
the repair variable in struct tcp_sock, this lets the decision for
sending probes or not to be made when coming out of repair by
introducing two ways to turn it off.

v2:
* Remove erroneous comment; defines now make behavior clear

Fixes: 70b7ff13 ("tcp: allow user to create repair socket without window probes")
Signed-off-by: default avatarStefan Baranoff <sbaranoff@gmail.com>
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Acked-by: default avatarAndrei Vagin <avagin@virtuozzo.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 432e629e
...@@ -127,6 +127,10 @@ enum { ...@@ -127,6 +127,10 @@ enum {
#define TCP_CM_INQ TCP_INQ #define TCP_CM_INQ TCP_INQ
#define TCP_REPAIR_ON 1
#define TCP_REPAIR_OFF 0
#define TCP_REPAIR_OFF_NO_WP -1 /* Turn off without window probes */
struct tcp_repair_opt { struct tcp_repair_opt {
__u32 opt_code; __u32 opt_code;
__u32 opt_val; __u32 opt_val;
......
...@@ -2823,16 +2823,17 @@ static int do_tcp_setsockopt(struct sock *sk, int level, ...@@ -2823,16 +2823,17 @@ static int do_tcp_setsockopt(struct sock *sk, int level,
case TCP_REPAIR: case TCP_REPAIR:
if (!tcp_can_repair_sock(sk)) if (!tcp_can_repair_sock(sk))
err = -EPERM; err = -EPERM;
/* 1 for normal repair, 2 for no window probes */ else if (val == TCP_REPAIR_ON) {
else if (val == 1 || val == 2) { tp->repair = 1;
tp->repair = val;
sk->sk_reuse = SK_FORCE_REUSE; sk->sk_reuse = SK_FORCE_REUSE;
tp->repair_queue = TCP_NO_QUEUE; tp->repair_queue = TCP_NO_QUEUE;
} else if (val == 0) { } else if (val == TCP_REPAIR_OFF) {
tp->repair = 0; tp->repair = 0;
sk->sk_reuse = SK_NO_REUSE; sk->sk_reuse = SK_NO_REUSE;
if (tp->repair == 1)
tcp_send_window_probe(sk); tcp_send_window_probe(sk);
} else if (val == TCP_REPAIR_OFF_NO_WP) {
tp->repair = 0;
sk->sk_reuse = SK_NO_REUSE;
} else } else
err = -EINVAL; err = -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment