* [PATCH] tcp: reinitialize MTU probing when setting MSS in a TCP repair
@ 2017-05-26 17:28 Douglas Caetano dos Santos
2017-05-31 16:29 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Douglas Caetano dos Santos @ 2017-05-26 17:28 UTC (permalink / raw)
To: netdev
Cc: David S. Miller, Alexey Kuznetsov, James Morris,
Hideaki YOSHIFUJI, Patrick McHardy, Pavel Emelyanov
From: Douglas Caetano dos Santos <douglascs@taghos.com.br>
MTU probing initialization occurred only at connect() and at SYN or
SYN-ACK reception, but the former sets MSS to either the default or the
user set value (through TCP_MAXSEG sockopt) and the latter never happens
with repaired sockets.
The result was that, with MTU probing enabled and unless TCP_MAXSEG
sockopt was used before connect(), probing would be stuck at
tcp_base_mss value until tcp_probe_interval seconds have passed.
Signed-off-by: Douglas Caetano dos Santos <douglascs@taghos.com.br>
---
I'm not sure if there are any side effects doing this, so comments are welcome
as always.
Also, I changed the function's argument from struct tcp_sock to struct sock
because I couldn't find any inverse of tcp_sk() funciton and thought that using
"&tp->inet_conn.icsk_inet.sk" or "(struct sock *)tp" would be worse.
net/ipv4/tcp.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 842b575f8fdd..d782637e595e 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -2378,9 +2378,10 @@ static int tcp_repair_set_window(struct tcp_sock *tp, char __user *optbuf, int l
return 0;
}
-static int tcp_repair_options_est(struct tcp_sock *tp,
+static int tcp_repair_options_est(struct sock *sk,
struct tcp_repair_opt __user *optbuf, unsigned int len)
{
+ struct tcp_sock *tp = tcp_sk(sk);
struct tcp_repair_opt opt;
while (len >= sizeof(opt)) {
@@ -2393,6 +2394,7 @@ static int tcp_repair_options_est(struct tcp_sock *tp,
switch (opt.opt_code) {
case TCPOPT_MSS:
tp->rx_opt.mss_clamp = opt.opt_val;
+ tcp_mtup_init(sk);
break;
case TCPOPT_WINDOW:
{
@@ -2552,7 +2554,7 @@ static int do_tcp_setsockopt(struct sock *sk, int level,
if (!tp->repair)
err = -EINVAL;
else if (sk->sk_state == TCP_ESTABLISHED)
- err = tcp_repair_options_est(tp,
+ err = tcp_repair_options_est(sk,
(struct tcp_repair_opt __user *)optval,
optlen);
else
--
2.12.2
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] tcp: reinitialize MTU probing when setting MSS in a TCP repair
2017-05-26 17:28 [PATCH] tcp: reinitialize MTU probing when setting MSS in a TCP repair Douglas Caetano dos Santos
@ 2017-05-31 16:29 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2017-05-31 16:29 UTC (permalink / raw)
To: douglascs; +Cc: netdev, kuznet, jmorris, yoshfuji, kaber, xemul
From: Douglas Caetano dos Santos <douglascs@taghos.com.br>
Date: Fri, 26 May 2017 14:28:00 -0300
> From: Douglas Caetano dos Santos <douglascs@taghos.com.br>
>
> MTU probing initialization occurred only at connect() and at SYN or
> SYN-ACK reception, but the former sets MSS to either the default or the
> user set value (through TCP_MAXSEG sockopt) and the latter never happens
> with repaired sockets.
>
> The result was that, with MTU probing enabled and unless TCP_MAXSEG
> sockopt was used before connect(), probing would be stuck at
> tcp_base_mss value until tcp_probe_interval seconds have passed.
>
> Signed-off-by: Douglas Caetano dos Santos <douglascs@taghos.com.br>
This seems fine to me, as long as you call tcp_mtup_init() after setting
the mss_clamp, whichy you are, everything should be alright.
Applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-05-31 16:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-26 17:28 [PATCH] tcp: reinitialize MTU probing when setting MSS in a TCP repair Douglas Caetano dos Santos
2017-05-31 16:29 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox