tap

package
v0.0.0-...-a9890c3 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2020 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FDB

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

FDB forwarding DB

func NewFDB

func NewFDB() *FDB

NewFDB inits a new FDB table and start GC timer

func (*FDB) AddEntry

func (tbl *FDB) AddEntry(vnid uint32, mac net.HardwareAddr, rdst net.IP)

AddEntry adds a forwarding entry to the table

func (*FDB) ListBroadcast

func (tbl *FDB) ListBroadcast(vnid uint32) []net.IP

ListBroadcast finds all broadcast dst VTEPs

func (*FDB) LookupMac

func (tbl *FDB) LookupMac(vnid uint32, mac net.HardwareAddr) net.IP

LookupMac finds dst VTEP for a given MAC

type FDBEntry

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

FDBEntry forwarding DB entry

type Listener

type Listener struct {
	FDB *FDB
	// contains filtered or unexported fields
}

Listener holds all vtep VNIs

func NewListener

func NewListener() (*Listener, error)

NewListener inits a new VTEP style listener

func (*Listener) AddEP

func (s *Listener) AddEP(vnid uint32, br *netlink.Bridge) error

AddEP adds a vtep handler to a bridge

func (*Listener) AddForwardEntry

func (s *Listener) AddForwardEntry(vnid uint32, mac net.HardwareAddr, ip net.IP) error

AddForwardEntry adds an entry to the FDB

func (*Listener) AddVLAN

func (s *Listener) AddVLAN(vnid uint32, vlan uint16) error

AddVLAN adds a VLAN to the vtep on the bridge

func (*Listener) DelEP

func (s *Listener) DelEP(vnid uint32) error

DelEP stops & deletes VTEP activity

func (*Listener) DelVLAN

func (s *Listener) DelVLAN(vnid uint32, vlan uint16) error

DelVLAN removes the VLAN to the vtep on the bridge

func (*Listener) ForwardingMiss

func (s *Listener) ForwardingMiss(vnid uint32) (<-chan transport.ForwardingMiss, error)

ForwardingMiss gets a readonly sub for FDB misses

func (*Listener) Send

func (s *Listener) Send(ps []protocol.Packet)

Send forwards or handles interally a set of packets

func (*Listener) SetMTU

func (s *Listener) SetMTU(mtu int32) error

SetMTU sets the MTU of the listening device

func (*Listener) SetSDN

func (s *Listener) SetSDN(sdn controller.Controller) error

SetSDN adds the SDN controller for ip lookups

func (*Listener) Start

func (s *Listener) Start() error

Start attaches the conn handler

func (*Listener) Status

func (s *Listener) Status(vnid uint32) transport.EPStatus

Status gets the status of the TAP

type Nic

type Nic interface {
	Stop() error
	Start()
	Write(b []byte) (int, error)
	Delete() error
	SetHandler(protocol.HandlerFunc)
	IFace() netlink.Link
}

Nic basic NIC that can send a receive packets to and from a compute service

type Tap

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

Tap provides communication between taps in bridges and other endpoints

func NewTap

func NewTap(s *Listener, vnid uint32, mtu int, br *netlink.Bridge) (*Tap, error)

NewTap creates a tap interface on the specified bridge

func (*Tap) Delete

func (v *Tap) Delete() error

Delete removes the actual nic from the OS

func (*Tap) IFace

func (v *Tap) IFace() netlink.Link

IFace returns the underlying OS NIC

func (*Tap) SetHandler

func (v *Tap) SetHandler(h protocol.HandlerFunc)

SetHandler applies the listener callback for handling TX

func (*Tap) Start

func (v *Tap) Start()

Start listeners for each tap fd created

func (*Tap) Stop

func (v *Tap) Stop() error

Stop closes off comms

func (*Tap) Write

func (v *Tap) Write(b []byte) (int, error)

Write sends a packet to the bridge

func (*Tap) WriteBatch

func (v *Tap) WriteBatch(bs []xdp.BatchDesc) (int, error)

WriteBatch writes batches of packets to a single XDP queue Queue selection is based on the first packet provided

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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