Description

Protocol suite: TCP/IP.

Protocol type: Transport layer protocol.

Option length: 10 bytes.

The TCP Timestamp option obsoletes the TCP Echo request and Echo reply options.

RFC 1323:

The timestamps are used for two distinct mechanisms: RTTM (Round Trip Time Measurement) and PAWS (Protected Against Wrapped Squences).

结构图

Kind. 8 bits. Set to 8.

Length. 8 bits. Set to 10.

Timestamp Value (TSval). 32 bits.

This field contains the current value of the timestamp clock of the TCP sending the option.

TImestamp Echo Reply (TSecr). 32 bits.

This field only valid if the ACK bit is set in the TCP header. If it is valid, it echos a timestamp value that was sent by the remote TCP in the TSval field of a Timestamps option. When TSecr is not valid, its value must be zero. The TSecr value will generally be from the most recent Timestamp option that was received; however, there are exceptions that are explained below. A TCP may send the Timestamp option in an initial SYN segment(i.e., segment containing a SYN bit and no ACK bit), and may send a TSopt in other segments only if it received a TSopt in the initial SYN segment for the connection.

Linux内核中的使用

如果支持Timestamp选项,那么可以用此选项来计算RTT。

static void tcp_ack_saw_tstamp(struct sock *sk , int flag)

{

/* RTTM Rule: A TSecr value received in a segment is used to

* update the averaged RTT measurement only if the segment

* acknowledges some new data, i.e., only if it advances the

* left edge of the send window.

*

* Changed: reset backoff as soon as we see the first valid

* sample. If we do not, we get strongly overestimated rto.

* With timestamps samples are accepted even from very

* old segments: f.e., when rtt=1 increases to 8, we retransmit

* 5 times and after 8 seconds delayed answer arrives rto

* becomes 120 seconds!

*/

struct tcp_sock *tp = tcp_sk(sk);

tcp_valid_rtt_meas(sk, tcp_time_stamp - tp->rx_opt.rcv_tsecr);

}

rtt即等于现在的时间tcp_time_stamp减去Timestamp Echo Reply,即tp->rx_opt.rcv_tsecr。

TCP timestamp option的作用:

1)allow more accurate round-trip time measurements for deriving the retransmission timeout estimator.

2)protect against old segments from the previous incarnations of the TCP connection.

3)allow detection of unnecessary retransmissions.

tcp_tw_recycle/tcp_timestamps都开启的条件下,60s内同一源ip主机的socket connect请求中的timestamp必须是递增的。

原文

http://blog.csdn.net/zhangskd/article/details/7195795

tcp_tw_recycle和tcp_timestamps导致connect失败问题

http://blog.sina.com.cn/s/blog_781b0c850100znjd.html

tcp timestamp的更多相关文章

  1. TCP连接建立系列 — 客户端的端口选取和重用

    主要内容:connect()时的端口选取和端口重用. 内核版本:3.15.2 我的博客:http://blog.csdn.net/zhangskd 端口选取 connect()时本地端口是如何选取的呢 ...

  2. TCP 、UDP、IP包的最大长度

    1.概述 首先要看TCP/IP协议,涉及到四层:链路层,网络层,传输层,应用层. 其中以太网(Ethernet)的数据帧在链路层 IP包在网络层 TCP或UDP包在传输层 TCP或UDP中的数据(Da ...

  3. Multipath TCP and load balancers

    Load balancers play a very important role in today’s Internet. Most Internet services are provided b ...

  4. TCP中RTT的测量和RTO的计算

    https://blog.csdn.net/zhangskd/article/details/7196707 tcp传输往返时间是指:发送方发送tcp断开时, 到发送方接收到改段立即响应的所耗费的时间 ...

  5. tcp timewait 问题 转载

    TIME WAIT 带来的问题 先引用一个名言: The TIME_WAIT state is our friend and is there to help us (i.e., to let old ...

  6. 【Azure 应用服务】Azure Web App的服务(基于Windows 操作系统部署)在被安全漏洞扫描时发现了TCP timestamps漏洞

    问题背景 什么是TCP timestamps(TCP 时间戳)? The remote host implements TCP Timestamps, as defined by RFC1323 (h ...

  7. TCP服务端收到syn但是不回复syn ack问题分析

    文章转载自:https://blog.csdn.net/jueshengtianya/article/details/52130667 最近在分析客户的一个问题时遇到了一种奇怪的情况,客户在服务端开启 ...

  8. 【lwip】12-一文解决TCP原理

    目录 前言 12.1 TCP协议简介 12.2 TCP相关的一些概念词 12.2.1 MSL 12.2.2 MSS 12.3 TCP工作特性 12.3.1 面向连接 12.3.2 全双工通信 12.3 ...

  9. hping原理、安装、使用详解介绍

    [原理基础]  Hping是一个命令行下使用的TCP/IP数据包组装/分析工具,其命令模式很像Unix下的ping命令,但是它不是只能发送ICMP回应请求,它还可以支持TCP.UDP.ICMP和RAW ...

随机推荐

  1. myBatis出现Mapped Statements collection already contains value for

    造成这个问题的原因很多,我遇到的主要是因为 <select id="queryCountfor****" parameterType="java.lang.Inte ...

  2. ICE中间件说明文档

    ICE中间件说明文档 1       ICE中间件简介 2       平台核心功能 2.1        接口描述语言(Slice) 2.2        ICE运行时 2.2.1         ...

  3. 一起刑事案件法庭辩护 z

    [案件地位]  这是一起各方争议很大的刑事案件.侦查机关曾将该案以非法拘禁罪立案侦查,以故意杀人罪移送检察机关审查起诉,公诉机关以非法拘禁形成故意伤害(致死)起诉,而法院最终以故意伤害罪判决,并且排除 ...

  4. [原创博文] 用Python做统计分析 (Scipy.stats的文档)

    [转自] 用Python做统计分析 (Scipy.stats的文档) 对scipy.stats的详细介绍: 这个文档说了以下内容,对python如何做统计分析感兴趣的人可以看看,毕竟Python的库也 ...

  5. solr学习之添加文档

    一.开篇语 其实Solr就是一个你可以通过他来查询文档的东西,他整个都是基于Document的,那么这些Document从何而来列?  当然是我们给他,而这些来源就包括了:数据库文件,XML,Json ...

  6. 配置webstorm使用supervisor时出现 /usr/bin/env: node: 没有那个文件或目录 解决方法

    配置好supervisor路径后 出现了 启动时出现了 /usr/bin/env: node: 没有那个文件或目录 需要讲.nvm下的node链接到, /usr/bin/目录下 sudo ln -s ...

  7. [ActionScript 3.0] AS3.0 获取文本的明暗度

    /** * 获取文字的明暗值 * @param t 文字 * @return Number */ function getDensity(t:String):Number { var ttf:Text ...

  8. JDBC中的PreparedStatement-防止SQL注入攻击

    在JDBC对数据库进行操作的时候,SQL注入是一种常见的针对数据库的注入攻击方式.如下面的代码所演示,在我们的提交字段中掺入了SQL语句,会使得程序的登录校验失效: package org.lyk.m ...

  9. shell export

    export命令将使系统在创建每一个新的shell时定义这个变量的一个拷贝.这个过程称之为变量输出. 在脚本中export,跟在终端export原理一样. 他们都是一个子shell. http://b ...

  10. Android 中获取 debug 测试 SHA1 和 release SHA1 证书指纹数据的方法

    百度地图开发的时候要申请KEY,需要提供SHA1证书指纹数据 Eclipse eclipse中直接查看:windows -> preferance -> android -> bui ...