程序员一个。14年毕业。
分类: LINUX
2014-09-26 09:43:41
If the state is SYN-SENT then
first check the ACK bit
If the ACK bit is set
If SEG.ACK =< ISS, or SEG.ACK > SND.NXT, send a reset (unless
the RST bit is set, if so drop the segment and return)
and discard the segment. Return.
If SND.UNA =< SEG.ACK =< SND.NXT then the ACK is acceptable.
second check the RST bit
[Page 66]
September 1981
Transmission Control Protocol
Functional Specification
SEGMENT ARRIVES
If the RST bit is set
If the ACK was acceptable then signal the user "error:
connection reset", drop the segment, enter CLOSED state,
delete TCB, and return. Otherwise (no ACK) drop the segment
and return.
third check the security and precedence
If the security/compartment in the segment does not exactly
match the security/compartment in the TCB, send a reset
If there is an ACK
Otherwise
If there is an ACK
The precedence in the segment must match the precedence in the
TCB, if not, send a reset
If there is no ACK
If the precedence in the segment is higher than the precedence
in the TCB then if allowed by the user and the system raise
the precedence in the TCB to that in the segment, if not
allowed to raise the prec then send a reset.
If the precedence in the segment is lower than the precedence
in the TCB continue.
If a reset was sent, discard the segment and return.
fourth check the SYN bit
This step should be reached only if the ACK is ok, or there is
no ACK, and it the segment did not contain a RST.
If the SYN bit is on and the security/compartment and precedence
[Page 67]
September 1981
Transmission Control Protocol
Functional Specification
SEGMENT ARRIVES
are acceptable then, RCV.NXT is set to SEG.SEQ+1, IRS is set to
SEG.SEQ. SND.UNA should be advanced to equal SEG.ACK (if there
is an ACK), and any segments on the retransmission queue which
are thereby acknowledged should be removed.
If SND.UNA > ISS (our SYN has been ACKed), change the connection
state to ESTABLISHED, form an ACK segment
and send it. Data or controls which were queued for
transmission may be included. If there are other controls or
text in the segment then continue processing at the sixth step
below where the URG bit is checked, otherwise return.
Otherwise enter SYN-RECEIVED, form a SYN,ACK segment
and send it. If there are other controls or text in the
segment, queue them for processing after the ESTABLISHED state
has been reached, return.
fifth, if neither of the SYN or RST bits is set then drop the
segment and return.
呵呵呵呵呵呵。