bridge

package
v0.0.0-...-bbc9ce3 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2021 License: BSD-2-Clause Imports: 13 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) IsBridged

func (e *BridgeableEndpoint) IsBridged() bool

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, error)

New creates a new link from a list of BridgeableEndpoints that bridges packets written to it and received from any of its constituent links.

`links` must be non-empty, as properties of the new link are derived from the constituent links: it will have the minimum of the MTUs, the maximum of the max header lengths, and the minimum set of capabilities.

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 (*Endpoint) Down() error

TODO(https://fxbug.dev/86388): Implement disabling the bridge.

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 (*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 (*Endpoint) Up() error

func (*Endpoint) Wait

func (*Endpoint) Wait()

Wait implements stack.LinkEndpoint.

func (*Endpoint) WritePacket

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

func (*Endpoint) WritePackets

func (ep *Endpoint) WritePackets(r stack.RouteInfo, pkts stack.PacketBufferList, protocol tcpip.NetworkProtocolNumber) (int, tcpip.Error)

WritePackets returns the number of packets in hdrs that were successfully written to all links.

func (*Endpoint) WriteRawPacket

func (ep *Endpoint) WriteRawPacket(pkt *stack.PacketBuffer) tcpip.Error

Jump to

Keyboard shortcuts

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