veth

package
v0.0.0-...-3ca94ff Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2024 License: Apache-2.0, MIT Imports: 4 Imported by: 0

Documentation

Overview

Package veth provides the implementation of virtual ethernet device pair.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewPair

func NewPair(mtu uint32) (*Endpoint, *Endpoint)

NewPair creates a new veth pair.

Types

type Endpoint

type Endpoint struct {
	// contains filtered or unexported fields
}

Endpoint is link layer endpoint that redirects packets to a pair veth endpoint.

+stateify savable

func (*Endpoint) ARPHardwareType

func (*Endpoint) ARPHardwareType() header.ARPHardwareType

ARPHardwareType implements stack.LinkEndpoint.ARPHardwareType.

func (*Endpoint) AddHeader

func (e *Endpoint) AddHeader(pkt *stack.PacketBuffer)

AddHeader implements stack.LinkEndpoint.AddHeader.

func (*Endpoint) Attach

func (e *Endpoint) Attach(dispatcher stack.NetworkDispatcher)

Attach saves the stack network-layer dispatcher for use later when packets are injected.

func (*Endpoint) Capabilities

func (e *Endpoint) Capabilities() stack.LinkEndpointCapabilities

Capabilities implements stack.LinkEndpoint.Capabilities.

func (*Endpoint) Close

func (e *Endpoint) Close()

Close closes e. Further packet injections will return an error, and all pending packets are discarded. Close may be called concurrently with WritePackets.

func (*Endpoint) GSOMaxSize

func (*Endpoint) GSOMaxSize() uint32

GSOMaxSize implements stack.GSOEndpoint.

func (*Endpoint) InjectInbound

func (e *Endpoint) InjectInbound(protocol tcpip.NetworkProtocolNumber, pkt *stack.PacketBuffer)

InjectInbound injects an inbound packet. If the endpoint is not attached, the packet is not delivered.

func (*Endpoint) IsAttached

func (e *Endpoint) IsAttached() bool

IsAttached implements stack.LinkEndpoint.IsAttached.

func (*Endpoint) LinkAddress

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

LinkAddress returns the link address of this endpoint.

func (*Endpoint) MTU

func (e *Endpoint) MTU() uint32

MTU implements stack.LinkEndpoint.MTU.

func (*Endpoint) MaxHeaderLength

func (*Endpoint) MaxHeaderLength() uint16

MaxHeaderLength returns the maximum size of the link layer header. Given it doesn't have a header, it just returns 0.

func (*Endpoint) ParseHeader

func (e *Endpoint) ParseHeader(pkt *stack.PacketBuffer) bool

ParseHeader implements stack.LinkEndpoint.ParseHeader.

func (*Endpoint) SetLinkAddress

func (e *Endpoint) SetLinkAddress(addr tcpip.LinkAddress)

SetLinkAddress implements stack.LinkEndpoint.SetLinkAddress.

func (*Endpoint) SetMTU

func (e *Endpoint) SetMTU(mtu uint32)

SetMTU implements stack.LinkEndpoint.SetMTU.

func (*Endpoint) SetOnCloseAction

func (e *Endpoint) SetOnCloseAction(action func())

SetOnCloseAction implements stack.LinkEndpoint.

func (*Endpoint) SupportedGSO

func (e *Endpoint) SupportedGSO() stack.SupportedGSO

SupportedGSO implements stack.GSOEndpoint.

func (*Endpoint) Wait

func (*Endpoint) Wait()

Wait implements stack.LinkEndpoint.Wait.

func (*Endpoint) WritePackets

func (e *Endpoint) WritePackets(pkts stack.PacketBufferList) (int, tcpip.Error)

WritePackets stores outbound packets into the channel. Multiple concurrent calls are permitted.

Jump to

Keyboard shortcuts

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