之前做过关于 sack dsack相关笔记:tcp dsack
其实关于sack的不好之处 也是比较明显的:在一定程度上来说,SACK可能就像DOS攻击一样,每次遍历都要消耗大量CPU,时间复杂度为O(n^2),n为packets in flight的数量。
SACK Advantages
Receiver informs the sender about all the PDUs that have been received successfully.
Sender retransmits only the PDUs that have not been Acked.
Implemented using two TCP options.
SACK –Permitted Option
First option: enabling option(2 bytes) sent in a SYN
Indicates SACK option can be used once connection established
—Receiver may return SACK’s
—-Sender can process SACK’s
SACK Rules
SACK does not change the meaning of ACK field.
SACK cannot be sent unless SACK permitted option has been received.
If SACKs are sent, they should be included in all TCP-PDUs when out-of-order data has been buffered.
First SACK must ack most recently received out-of-order PDU.
SACK Rules Receiver
Receiver returns as many distinct SACKs as possible.
SACK option is filled out by repeating most recently reported SACK blocks.
There may be some data in receiver’s queue which should be SACKed but is not.
SACK Rules Sender
Records the SACK for future reference.
Maintains a retransmission queue containing unacknowledged PDUs.
Turns SACK bit on when sender receives a SACK.
Skips SACK PDUs during retransmission.
Retransmits the PDUs not SACKed so far and less than the highest SACKed PDU.
Turns off SACK bit after retransmission time out.
Reneging
Reneging is a case when the receiver SACK some data and later discards that data. Such discarding is discouraged, but permitted if the receiver runs out of the buffer space.
If Reneging occurs
The first SACK should reflect the newest PDU even if the PDU is going to be discarded.
Except for the newest PDU, all SACK blocks must not Ack any data which is no longer held by receiver.
Consequences of Reneging
Sender must maintain normal TCP timeouts. A PDU cannot be considered acknowledged until its ACK by cumulative acknowledgement.
PDU’s cannot be removed from the transmit buffer until ACK by the cumulative acknowledgement.
Duplicate SACK (DSACK)Extension to SACK
When D-SACK is used, the first block of the SACK option should specify the duplicate PDU.
D-SACK block is used to report duplicate contiguous sequence of data received by the receiver in the most recent packet.
Each duplicate is reported at most once.
Allows the sender TCP to determine when a retransmission is not necessary.
D-SACK TCP Rules
If D-SACK block reports duplicate PDU from (possibly larger) block of data in the receiver buffer above the cumulative acknowledgement, the second SACK block (the first non D-SACK block) should specify this block.
As only, the first SACK block is considered as D-SACK block, if multiple sequences are duplicated, only the first is contained in the D-SACK block.
D-SACK TCP & Retransmissions
D-SACK allows TCP to determine when retransmission is not necessary and thereby undo congestion control measures.
D-SACK allows TCP to determine if the network is duplicating packets.
D-SACK does not allow a sender to determine if both the original and retransmitted PDU are received, or the original is lost and the retransmitted PDU is duplicated by the network.
SACK & D-SACK Interaction
No difference between SACK & D-SACK, except that first SACK block is used to report a duplicate PDU in D-SACK.
No separate negotiation/options for D-SACK.
D-SACK is compatible with current implementations of SACK option in TCP.
参考:
ftp://ftp.rfc-editor.org/in-notes/rfc2018.txt
ftp://ftp.rfc-editor.org/in-notes/rfc2883.txt
Professor Amer’s Slide
http://www.cse.nd.edu/~surendar/teach/spr03/cse598N/Lectures/Lecture13.pdf
以上可以在内容来自https://www.eecis.udel.edu/~amer/856/sack.04f.ppt
引入D-SACK的目的是使TCP进行更好的流控,具体来说有以下几个好处:
1. 让发送方知道,是发送的包丢了,还是返回的ACK包丢了;
2. 网络上是否出现了包失序;
3. 数据包是否被网络上的路由器复制并转发了
4. 是不是自己的timeout太小了,导致重传
通过D-SACK这种方法,发送方可以更仔细判断出当前网络的传输情况,可以发现数据段被网络复制、错误重传、ACK丢失引起的重传、重传超时等异常的网络状。
D-SACK使用了SACK的第一个段来做标志,如何判断D-SACK:
1. 如果SACK的第一个段的范围被ACK所覆盖,那么就是D-SACK
2. 如果SACK的第一个段的范围被SACK的第二个段覆盖,那么就是D-SACK
D-SACK的规则如下:
1. 第一个block将包含重复收到的报文段的序号 2. 跟在D-SACK之后的SACK将按照SACK的方式工作 3. 如果有多个被重复接收的报文段,则D-SACK只包含其中第一个
http代理服务器(3-4-7层代理)-网络事件库公共组件、内核kernel驱动 摄像头驱动 tcpip网络协议栈、netfilter、bridge 好像看过!!!!
但行好事 莫问前程
–身高体重180的胖子