Documentation ¶
Overview ¶
link/bridge implements a bridging LinkEndpoint It can be writable.
Index ¶
- type BridgeableEndpoint
- type Endpoint
- func (e *Endpoint) ARPHardwareType() header.ARPHardwareType
- func (e *Endpoint) AddHeader(local, remote tcpip.LinkAddress, protocol tcpip.NetworkProtocolNumber, ...)
- func (ep *Endpoint) Attach(d stack.NetworkDispatcher)
- func (ep *Endpoint) Capabilities() stack.LinkEndpointCapabilities
- func (ep *Endpoint) DeliverNetworkPacketToBridge(rxEP *BridgeableEndpoint, srcLinkAddr, dstLinkAddr tcpip.LinkAddress, ...)
- func (*Endpoint) DeviceClass() network.DeviceClass
- func (ep *Endpoint) Down() error
- func (ep *Endpoint) IsAttached() bool
- func (ep *Endpoint) LinkAddress() tcpip.LinkAddress
- func (ep *Endpoint) MTU() uint32
- func (ep *Endpoint) MaxHeaderLength() uint16
- func (ep *Endpoint) SetPromiscuousMode(bool) error
- func (ep *Endpoint) Up() error
- func (ep *Endpoint) Wait()
- func (ep *Endpoint) WritePacket(r stack.RouteInfo, gso *stack.GSO, protocol tcpip.NetworkProtocolNumber, ...) tcpip.Error
- func (ep *Endpoint) WritePackets(r stack.RouteInfo, gso *stack.GSO, pkts stack.PacketBufferList, ...) (int, tcpip.Error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BridgeableEndpoint ¶
func NewEndpoint ¶
func NewEndpoint(lower stack.LinkEndpoint) *BridgeableEndpoint
func (*BridgeableEndpoint) DeliverNetworkPacket ¶
func (e *BridgeableEndpoint) DeliverNetworkPacket(src, dst tcpip.LinkAddress, protocol tcpip.NetworkProtocolNumber, pkt *stack.PacketBuffer)
func (*BridgeableEndpoint) SetBridge ¶
func (e *BridgeableEndpoint) SetBridge(b *Endpoint)
type Endpoint ¶
type Endpoint struct {
// contains filtered or unexported fields
}
func New ¶
func New(links []*BridgeableEndpoint) *Endpoint
New creates a new link from a list of BridgeableEndpoints that bridges packets written to it and received from any of its constituent links.
The new link will have the minumum of the MTUs, the maximum of the max header lengths, and minimum set of the capabilities. This function takes ownership of `links`.
func (*Endpoint) ARPHardwareType ¶
func (e *Endpoint) ARPHardwareType() header.ARPHardwareType
ARPHardwareType implements stack.LinkEndpoint.
func (*Endpoint) AddHeader ¶
func (e *Endpoint) AddHeader(local, remote tcpip.LinkAddress, protocol tcpip.NetworkProtocolNumber, pkt *stack.PacketBuffer)
AddHeader implements stack.LinkEndpoint.
func (*Endpoint) Attach ¶
func (ep *Endpoint) Attach(d stack.NetworkDispatcher)
func (*Endpoint) Capabilities ¶
func (ep *Endpoint) Capabilities() stack.LinkEndpointCapabilities
func (*Endpoint) DeliverNetworkPacketToBridge ¶
func (ep *Endpoint) DeliverNetworkPacketToBridge(rxEP *BridgeableEndpoint, srcLinkAddr, dstLinkAddr tcpip.LinkAddress, protocol tcpip.NetworkProtocolNumber, pkt *stack.PacketBuffer)
DeliverNetworkPacketToBridge delivers a network packet to the bridged network.
Endpoint does not implement stack.NetworkEndpoint.DeliverNetworkPacket because we need to know which BridgeableEndpoint the packet was delivered from to prevent packet loops.
func (*Endpoint) DeviceClass ¶
func (*Endpoint) DeviceClass() network.DeviceClass
func (*Endpoint) Down ¶
Down calls SetBridge(nil) on all the constituent links of a bridge.
This causes each bridgeable endpoint to go back to its state before bridging, dispatching up the stack to the default NetworkDispatcher implementation directly.
func (*Endpoint) IsAttached ¶
func (*Endpoint) LinkAddress ¶
func (ep *Endpoint) LinkAddress() tcpip.LinkAddress
func (*Endpoint) MaxHeaderLength ¶
func (*Endpoint) SetPromiscuousMode ¶
SetPromiscuousMode on a bridge is a no-op, since all of the constituent links on a bridge need to already be in promiscuous mode for bridging to work.
func (*Endpoint) Up ¶
Up calls SetBridge(bridge) on all the constituent links of a bridge.
This causes each constituent link to delegate dispatch to the bridge, meaning that received packets will be written out of or dispatched back up the stack for another constituent link.
func (*Endpoint) WritePacket ¶
func (*Endpoint) WritePackets ¶
func (ep *Endpoint) WritePackets(r stack.RouteInfo, gso *stack.GSO, pkts stack.PacketBufferList, protocol tcpip.NetworkProtocolNumber) (int, tcpip.Error)
WritePackets returns the number of packets in hdrs that were successfully written to all links.