aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorAndrew Vagin <avagin@openvz.org>2013-08-27 04:21:55 -0400
committerDavid S. Miller <davem@davemloft.net>2013-08-29 15:11:12 -0400
commite3e12028315749b7fa2edbc37328e5847be9ede9 (patch)
tree56b91f5c9bf69c923b5ca397873145777aca2db4 /net
parentc7781a6e3c4a9a17e144ec2db00ebfea327bd627 (diff)
tcp: don't apply tsoffset if rcv_tsecr is zero
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> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/ipv4/tcp_input.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 28af45abe062..3ca2139a130b 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
3535 ++ptr; 3535 ++ptr;
3536 tp->rx_opt.rcv_tsval = ntohl(*ptr); 3536 tp->rx_opt.rcv_tsval = ntohl(*ptr);
3537 ++ptr; 3537 ++ptr;
3538 tp->rx_opt.rcv_tsecr = ntohl(*ptr) - tp->tsoffset; 3538 if (*ptr)
3539 tp->rx_opt.rcv_tsecr = ntohl(*ptr) - tp->tsoffset;
3540 else
3541 tp->rx_opt.rcv_tsecr = 0;
3539 return true; 3542 return true;
3540 } 3543 }
3541 return false; 3544 return false;
@@ -3560,7 +3563,7 @@ static bool tcp_fast_parse_options(const struct sk_buff *skb,
3560 } 3563 }
3561 3564
3562 tcp_parse_options(skb, &tp->rx_opt, 1, NULL); 3565 tcp_parse_options(skb, &tp->rx_opt, 1, NULL);
3563 if (tp->rx_opt.saw_tstamp) 3566 if (tp->rx_opt.saw_tstamp && tp->rx_opt.rcv_tsecr)
3564 tp->rx_opt.rcv_tsecr -= tp->tsoffset; 3567 tp->rx_opt.rcv_tsecr -= tp->tsoffset;
3565 3568
3566 return true; 3569 return true;
@@ -5316,7 +5319,7 @@ static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb,
5316 int saved_clamp = tp->rx_opt.mss_clamp; 5319 int saved_clamp = tp->rx_opt.mss_clamp;
5317 5320
5318 tcp_parse_options(skb, &tp->rx_opt, 0, &foc); 5321 tcp_parse_options(skb, &tp->rx_opt, 0, &foc);
5319 if (tp->rx_opt.saw_tstamp) 5322 if (tp->rx_opt.saw_tstamp && tp->rx_opt.rcv_tsecr)
5320 tp->rx_opt.rcv_tsecr -= tp->tsoffset; 5323 tp->rx_opt.rcv_tsecr -= tp->tsoffset;
5321 5324
5322 if (th->ack) { 5325 if (th->ack) {