TCP Packet Analysis Packet Loss – What Happens in SACK with Multiple Gaps in Received Packets?

packet-analysispacket-losstcp

Suppose a client has received 0 to 500, 900 to 1100 and 1300 to 2000 how will ACK and SACK look like? Does it look like this ACK: 500 SACK:900-1100 and then it asks for the packets 1100 to 1300 in new request.

Best Answer

The Selective ACK Option can specify more than one "block" of received traffic. Here is what the option looks like on the wire (taken from RFC 2018, Section 3):

                     +--------+--------+
                     | Kind=5 | Length |
   +--------+--------+--------+--------+
   |      Left Edge of 1st Block       |
   +--------+--------+--------+--------+
   |      Right Edge of 1st Block      |
   +--------+--------+--------+--------+
   |                                   |
   /            . . .                  /
   |                                   |
   +--------+--------+--------+--------+
   |      Left Edge of nth Block       |
   +--------+--------+--------+--------+
   |      Right Edge of nth Block      |
   +--------+--------+--------+--------+

According your example:

Suppose a client has received 0 to 500, 900 to 1100 and 1300 to 2000 how will ACK and SACK look like?

Your suggestion is almost correct, except for accounting for the additional Left and Right edge of the received bytes.

TCP ACK - 501 (in TCP header, not in SACK Option)
TCP SACK - 1st block Left Edge  - 900
TCP SACK - 1st block Right Edge - 1100
TCP SACK - 2nd block Left Edge  - 1300
TCP SACK - 2nd block Right Edge - 2000
(all in the same Segment)

There are additional examples and use cases in RFC 2018 Section 7. They are worth reading through to fully wrap your mind around it.

Related Topic