diff options
author | Ian Gudger <igudger@google.com> | 2019-02-08 15:36:22 -0800 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2019-02-08 15:37:20 -0800 |
commit | 967326131a875047c2b2d51bf4b2984ceefd4730 (patch) | |
tree | 6a56b0ec74f09cee3640ad2a8505dbe61b98cdec /pkg/tcpip/link/muxed/injectable.go | |
parent | b2aa213dd2e19d88b4edf839d20e5bf51534be62 (diff) |
Fix build error.
PiperOrigin-RevId: 233139020
Change-Id: I2e7089fa25d20e5662eb941054a684d41f5d3e12
Diffstat (limited to 'pkg/tcpip/link/muxed/injectable.go')
-rw-r--r-- | pkg/tcpip/link/muxed/injectable.go | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/pkg/tcpip/link/muxed/injectable.go b/pkg/tcpip/link/muxed/injectable.go index 1215ba1e7..9d85bda60 100644 --- a/pkg/tcpip/link/muxed/injectable.go +++ b/pkg/tcpip/link/muxed/injectable.go @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Package injectable provides a muxed injectable endpoint. -package injectable +// Package muxed provides a muxed link endpoints. +package muxed import ( "gvisor.googlesource.com/gvisor/pkg/tcpip" @@ -21,17 +21,17 @@ import ( "gvisor.googlesource.com/gvisor/pkg/tcpip/stack" ) -// MuxedInjectableEndpoint is an injectable multi endpoint. The endpoint has +// InjectableEndpoint is an injectable multi endpoint. The endpoint has // trivial routing rules that determine which InjectableEndpoint a given packet // will be written to. Note that HandleLocal works differently for this // endpoint (see WritePacket). -type MuxedInjectableEndpoint struct { +type InjectableEndpoint struct { routes map[tcpip.Address]stack.InjectableLinkEndpoint dispatcher stack.NetworkDispatcher } // MTU implements stack.LinkEndpoint. -func (m *MuxedInjectableEndpoint) MTU() uint32 { +func (m *InjectableEndpoint) MTU() uint32 { minMTU := ^uint32(0) for _, endpoint := range m.routes { if endpointMTU := endpoint.MTU(); endpointMTU < minMTU { @@ -42,7 +42,7 @@ func (m *MuxedInjectableEndpoint) MTU() uint32 { } // Capabilities implements stack.LinkEndpoint. -func (m *MuxedInjectableEndpoint) Capabilities() stack.LinkEndpointCapabilities { +func (m *InjectableEndpoint) Capabilities() stack.LinkEndpointCapabilities { minCapabilities := stack.LinkEndpointCapabilities(^uint(0)) for _, endpoint := range m.routes { minCapabilities &= endpoint.Capabilities() @@ -51,7 +51,7 @@ func (m *MuxedInjectableEndpoint) Capabilities() stack.LinkEndpointCapabilities } // MaxHeaderLength implements stack.LinkEndpoint. -func (m *MuxedInjectableEndpoint) MaxHeaderLength() uint16 { +func (m *InjectableEndpoint) MaxHeaderLength() uint16 { minHeaderLen := ^uint16(0) for _, endpoint := range m.routes { if headerLen := endpoint.MaxHeaderLength(); headerLen < minHeaderLen { @@ -62,12 +62,12 @@ func (m *MuxedInjectableEndpoint) MaxHeaderLength() uint16 { } // LinkAddress implements stack.LinkEndpoint. -func (m *MuxedInjectableEndpoint) LinkAddress() tcpip.LinkAddress { +func (m *InjectableEndpoint) LinkAddress() tcpip.LinkAddress { return "" } // Attach implements stack.LinkEndpoint. -func (m *MuxedInjectableEndpoint) Attach(dispatcher stack.NetworkDispatcher) { +func (m *InjectableEndpoint) Attach(dispatcher stack.NetworkDispatcher) { for _, endpoint := range m.routes { endpoint.Attach(dispatcher) } @@ -75,28 +75,28 @@ func (m *MuxedInjectableEndpoint) Attach(dispatcher stack.NetworkDispatcher) { } // IsAttached implements stack.LinkEndpoint. -func (m *MuxedInjectableEndpoint) IsAttached() bool { +func (m *InjectableEndpoint) IsAttached() bool { return m.dispatcher != nil } // Inject implements stack.InjectableLinkEndpoint. -func (m *MuxedInjectableEndpoint) Inject(protocol tcpip.NetworkProtocolNumber, vv buffer.VectorisedView) { +func (m *InjectableEndpoint) Inject(protocol tcpip.NetworkProtocolNumber, vv buffer.VectorisedView) { m.dispatcher.DeliverNetworkPacket(m, "" /* remote */, "" /* local */, protocol, vv) } // WritePacket writes outbound packets to the appropriate LinkInjectableEndpoint // based on the RemoteAddress. HandleLocal only works if r.RemoteAddress has a // route registered in this endpoint. -func (m *MuxedInjectableEndpoint) WritePacket(r *stack.Route, hdr buffer.Prependable, payload buffer.VectorisedView, protocol tcpip.NetworkProtocolNumber) *tcpip.Error { +func (m *InjectableEndpoint) WritePacket(r *stack.Route, hdr buffer.Prependable, payload buffer.VectorisedView, protocol tcpip.NetworkProtocolNumber) *tcpip.Error { if endpoint, ok := m.routes[r.RemoteAddress]; ok { return endpoint.WritePacket(r, hdr, payload, protocol) } return tcpip.ErrNoRoute } -// NewMuxedInjectableEndpoint creates a new multi-fd-based injectable endpoint. -func NewMuxedInjectableEndpoint(routes map[tcpip.Address]stack.InjectableLinkEndpoint, mtu uint32) (tcpip.LinkEndpointID, *MuxedInjectableEndpoint) { - e := &MuxedInjectableEndpoint{ +// NewInjectableEndpoint creates a new multi-fd-based injectable endpoint. +func NewInjectableEndpoint(routes map[tcpip.Address]stack.InjectableLinkEndpoint, mtu uint32) (tcpip.LinkEndpointID, *InjectableEndpoint) { + e := &InjectableEndpoint{ routes: routes, } return stack.RegisterLinkEndpoint(e), e |