bridge

package
v0.0.0-...-2208570 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 27, 2021 License: BSD-2-Clause Imports: 11 Imported by: 0

Documentation

Overview

link/bridge implements a bridging LinkEndpoint It can be writable.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BridgeableEndpoint

type BridgeableEndpoint struct {
	nested.Endpoint
	// contains filtered or unexported fields
}

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

func (ep *Endpoint) Down() error

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 (ep *Endpoint) IsAttached() bool

func (*Endpoint) LinkAddress

func (ep *Endpoint) LinkAddress() tcpip.LinkAddress

func (*Endpoint) MTU

func (ep *Endpoint) MTU() uint32

func (*Endpoint) MaxHeaderLength

func (ep *Endpoint) MaxHeaderLength() uint16

func (*Endpoint) SetPromiscuousMode

func (ep *Endpoint) SetPromiscuousMode(bool) error

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

func (ep *Endpoint) Up() error

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) Wait

func (ep *Endpoint) Wait()

Wait implements stack.LinkEndpoint.

func (*Endpoint) WritePacket

func (ep *Endpoint) WritePacket(r stack.RouteInfo, gso *stack.GSO, protocol tcpip.NetworkProtocolNumber, pkt *stack.PacketBuffer) tcpip.Error

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL