diff options
author | gVisor bot <gvisor-bot@google.com> | 2020-12-02 17:25:36 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-12-02 17:25:36 +0000 |
commit | b270a7543cc938f2e63a566ff84e52fced948f9f (patch) | |
tree | ee94f75d653854491708098913cd84baa76ae0bb /pkg/tcpip/transport/tcp | |
parent | aafe6306314ffd0bd11079c9496e4e48f77324ad (diff) | |
parent | f156fb6531918f62c1a14363af97240588948202 (diff) |
Merge release-20201117.0-92-gf156fb653 (automated)
Diffstat (limited to 'pkg/tcpip/transport/tcp')
-rw-r--r-- | pkg/tcpip/transport/tcp/endpoint.go | 23 | ||||
-rw-r--r-- | pkg/tcpip/transport/tcp/tcp_state_autogen.go | 30 |
2 files changed, 46 insertions, 7 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, diff --git a/pkg/tcpip/transport/tcp/tcp_state_autogen.go b/pkg/tcpip/transport/tcp/tcp_state_autogen.go index 6c4f93499..fbd76c04b 100644 --- a/pkg/tcpip/transport/tcp/tcp_state_autogen.go +++ b/pkg/tcpip/transport/tcp/tcp_state_autogen.go @@ -127,13 +127,36 @@ func (r *rcvBufAutoTuneParams) StateLoad(stateSourceObject state.Source) { stateSourceObject.LoadValue(5, new(unixTime), func(y interface{}) { r.loadRttMeasureTime(y.(unixTime)) }) } +func (e *EndpointInfo) StateTypeName() string { + return "pkg/tcpip/transport/tcp.EndpointInfo" +} + +func (e *EndpointInfo) StateFields() []string { + return []string{ + "TransportEndpointInfo", + } +} + +func (e *EndpointInfo) beforeSave() {} + +func (e *EndpointInfo) StateSave(stateSinkObject state.Sink) { + e.beforeSave() + stateSinkObject.Save(0, &e.TransportEndpointInfo) +} + +func (e *EndpointInfo) afterLoad() {} + +func (e *EndpointInfo) StateLoad(stateSourceObject state.Source) { + stateSourceObject.Load(0, &e.TransportEndpointInfo) +} + func (e *endpoint) StateTypeName() string { return "pkg/tcpip/transport/tcp.endpoint" } func (e *endpoint) StateFields() []string { return []string{ - "TransportEndpointInfo", + "EndpointInfo", "DefaultSocketOptionsHandler", "waiterQueue", "uniqueID", @@ -211,7 +234,7 @@ func (e *endpoint) StateSave(stateSinkObject state.Sink) { stateSinkObject.SaveValue(26, recentTSTimeValue) var acceptedChanValue []*endpoint = e.saveAcceptedChan() stateSinkObject.SaveValue(50, acceptedChanValue) - stateSinkObject.Save(0, &e.TransportEndpointInfo) + stateSinkObject.Save(0, &e.EndpointInfo) stateSinkObject.Save(1, &e.DefaultSocketOptionsHandler) stateSinkObject.Save(2, &e.waiterQueue) stateSinkObject.Save(3, &e.uniqueID) @@ -272,7 +295,7 @@ func (e *endpoint) StateSave(stateSinkObject state.Sink) { } func (e *endpoint) StateLoad(stateSourceObject state.Source) { - stateSourceObject.Load(0, &e.TransportEndpointInfo) + stateSourceObject.Load(0, &e.EndpointInfo) stateSourceObject.Load(1, &e.DefaultSocketOptionsHandler) stateSourceObject.LoadWait(2, &e.waiterQueue) stateSourceObject.Load(3, &e.uniqueID) @@ -999,6 +1022,7 @@ func init() { state.Register((*cubicState)(nil)) state.Register((*SACKInfo)(nil)) state.Register((*rcvBufAutoTuneParams)(nil)) + state.Register((*EndpointInfo)(nil)) state.Register((*endpoint)(nil)) state.Register((*keepalive)(nil)) state.Register((*rackControl)(nil)) |