* [PATCH] tcp: don't apply tsoffset if rcv_tsecr is zero
@ 2013-08-27 8:21 Andrey Vagin
2013-08-29 19:12 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Andrey Vagin @ 2013-08-27 8:21 UTC (permalink / raw)
To: netdev
Cc: Cyrill Gorcunov, linux-kernel, Andrew Vagin, Pavel Emelyanov,
Eric Dumazet, David S. Miller, Alexey Kuznetsov, James Morris,
Hideaki YOSHIFUJI, Patrick McHardy
From: Andrew Vagin <avagin@openvz.org>
The zero value means that tsecr is not valid, so it's a special case.
tsoffset is used to customize tcp_time_stamp for one socket.
tsoffset is usually zero, it's used when a socket was moved from one
host to another host.
Currently this issue affects logic of tcp_rcv_rtt_measure_ts. Due to
incorrect value of rcv_tsecr, tcp_rcv_rtt_measure_ts sets rto to
TCP_RTO_MAX.
Cc: Pavel Emelyanov <xemul@parallels.com>
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
Cc: James Morris <jmorris@namei.org>
Cc: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
Cc: Patrick McHardy <kaber@trash.net>
Reported-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
---
net/ipv4/tcp_input.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 28af45a..3ca2139 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -3535,7 +3535,10 @@ static bool tcp_parse_aligned_timestamp(struct tcp_sock *tp, const struct tcphdr
++ptr;
tp->rx_opt.rcv_tsval = ntohl(*ptr);
++ptr;
- tp->rx_opt.rcv_tsecr = ntohl(*ptr) - tp->tsoffset;
+ if (*ptr)
+ tp->rx_opt.rcv_tsecr = ntohl(*ptr) - tp->tsoffset;
+ else
+ tp->rx_opt.rcv_tsecr = 0;
return true;
}
return false;
@@ -3560,7 +3563,7 @@ static bool tcp_fast_parse_options(const struct sk_buff *skb,
}
tcp_parse_options(skb, &tp->rx_opt, 1, NULL);
- if (tp->rx_opt.saw_tstamp)
+ if (tp->rx_opt.saw_tstamp && tp->rx_opt.rcv_tsecr)
tp->rx_opt.rcv_tsecr -= tp->tsoffset;
return true;
@@ -5316,7 +5319,7 @@ static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb,
int saved_clamp = tp->rx_opt.mss_clamp;
tcp_parse_options(skb, &tp->rx_opt, 0, &foc);
- if (tp->rx_opt.saw_tstamp)
+ if (tp->rx_opt.saw_tstamp && tp->rx_opt.rcv_tsecr)
tp->rx_opt.rcv_tsecr -= tp->tsoffset;
if (th->ack) {
--
1.8.3.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] tcp: don't apply tsoffset if rcv_tsecr is zero
2013-08-27 8:21 [PATCH] tcp: don't apply tsoffset if rcv_tsecr is zero Andrey Vagin
@ 2013-08-29 19:12 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2013-08-29 19:12 UTC (permalink / raw)
To: avagin
Cc: netdev, gorcunov, linux-kernel, xemul, eric.dumazet, kuznet,
jmorris, yoshfuji, kaber
From: Andrey Vagin <avagin@openvz.org>
Date: Tue, 27 Aug 2013 12:21:55 +0400
> From: Andrew Vagin <avagin@openvz.org>
>
> The zero value means that tsecr is not valid, so it's a special case.
>
> tsoffset is used to customize tcp_time_stamp for one socket.
> tsoffset is usually zero, it's used when a socket was moved from one
> host to another host.
>
> Currently this issue affects logic of tcp_rcv_rtt_measure_ts. Due to
> incorrect value of rcv_tsecr, tcp_rcv_rtt_measure_ts sets rto to
> TCP_RTO_MAX.
>
> Reported-by: Cyrill Gorcunov <gorcunov@openvz.org>
> Signed-off-by: Andrey Vagin <avagin@openvz.org>
Applied and queued up for -stable.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-08-29 19:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-27 8:21 [PATCH] tcp: don't apply tsoffset if rcv_tsecr is zero Andrey Vagin
2013-08-29 19:12 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).