diff options
author | Ayush Ranjan <ayushranjan@google.com> | 2020-12-02 09:19:02 -0800 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-12-02 09:21:59 -0800 |
commit | f156fb6531918f62c1a14363af97240588948202 (patch) | |
tree | c7c68ab8c4e05a18bf09f4f946231d174d780b4d /pkg/tcpip/transport | |
parent | 9f02d2653bb790e8403b1c8b54656e06eb908802 (diff) |
[netstack] Add back EndpointInfo struct in tcp.
This was removed in an earlier commit. This should remain as it allows to add
tcp-only state to be exposed.
PiperOrigin-RevId: 345246155
Diffstat (limited to 'pkg/tcpip/transport')
-rw-r--r-- | pkg/tcpip/transport/tcp/endpoint.go | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/pkg/tcpip/transport/tcp/endpoint.go b/pkg/tcpip/transport/tcp/endpoint.go index d321869c4..87eda2efb 100644 --- a/pkg/tcpip/transport/tcp/endpoint.go +++ b/pkg/tcpip/transport/tcp/endpoint.go @@ -309,6 +309,19 @@ type Stats struct { // marker interface. func (*Stats) IsEndpointStats() {} +// EndpointInfo holds useful information about a transport endpoint which +// can be queried by monitoring tools. This exists to allow tcp-only state to +// be exposed. +// +// +stateify savable +type EndpointInfo struct { + stack.TransportEndpointInfo +} + +// IsEndpointInfo is an empty method to implement the tcpip.EndpointInfo +// marker interface. +func (*EndpointInfo) IsEndpointInfo() {} + // endpoint represents a TCP endpoint. This struct serves as the interface // between users of the endpoint and the protocol implementation; it is legal to // have concurrent goroutines make calls into the endpoint, they are properly @@ -349,7 +362,7 @@ func (*Stats) IsEndpointStats() {} // // +stateify savable type endpoint struct { - stack.TransportEndpointInfo + EndpointInfo tcpip.DefaultSocketOptionsHandler // endpointEntry is used to queue endpoints for processing to the @@ -837,9 +850,11 @@ type keepalive struct { func newEndpoint(s *stack.Stack, netProto tcpip.NetworkProtocolNumber, waiterQueue *waiter.Queue) *endpoint { e := &endpoint{ stack: s, - TransportEndpointInfo: stack.TransportEndpointInfo{ - NetProto: netProto, - TransProto: header.TCPProtocolNumber, + EndpointInfo: EndpointInfo{ + TransportEndpointInfo: stack.TransportEndpointInfo{ + NetProto: netProto, + TransProto: header.TCPProtocolNumber, + }, }, waiterQueue: waiterQueue, state: StateInitial, |