summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip/header/tcp.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/tcpip/header/tcp.go')
-rw-r--r--pkg/tcpip/header/tcp.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/pkg/tcpip/header/tcp.go b/pkg/tcpip/header/tcp.go
index 567a21167..207046b36 100644
--- a/pkg/tcpip/header/tcp.go
+++ b/pkg/tcpip/header/tcp.go
@@ -17,6 +17,7 @@ package header
import (
"encoding/binary"
+ "github.com/google/btree"
"gvisor.googlesource.com/gvisor/pkg/tcpip"
"gvisor.googlesource.com/gvisor/pkg/tcpip/seqnum"
)
@@ -131,6 +132,16 @@ type SACKBlock struct {
End seqnum.Value
}
+// Less returns true if r.Start < b.Start.
+func (r SACKBlock) Less(b btree.Item) bool {
+ return r.Start.LessThan(b.(SACKBlock).Start)
+}
+
+// Contains returns true if b is completely contained in r.
+func (r SACKBlock) Contains(b SACKBlock) bool {
+ return r.Start.LessThanEq(b.Start) && b.End.LessThanEq(r.End)
+}
+
// TCPOptions are used to parse and cache the TCP segment options for a non
// syn/syn-ack segment.
//