diff options
author | Andrey Vagin <avagin@openvz.org> | 2013-02-11 00:50:19 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-02-13 13:22:16 -0500 |
commit | ee684b6f2830047d19877e5547989740f18b1a5d (patch) | |
tree | 0fc416746eeca68bbba228958636dd919fc3785f /net/ipv4/tcp_input.c | |
parent | 93be6ce0e91b6a94783e012b1857a347a5e6e9f2 (diff) |
tcp: send packets with a socket timestamp
A socket timestamp is a sum of the global tcp_time_stamp and
a per-socket offset.
A socket offset is added in places where externally visible
tcp timestamp option is parsed/initialized.
Connections in the SYN_RECV state are not supported, global
tcp_time_stamp is used for them, because repair mode doesn't support
this state. In a future it can be implemented by the similar way
as for TIME_WAIT sockets.
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>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp_input.c')
-rw-r--r-- | net/ipv4/tcp_input.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index ea678b62e94f..d9bfaea34322 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -3860,7 +3860,7 @@ static bool tcp_parse_aligned_timestamp(struct tcp_sock *tp, const struct tcphdr | |||
3860 | ++ptr; | 3860 | ++ptr; |
3861 | tp->rx_opt.rcv_tsval = ntohl(*ptr); | 3861 | tp->rx_opt.rcv_tsval = ntohl(*ptr); |
3862 | ++ptr; | 3862 | ++ptr; |
3863 | tp->rx_opt.rcv_tsecr = ntohl(*ptr); | 3863 | tp->rx_opt.rcv_tsecr = ntohl(*ptr) - tp->tsoffset; |
3864 | return true; | 3864 | return true; |
3865 | } | 3865 | } |
3866 | return false; | 3866 | return false; |
@@ -3884,7 +3884,11 @@ static bool tcp_fast_parse_options(const struct sk_buff *skb, | |||
3884 | if (tcp_parse_aligned_timestamp(tp, th)) | 3884 | if (tcp_parse_aligned_timestamp(tp, th)) |
3885 | return true; | 3885 | return true; |
3886 | } | 3886 | } |
3887 | |||
3887 | tcp_parse_options(skb, &tp->rx_opt, hvpp, 1, NULL); | 3888 | tcp_parse_options(skb, &tp->rx_opt, hvpp, 1, NULL); |
3889 | if (tp->rx_opt.saw_tstamp) | ||
3890 | tp->rx_opt.rcv_tsecr -= tp->tsoffset; | ||
3891 | |||
3888 | return true; | 3892 | return true; |
3889 | } | 3893 | } |
3890 | 3894 | ||
@@ -5665,6 +5669,8 @@ static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb, | |||
5665 | int saved_clamp = tp->rx_opt.mss_clamp; | 5669 | int saved_clamp = tp->rx_opt.mss_clamp; |
5666 | 5670 | ||
5667 | tcp_parse_options(skb, &tp->rx_opt, &hash_location, 0, &foc); | 5671 | tcp_parse_options(skb, &tp->rx_opt, &hash_location, 0, &foc); |
5672 | if (tp->rx_opt.saw_tstamp) | ||
5673 | tp->rx_opt.rcv_tsecr -= tp->tsoffset; | ||
5668 | 5674 | ||
5669 | if (th->ack) { | 5675 | if (th->ack) { |
5670 | /* rfc793: | 5676 | /* rfc793: |