分类: 网络与安全
2012-02-21 14:08:04
如何检查一个tcp rst包的序列号是否正确,tcp的RFC是这样规定的:
只要tcp rst的序列号在窗口之内,就是一个正确的tcp包。言下之意就是,如果当前的sequence是x,windown是y,而window scale是z,那么,只要rst的sequence是:
| x - rst_sequence | <= y << z
tcp的rfc的原文如下:
In all states except SYN-SENT, all reset (RST) segments are validated by checking their SEQ-fields. A reset is valid if its sequence number is in the window. In the SYN-SENT state (a RST received in response to an initial SYN), the RST is acceptable if the ACK field acknowledges the SYN.