mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Fix IsLost check to match the description in RFC6675.
quoting what "rscheff@gmx.at" pointed out over email. "IsLost in RFC3517 is defined as >= (DupThresh * SMSS) while RFC6675 improves upon this, and defines IsLost as > ((DupThresh - 1) * SMSS + 1). The latter addresses situations where partial segments (size < MSS) are sent (eg. last segment of a http protocol message sent with PSH being less than MSS is common)." PiperOrigin-RevId: 231512331 Change-Id: I1addd4a92e3e7baeb0bdda46463ebfae435da958
This commit is contained in:
committed by
Shentubot
parent
53afa68988
commit
f03c7e48e7
@@ -201,7 +201,7 @@ func (s *SACKScoreboard) IsLost(r header.SACKBlock) bool {
|
||||
}
|
||||
nDupSACKBytes += sacked.Start.Size(sacked.End)
|
||||
nDupSACK++
|
||||
if nDupSACK >= nDupAckThreshold || nDupSACKBytes >= seqnum.Size(nDupAckThreshold*s.smss) {
|
||||
if nDupSACK >= nDupAckThreshold || nDupSACKBytes >= seqnum.Size((nDupAckThreshold-1)*s.smss) {
|
||||
isLost = true
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -94,20 +94,21 @@ func TestSACKScoreboardIsLost(t *testing.T) {
|
||||
s.Insert(header.SACKBlock{51, 100})
|
||||
s.Insert(header.SACKBlock{111, 120})
|
||||
s.Insert(header.SACKBlock{101, 110})
|
||||
s.Insert(header.SACKBlock{121, 151})
|
||||
s.Insert(header.SACKBlock{121, 141})
|
||||
testCases := []struct {
|
||||
block header.SACKBlock
|
||||
lost bool
|
||||
}{
|
||||
{header.SACKBlock{0, 1}, true},
|
||||
{header.SACKBlock{1, 2}, false},
|
||||
{header.SACKBlock{1, 45}, false},
|
||||
{header.SACKBlock{50, 51}, true},
|
||||
// This one should return true because there are > 3* 10 (smss)
|
||||
// bytes that have been sacked above this sequence number.
|
||||
{header.SACKBlock{119, 120}, true},
|
||||
{header.SACKBlock{120, 121}, true},
|
||||
{header.SACKBlock{125, 126}, false},
|
||||
{block: header.SACKBlock{0, 1}, lost: true},
|
||||
{block: header.SACKBlock{1, 2}, lost: false},
|
||||
{block: header.SACKBlock{1, 45}, lost: false},
|
||||
{block: header.SACKBlock{50, 51}, lost: true},
|
||||
// This one should return true because there are
|
||||
// > (nDupAckThreshold - 1) * 10 (smss) bytes that have been sacked above
|
||||
// this sequence number.
|
||||
{block: header.SACKBlock{119, 120}, lost: true},
|
||||
{block: header.SACKBlock{120, 121}, lost: true},
|
||||
{block: header.SACKBlock{125, 126}, lost: false},
|
||||
}
|
||||
for _, tc := range testCases {
|
||||
if want, got := tc.lost, s.IsLost(tc.block); got != want {
|
||||
|
||||
Reference in New Issue
Block a user