tcp: Fix broken repair socket window probe patch
Subsystems (3)
PATCH v2 1/1 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
--- include/uapi/linux/tcp.h | 4 ++++ net/ipv4/tcp.c | 13 +++++++------ 2 files changed, 11 insertions(+), 6 deletions(-)
include/uapi/linux/tcp.h +4 -0
@@ -127,6 +127,10 @@ enum {#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 {__u32 opt_code;__u32 opt_val;
net/ipv4/tcp.c +7 -6
@@ -2823,16 +2823,17 @@ static int do_tcp_setsockopt(struct sock *sk, int level,case TCP_REPAIR :if (!tcp_can_repair_sock (sk)) err = -EPERM ; -/* 1 for normal repair, 2 for no window probes */ -else if (val ==1 || val ==2 ) { - tp->repair = val; +else if (val ==TCP_REPAIR_ON ) { + tp->repair =1 ; sk->sk_reuse =SK_FORCE_REUSE ; tp->repair_queue =TCP_NO_QUEUE ; - }else if (val ==0 ) { + }else if (val ==TCP_REPAIR_OFF ) { + tp->repair =0 ; + sk->sk_reuse =SK_NO_REUSE ; +tcp_send_window_probe (sk); + }else if (val ==TCP_REPAIR_OFF_NO_WP ) { tp->repair =0 ; sk->sk_reuse =SK_NO_REUSE ; -if (tp->repair ==1 ) -tcp_send_window_probe (sk); }else err = -EINVAL ;
Signature · 1 line
1.8.3.1
Quoted 6 lines · Stefan Baranoff
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.
Thanks for the fix.
Quoted 11 lines · Stefan Baranoff
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 clearFixes 70b7ff130224 ("tcp: allow user to create repair socket without window probes")Signed-off-by Stefan Baranoff <[email protected]>
Quoted 51 lines
--- include/uapi/linux/tcp.h | 4 ++++ net/ipv4/tcp.c | 13 +++++++------ 2 files changed, 11 insertions(+), 6 deletions(-)include/uapi/linux/tcp.h +4
-0@@ -127,6 +127,10 @@ enum {#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 {__u32 opt_code;__u32 opt_val;net/ipv4/tcp.c +7
-6@@ -2823,16 +2823,17 @@ static int do_tcp_setsockopt(struct sock *sk, int level,case TCP_REPAIR :if (!tcp_can_repair_sock (sk)) err = -EPERM ; -/* 1 for normal repair, 2 for no window probes */ -else if (val ==1 || val ==2 ) { - tp->repair = val; +else if (val ==TCP_REPAIR_ON ) { + tp->repair =1 ; sk->sk_reuse =SK_FORCE_REUSE ; tp->repair_queue =TCP_NO_QUEUE ; - }else if (val ==0 ) { + }else if (val ==TCP_REPAIR_OFF ) { + tp->repair =0 ; + sk->sk_reuse =SK_NO_REUSE ; +tcp_send_window_probe (sk); + }else if (val ==TCP_REPAIR_OFF_NO_WP ) { tp->repair =0 ; sk->sk_reuse =SK_NO_REUSE ; -if (tp->repair ==1 ) -tcp_send_window_probe (sk); }else err = -EINVAL ;Signature · 1 line
1.8.3.1
David Miller
maintainerFrom: Stefan Baranoff <[email protected]>
Date: Sun, 15 Jul 2018 11:36:37 -0400
Quoted 11 lines
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 clearFixes 70b7ff130224 ("tcp: allow user to create repair socket without window probes")Signed-off-by Stefan Baranoff <[email protected]>
Applied and queued up for -stable.