summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip/stack/stack.go
diff options
context:
space:
mode:
authorRahat Mahmood <rahat@google.com>2019-08-01 13:57:41 -0700
committergVisor bot <gvisor-bot@google.com>2019-08-01 13:58:48 -0700
commit79511e8a50facd509b8180d0160762b510dd6196 (patch)
treeef7dbd6a36361a9e84a7287d6e54fcbae7a4edd6 /pkg/tcpip/stack/stack.go
parent0a246fab80581351309cdfe39ffeeffa00f811b1 (diff)
Implement getsockopt(TCP_INFO).
Export some readily-available fields for TCP_INFO and stub out the rest. PiperOrigin-RevId: 261191548
Diffstat (limited to 'pkg/tcpip/stack/stack.go')
-rw-r--r--pkg/tcpip/stack/stack.go30
1 files changed, 30 insertions, 0 deletions
diff --git a/pkg/tcpip/stack/stack.go b/pkg/tcpip/stack/stack.go
index 6156c3f46..7c31cf493 100644
--- a/pkg/tcpip/stack/stack.go
+++ b/pkg/tcpip/stack/stack.go
@@ -208,6 +208,10 @@ type TCPSenderState struct {
// Cubic holds the state related to CUBIC congestion control.
Cubic TCPCubicState
+
+ // MSS is the size of the largest segment that can be sent without
+ // fragmentation.
+ MSS int
}
// TCPSACKInfo holds TCP SACK related information for a given TCP endpoint.
@@ -220,6 +224,9 @@ type TCPSACKInfo struct {
// from the peer endpoint.
ReceivedBlocks []header.SACKBlock
+ // Sacked is the current number of bytes held in the SACK scoreboard.
+ Sacked seqnum.Size
+
// MaxSACKED is the highest sequence number that has been SACKED
// by the peer.
MaxSACKED seqnum.Value
@@ -269,6 +276,14 @@ type TCPEndpointState struct {
// ID is a copy of the TransportEndpointID for the endpoint.
ID TCPEndpointID
+ // ProtocolState denotes the TCP state the endpoint is currently
+ // in, encoded in a netstack-specific manner. Should be translated
+ // to the Linux ABI before exposing to userspace.
+ ProtocolState uint32
+
+ // AMSS is the MSS advertised to the peer by this endpoint.
+ AMSS uint16
+
// SegTime denotes the absolute time when this segment was received.
SegTime time.Time
@@ -286,6 +301,18 @@ type TCPEndpointState struct {
// RcvClosed if true, indicates the endpoint has been closed for reading.
RcvClosed bool
+ // RcvLastAck is the time of receipt of the last packet with the
+ // ACK flag set.
+ RcvLastAckNanos int64
+
+ // RcvLastData is the time of reciept of the last packet
+ // containing data.
+ RcvLastDataNanos int64
+
+ // RcvMSS is the size of the largest segment the receiver is willing to
+ // accept, not including TCP headers and options.
+ RcvMSS int
+
// SendTSOk is used to indicate when the TS Option has been negotiated.
// When sendTSOk is true every non-RST segment should carry a TS as per
// RFC7323#section-1.1.
@@ -326,6 +353,9 @@ type TCPEndpointState struct {
// SndMTU is the smallest MTU seen in the control packets received.
SndMTU int
+ // MaxOptionSize is the maximum size of TCP options.
+ MaxOptionSize int
+
// Receiver holds variables related to the TCP receiver for the endpoint.
Receiver TCPReceiverState