xeth

package
v1.19.1 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2021 License: GPL-2.0, GPL-2.0-or-later Imports: 19 Imported by: 0

Documentation

Overview

This package provides a sideband control interface to an XETH driver. Usage,

task, err := xeth.Start(dev)
if err {
	panic(err)
}
task.DumpIfInfo()
for t = true; t; {
	select {
	case <-goes.Stop:
		return
	case buf := <-task.RxCh:
		if t = xeth.Class(buf) != xeth.ClassBreak; t {
			msg := xeth.Parse(buf)
			...
			xeth.Pool(msg)
		}
	}
}
...
task.DumpFib()
for t := true; t; {
	select {
	case <-goes.Stop:
		return
	case buf := <-task.RxCh:
		if t = xeth.Class(buf) != xeth.ClassBreak; t {
			msg := xeth.Parse(buf)
			...
			xeth.Pool(msg)
		}
	}
}
...
goes.WG.Add(1)
go func() {
	defer goes.WG.Done()
	for {
		select {
		case <-goes.Stop:
			return
		case buf := <-task.RxCh:
			msg := xeth.Parse(buf)
			...
			xeth.Pool(msg)
		}
	}
}()
...

Index

Constants

View Source
const (
	CompatRtTable  = RtTable(RT_TABLE_COMPAT)
	DefaultRtTable = RtTable(RT_TABLE_DEFAULT)
	MainRtTable    = RtTable(RT_TABLE_MAIN)
	LocalRtTable   = RtTable(RT_TABLE_LOCAL)
)
View Source
const (
	VlanVidMask = 0xfff
	VlanNVid    = 0x1000
)
View Source
const (
	EncapVlan = 0x0
	EncapVpls = 0x1
)
View Source
const (
	EncapVlanVidBit = 0xc
	EncapVplsVidBit = 0x14
)
View Source
const (
	EncapVlanVidMask = 0xfff
	EncapVplsVidMask = 0xfffff
)
View Source
const (
	LbIflaChannel = 0x1
	MuxIflaEncap  = 0x1
	PortIflaXid   = 0x1
	VlanIflaVid   = 0x1
)
View Source
const (
	DevKindUnspec = 0x0
	DevKindPort   = 0x1
	DevKindVlan   = 0x2
	DevKindBridge = 0x3
	DevKindLag    = 0x4
	DevKindLB     = 0x5
)
View Source
const (
	SHUT_RD = iota
	SHUT_WR
	SHUT_RDWR
)
View Source
const (
	FIB_EVENT_ENTRY_REPLACE = iota
	FIB_EVENT_ENTRY_APPEND
	FIB_EVENT_ENTRY_ADD
	FIB_EVENT_ENTRY_DEL
	FIB_EVENT_RULE_ADD
	FIB_EVENT_RULE_DEL
	FIB_EVENT_NH_ADD
	FIB_EVENT_NH_DEL
)
View Source
const (
	RTN_UNSPEC = iota
	RTN_UNICAST
	RTN_LOCAL
	RTN_BROADCAST
	RTN_ANYCAST
	RTN_MULTICAST
	RTN_BLACKHOLE
	RTN_UNREACHABLE
	RTN_PROHIBIT
	RTN_THROW
	RTN_NAT
	RTN_XRESOLVE
)
View Source
const (
	RTNH_F_DEAD       = 1
	RTNH_F_PERVASIVE  = 2
	RTNH_F_ONLINK     = 4
	RTNH_F_OFFLOAD    = 8
	RTNH_F_LINKDOWN   = 16
	RTNH_F_UNRESOLVED = 32
)
View Source
const (
	RT_SCOPE_UNIVERSE = 0
	RT_SCOPE_SITE     = 200
	RT_SCOPE_LINK     = 253
	RT_SCOPE_HOST     = 254
	RT_SCOPE_NOWHERE  = 255
)
View Source
const (
	RT_TABLE_UNSPEC = 0

	RT_TABLE_COMPAT  = 252
	RT_TABLE_DEFAULT = 253
	RT_TABLE_MAIN    = 254
	RT_TABLE_LOCAL   = 255
	RT_TABLE_MAX     = 0xFFFFFFFF
)
View Source
const (
	LinkStatRxPackets = iota
	LinkStatTxPackets
	LinkStatRxBytes
	LinkStatTxBytes
	LinkStatRxErrors
	LinkStatTxErrors
	LinkStatRxDropped
	LinkStatTxDropped
	LinkStatMulticast
	LinkStatCollisions
	LinkStatRxLengthErrors
	LinkStatRxOverErrors
	LinkStatRxCrcErrors
	LinkStatRxFrameErrors
	LinkStatRxFifoErrors
	LinkStatRxMissedErrors
	LinkStatTxAbortedErrors
	LinkStatTxCarrierErrors
	LinkStatTxFifoErrors
	LinkStatTxHeartbeatErrors
	LinkStatTxWindowErrors
	LinkStatRxCompressed
	LinkStatTxCompressed
	LinkStatRxNohandler
)
View Source
const (
	AUTONEG_DISABLE = 0
	AUTONEG_ENABLE  = 1
	AUTONEG_UNKNOWN = 0xff
)
View Source
const (
	DUPLEX_HALF    = 0
	DUPLEX_FULL    = 1
	DUPLEX_UNKNOWN = 0xff
)
View Source
const (
	PORT_TP    = 0
	PORT_AUI   = 1
	PORT_MII   = 2
	PORT_FIBRE = 3
	PORT_BNC   = 4
	PORT_DA    = 5
	PORT_NONE  = 0xef
	PORT_OTHER = 0xff
)
View Source
const (
	ETH_TP_MDI_INVALID = 0
	ETH_TP_MDI         = 1
	ETH_TP_MDI_X       = 2
	ETH_TP_MDI_AUTO    = 3
)
View Source
const (
	ETHTOOL_LINK_MODE_10baseT_Half_BIT           = 0
	ETHTOOL_LINK_MODE_10baseT_Full_BIT           = 1
	ETHTOOL_LINK_MODE_100baseT_Half_BIT          = 2
	ETHTOOL_LINK_MODE_100baseT_Full_BIT          = 3
	ETHTOOL_LINK_MODE_1000baseT_Half_BIT         = 4
	ETHTOOL_LINK_MODE_1000baseT_Full_BIT         = 5
	ETHTOOL_LINK_MODE_Autoneg_BIT                = 6
	ETHTOOL_LINK_MODE_TP_BIT                     = 7
	ETHTOOL_LINK_MODE_AUI_BIT                    = 8
	ETHTOOL_LINK_MODE_MII_BIT                    = 9
	ETHTOOL_LINK_MODE_FIBRE_BIT                  = 10
	ETHTOOL_LINK_MODE_BNC_BIT                    = 11
	ETHTOOL_LINK_MODE_10000baseT_Full_BIT        = 12
	ETHTOOL_LINK_MODE_Pause_BIT                  = 13
	ETHTOOL_LINK_MODE_Asym_Pause_BIT             = 14
	ETHTOOL_LINK_MODE_2500baseX_Full_BIT         = 15
	ETHTOOL_LINK_MODE_Backplane_BIT              = 16
	ETHTOOL_LINK_MODE_1000baseKX_Full_BIT        = 17
	ETHTOOL_LINK_MODE_10000baseKX4_Full_BIT      = 18
	ETHTOOL_LINK_MODE_10000baseKR_Full_BIT       = 19
	ETHTOOL_LINK_MODE_10000baseR_FEC_BIT         = 20
	ETHTOOL_LINK_MODE_20000baseMLD2_Full_BIT     = 21
	ETHTOOL_LINK_MODE_20000baseKR2_Full_BIT      = 22
	ETHTOOL_LINK_MODE_40000baseKR4_Full_BIT      = 23
	ETHTOOL_LINK_MODE_40000baseCR4_Full_BIT      = 24
	ETHTOOL_LINK_MODE_40000baseSR4_Full_BIT      = 25
	ETHTOOL_LINK_MODE_40000baseLR4_Full_BIT      = 26
	ETHTOOL_LINK_MODE_56000baseKR4_Full_BIT      = 27
	ETHTOOL_LINK_MODE_56000baseCR4_Full_BIT      = 28
	ETHTOOL_LINK_MODE_56000baseSR4_Full_BIT      = 29
	ETHTOOL_LINK_MODE_56000baseLR4_Full_BIT      = 30
	ETHTOOL_LINK_MODE_25000baseCR_Full_BIT       = 31
	ETHTOOL_LINK_MODE_25000baseKR_Full_BIT       = 32
	ETHTOOL_LINK_MODE_25000baseSR_Full_BIT       = 33
	ETHTOOL_LINK_MODE_50000baseCR2_Full_BIT      = 34
	ETHTOOL_LINK_MODE_50000baseKR2_Full_BIT      = 35
	ETHTOOL_LINK_MODE_100000baseKR4_Full_BIT     = 36
	ETHTOOL_LINK_MODE_100000baseSR4_Full_BIT     = 37
	ETHTOOL_LINK_MODE_100000baseCR4_Full_BIT     = 38
	ETHTOOL_LINK_MODE_100000baseLR4_ER4_Full_BIT = 39
	ETHTOOL_LINK_MODE_50000baseSR2_Full_BIT      = 40
	ETHTOOL_LINK_MODE_1000baseX_Full_BIT         = 41
	ETHTOOL_LINK_MODE_10000baseCR_Full_BIT       = 42
	ETHTOOL_LINK_MODE_10000baseSR_Full_BIT       = 43
	ETHTOOL_LINK_MODE_10000baseLR_Full_BIT       = 44
	ETHTOOL_LINK_MODE_10000baseLRM_Full_BIT      = 45
	ETHTOOL_LINK_MODE_10000baseER_Full_BIT       = 46
	ETHTOOL_LINK_MODE_2500baseT_Full_BIT         = 47
	ETHTOOL_LINK_MODE_5000baseT_Full_BIT         = 48
	ETHTOOL_LINK_MODE_FEC_NONE_BIT               = 49
	ETHTOOL_LINK_MODE_FEC_RS_BIT                 = 50
	ETHTOOL_LINK_MODE_FEC_BASER_BIT              = 51
)
View Source
const (
	ClassUnknown = iota
	ClassBreak
	ClassInterface
	ClassAddress
	ClassFib
	ClassNeighbor
	ClassNetNs
)
View Source
const (
	VLAN_PRIO_MASK   = 0xe000
	VLAN_PRIO_SHIFT  = 13
	VLAN_CFI_MASK    = 0x1000
	VLAN_TAG_PRESENT = VLAN_CFI_MASK
)
View Source
const Dbg = dbg.Func
View Source
const License = `` /* 15866-byte string literal not displayed */
View Source
const (
	NetIfHwL2FwdOffload = 0x800000000000
)
View Source
const NoDbg = dbg.NoOp
View Source
const RTN_MAX = __RTN_MAX - 1
View Source
const WithDbg = Dbg != NoDbg

Variables

View Source
var IndexofLinkStat = map[string]int{
	"rx-packets":          LinkStatRxPackets,
	"tx-packets":          LinkStatTxPackets,
	"rx-bytes":            LinkStatRxBytes,
	"tx-bytes":            LinkStatTxBytes,
	"rx-errors":           LinkStatRxErrors,
	"tx-errors":           LinkStatTxErrors,
	"rx-dropped":          LinkStatRxDropped,
	"tx-dropped":          LinkStatTxDropped,
	"multicast":           LinkStatMulticast,
	"collisions":          LinkStatCollisions,
	"rx-length-errors":    LinkStatRxLengthErrors,
	"rx-over-errors":      LinkStatRxOverErrors,
	"rx-crc-errors":       LinkStatRxCrcErrors,
	"rx-frame-errors":     LinkStatRxFrameErrors,
	"rx-fifo-errors":      LinkStatRxFifoErrors,
	"rx-missed-errors":    LinkStatRxMissedErrors,
	"tx-aborted-errors":   LinkStatTxAbortedErrors,
	"tx-carrier-errors":   LinkStatTxCarrierErrors,
	"tx-fifo-errors":      LinkStatTxFifoErrors,
	"tx-heartbeat-errors": LinkStatTxHeartbeatErrors,
	"tx-window-errors":    LinkStatTxWindowErrors,
	"rx-compressed":       LinkStatRxCompressed,
	"tx-compressed":       LinkStatTxCompressed,
	"rx-nohandler":        LinkStatRxNohandler,
}
View Source
var Links sync.Map
View Source
var PageSize = syscall.Getpagesize()

Functions

func Class

func Class(buf Buffer) int

func LinkRange

func LinkRange(f func(xid Xid, l *Link) bool)

func NetNsRange

func NetNsRange(f func(ns NetNs) bool)

func Parse

func Parse(buf Buffer) interface{}

parse driver message and cache ifinfo in xid maps.

func Pool

func Pool(msg interface{})

func Provision

func Provision(dev, val string) error

Write provision value to platform device sysfs file

func RxIfInfo

func RxIfInfo(msg *internal.MsgIfInfo) (note interface{})

func Valid

func Valid(xid Xid) bool

Valid() if xid has mapped attributes

Types

type AutoNeg

type AutoNeg uint8

func (AutoNeg) String

func (autoneg AutoNeg) String() string

type Break

type Break struct{}

func (Break) String

func (Break) String() string

type Buffer

type Buffer interface {
	// contains filtered or unexported methods
}

type Counter

type Counter uint64
var (
	Cloned  Counter // cloned received messages
	Parsed  Counter // messages parsed by user
	Dropped Counter // messages that overflowed transmit channel
	Sent    Counter // messages and exception frames sent to driver
	Unknown Counter // LinkOf xid w/o IfInfo
)

func (*Counter) Count

func (count *Counter) Count() uint64

func (*Counter) Inc

func (count *Counter) Inc()

func (*Counter) Reset

func (count *Counter) Reset()

type DevAddIPNet

type DevAddIPNet struct {
	Xid
	*net.IPNet
}

func (*DevAddIPNet) Format

func (dev *DevAddIPNet) Format(f fmt.State, c rune)

type DevDel

type DevDel Xid

func RxDelete

func RxDelete(xid Xid) (note DevDel)

func (DevDel) Format

func (dev DevDel) Format(f fmt.State, c rune)

type DevDelIPNet

type DevDelIPNet struct {
	Xid
	Prefix string
}

func (*DevDelIPNet) Format

func (dev *DevDelIPNet) Format(f fmt.State, c rune)

type DevDown

type DevDown Xid

func (DevDown) Format

func (dev DevDown) Format(f fmt.State, c rune)

type DevDump

type DevDump Xid

func (DevDump) Format

func (dev DevDump) Format(f fmt.State, c rune)

type DevEthtoolFlags

type DevEthtoolFlags struct {
	Xid
	EthtoolFlagBits
}

func (*DevEthtoolFlags) Format

func (dev *DevEthtoolFlags) Format(f fmt.State, c rune)

type DevEthtoolSettings

type DevEthtoolSettings Xid

func (DevEthtoolSettings) Format

func (dev DevEthtoolSettings) Format(f fmt.State, c rune)

type DevFeatures added in v1.18.9

type DevFeatures Xid

func (DevFeatures) Format added in v1.18.9

func (dev DevFeatures) Format(f fmt.State, c rune)

type DevJoin

type DevJoin struct{ Lower, Upper Xid }

func (*DevJoin) Format

func (dev *DevJoin) Format(f fmt.State, c rune)

type DevKind

type DevKind uint8

func (DevKind) String

func (kind DevKind) String() string

type DevLinkModesAdvertising

type DevLinkModesAdvertising Xid

func (DevLinkModesAdvertising) Format

func (dev DevLinkModesAdvertising) Format(f fmt.State, c rune)

type DevLinkModesLPAdvertising

type DevLinkModesLPAdvertising Xid

func (DevLinkModesLPAdvertising) Format

func (dev DevLinkModesLPAdvertising) Format(f fmt.State, c rune)

type DevLinkModesSupported

type DevLinkModesSupported Xid

func (DevLinkModesSupported) Format

func (dev DevLinkModesSupported) Format(f fmt.State, c rune)

type DevNew

type DevNew Xid

func (DevNew) Format

func (dev DevNew) Format(f fmt.State, c rune)

type DevPort

type DevPort uint8

func (DevPort) String

func (port DevPort) String() string

type DevQuit

type DevQuit struct{ Lower, Upper Xid }

func (*DevQuit) Format

func (dev *DevQuit) Format(f fmt.State, c rune)

type DevReg

type DevReg Xid

func (DevReg) Format

func (reg DevReg) Format(f fmt.State, c rune)

type DevUnreg

type DevUnreg Xid

func (DevUnreg) Format

func (dev DevUnreg) Format(f fmt.State, c rune)

type DevUp

type DevUp Xid

func (DevUp) Format

func (dev DevUp) Format(f fmt.State, c rune)

type Duplex

type Duplex uint8

func (Duplex) String

func (duplex Duplex) String() string

type EthtoolFlagBits

type EthtoolFlagBits uint32

func (EthtoolFlagBits) Format

func (bits EthtoolFlagBits) Format(f fmt.State, c rune)

func (EthtoolFlagBits) Test

func (bits EthtoolFlagBits) Test(bit uint) bool

type EthtoolLinkModeBits

type EthtoolLinkModeBits uint64

func (EthtoolLinkModeBits) Format

func (bits EthtoolLinkModeBits) Format(f fmt.State, c rune)

func (EthtoolLinkModeBits) Test

func (bits EthtoolLinkModeBits) Test(bit uint) bool

type FibEntry

type FibEntry struct {
	net.IPNet
	NHs []*NH
	NetNs
	RtTable
	FibEntryEvent
	Rtn
	Tos uint8
	Ref
}

func (*FibEntry) Format

func (msg *FibEntry) Format(f fmt.State, c rune)

func (*FibEntry) Less

func (feI *FibEntry) Less(feJ *FibEntry) bool

to sort a list of fib entries,

sort.Slice(fib, func(i, j int) bool {
	return fib[i].Less(fib[j])
})

func (*FibEntry) Pool

func (fe *FibEntry) Pool()

type FibEntryEvent

type FibEntryEvent uint8

func (FibEntryEvent) String

func (event FibEntryEvent) String() string
type Link struct {
	sync.Map
	// contains filtered or unexported fields
}

func LinkOf

func LinkOf(xid Xid) (l *Link)

func (*Link) EthtoolAutoNeg

func (l *Link) EthtoolAutoNeg(set ...AutoNeg) (an AutoNeg)

func (*Link) EthtoolDevPort

func (l *Link) EthtoolDevPort(set ...DevPort) (devport DevPort)

func (*Link) EthtoolDuplex

func (l *Link) EthtoolDuplex(set ...Duplex) (duplex Duplex)

func (*Link) EthtoolFlags

func (l *Link) EthtoolFlags(set ...EthtoolFlagBits) (bits EthtoolFlagBits)

func (*Link) EthtoolSpeed

func (l *Link) EthtoolSpeed(set ...uint32) (mbps uint32)

func (*Link) IPNets

func (l *Link) IPNets(set ...[]*net.IPNet) (nets []*net.IPNet)

func (*Link) IfInfoDevKind

func (l *Link) IfInfoDevKind(set ...DevKind) (devkind DevKind)

func (*Link) IfInfoFeatures added in v1.18.9

func (l *Link) IfInfoFeatures(set ...uint64) (features uint64)

func (*Link) IfInfoFlags

func (l *Link) IfInfoFlags(set ...net.Flags) (flags net.Flags)

func (*Link) IfInfoHardwareAddr

func (l *Link) IfInfoHardwareAddr(set ...net.HardwareAddr) (ha net.HardwareAddr)

func (*Link) IfInfoIfIndex

func (l *Link) IfInfoIfIndex(set ...int32) (ifindex int32)

func (*Link) IfInfoName

func (l *Link) IfInfoName(set ...string) (name string)

func (*Link) IfInfoNetNs

func (l *Link) IfInfoNetNs(set ...NetNs) (netns NetNs)

func (*Link) IsAdminUp

func (l *Link) IsAdminUp() bool

func (*Link) IsAutoNeg

func (l *Link) IsAutoNeg() bool

func (*Link) IsBridge

func (l *Link) IsBridge() bool

func (*Link) IsLag

func (l *Link) IsLag() bool

func (*Link) IsPort

func (l *Link) IsPort() bool

func (*Link) IsVlan

func (l *Link) IsVlan() bool

func (*Link) LinkModesAdvertising

func (l *Link) LinkModesAdvertising(set ...EthtoolLinkModeBits) EthtoolLinkModeBits

func (*Link) LinkModesLPAdvertising

func (l *Link) LinkModesLPAdvertising(set ...EthtoolLinkModeBits) EthtoolLinkModeBits

func (*Link) LinkModesSupported

func (l *Link) LinkModesSupported(set ...EthtoolLinkModeBits) EthtoolLinkModeBits

func (*Link) LinkUp

func (l *Link) LinkUp(set ...bool) (up bool)

func (*Link) Lowers

func (l *Link) Lowers(set ...[]Xid) (xids []Xid)

func (*Link) NetIfHwL2FwdOffload added in v1.18.9

func (l *Link) NetIfHwL2FwdOffload() bool

func (*Link) StatNames

func (l *Link) StatNames(set ...[]string) (names []string)

func (*Link) Stats

func (l *Link) Stats(set ...[]uint64) (stats []uint64)

func (*Link) String

func (l *Link) String() string

func (*Link) Uppers

func (l *Link) Uppers(set ...[]Xid) (xids []Xid)

func (*Link) Xid

func (l *Link) Xid() Xid

type LinkAttr

type LinkAttr uint8
const (
	LinkAttrEthtoolAutoNeg LinkAttr = iota
	LinkAttrEthtoolDevPort
	LinkAttrEthtoolDuplex
	LinkAttrEthtoolFlags
	LinkAttrEthtoolSpeed
	LinkAttrIPNets
	LinkAttrIfInfoName
	LinkAttrIfInfoIfIndex
	LinkAttrIfInfoNetNs
	LinkAttrIfInfoFeatures
	LinkAttrIfInfoFlags
	LinkAttrIfInfoDevKind
	LinkAttrIfInfoHardwareAddr
	LinkAttrLinkModesAdvertising
	LinkAttrLinkModesLPAdvertising
	LinkAttrLinkModesSupported
	LinkAttrLinkUp
	LinkAttrLowers
	LinkAttrStatNames
	LinkAttrStats
	LinkAttrUppers
)

type LinkStat

type LinkStat int

func (LinkStat) String

func (stat LinkStat) String() string

type Linker

type Linker interface {
	Maper
	EthtoolAutoNeg(set ...AutoNeg) AutoNeg
	EthtoolDuplex(set ...Duplex) Duplex
	EthtoolDevPort(set ...DevPort) DevPort
	EthtoolFlags(set ...EthtoolFlagBits) EthtoolFlagBits
	EthtoolSpeed(set ...uint32) uint32
	IfInfoName(set ...string) string
	IfInfoIfIndex(set ...int32) int32
	IfInfoNetNs(set ...NetNs) NetNs
	IfInfoFeatures(set ...uint64) uint64
	IfInfoFlags(set ...net.Flags) net.Flags
	IfInfoDevKind(set ...DevKind) DevKind
	IfInfoHardwareAddr(set ...net.HardwareAddr) net.HardwareAddr
	IPNets(set ...[]*net.IPNet) []*net.IPNet
	IsAdminUp() bool
	IsAutoNeg() bool
	IsBridge() bool
	IsLag() bool
	IsPort() bool
	IsVlan() bool
	NetIfHwL2FwdOffload() bool
	LinkModesSupported(set ...EthtoolLinkModeBits) EthtoolLinkModeBits
	LinkModesAdvertising(set ...EthtoolLinkModeBits) EthtoolLinkModeBits
	LinkModesLPAdvertising(set ...EthtoolLinkModeBits) EthtoolLinkModeBits
	LinkUp(set ...bool) bool
	Lowers(set ...[]Xid) []Xid
	Uppers(set ...[]Xid) []Xid
	Stats(set ...[]uint64) []uint64
	StatNames(set ...[]string) []string
	String() string
	Xid() Xid
}

type Maper

type Maper interface {
	Delete(key interface{})
	Load(key interface{}) (value interface{}, ok bool)
	Store(key, value interface{})
}

type NH

type NH struct {
	net.IP
	Xid
	Ifindex int32
	Weight  int32
	RtnhFlags
	RtScope
}

func (*NH) Format

func (nh *NH) Format(f fmt.State, c rune)

func (*NH) Pool

func (nh *NH) Pool()

type Neighbor

type Neighbor struct {
	NetNs
	Xid
	net.IP
	net.HardwareAddr
	Ref
}

func (*Neighbor) Format

func (msg *Neighbor) Format(f fmt.State, c rune)

func (*Neighbor) Less

func (neighI *Neighbor) Less(neighJ *Neighbor) bool

to sort a list of neighbors,

sort.Slice(neighbors, func(i, j int) bool {
	return neighbors[i].Less(neighbors[j])
})

func (*Neighbor) Pool

func (neigh *Neighbor) Pool()

type NetNs

type NetNs uint64
const DefaultNetNs NetNs = 1

func (NetNs) Base

func (ns NetNs) Base() string

func (NetNs) FibEntries

func (ns NetNs) FibEntries(rt RtTable, f func(fe *FibEntry) bool)

func (NetNs) FibEntry

func (ns NetNs) FibEntry(rt RtTable, ipnet string) (fe *FibEntry)

func (NetNs) Inode

func (ns NetNs) Inode() uint64

func (NetNs) Neighbor

func (ns NetNs) Neighbor(ip string) (neigh *Neighbor)

func (NetNs) Neighbors

func (ns NetNs) Neighbors(f func(neigh *Neighbor) bool)

func (NetNs) Path

func (ns NetNs) Path() string

func (NetNs) RtTables

func (ns NetNs) RtTables() []RtTable

func (NetNs) String

func (ns NetNs) String() string

func (NetNs) Xid

func (ns NetNs) Xid(ifindex int32, set ...Xid) (xid Xid)

if set[0] == 0, delete ifindex entry if set[0] != 0, map by ifindex otherwise, return Xid mapped by ifindex

func (NetNs) Xids

func (ns NetNs) Xids(f func(xid Xid) bool)

type NetNsAdd

type NetNsAdd struct {
	NetNs
}

func (NetNsAdd) Format

func (msg NetNsAdd) Format(f fmt.State, c rune)

type NetNsDel

type NetNsDel struct {
	NetNs
}

func (NetNsDel) Format

func (msg NetNsDel) Format(f fmt.State, c rune)

type NetNses

type NetNses []NetNs

func NewNetNses

func NewNetNses() (l NetNses)

func (NetNses) Cut

func (l NetNses) Cut(i int) NetNses

func (NetNses) FilterName

func (l NetNses) FilterName(re *regexp.Regexp) NetNses

func (NetNses) InodeFilter

func (l NetNses) InodeFilter(inodes []uint64) NetNses

func (NetNses) Inodes

func (l NetNses) Inodes() []uint64

type Ref

type Ref int32

func (*Ref) Count

func (ref *Ref) Count() int32

func (*Ref) Hold

func (ref *Ref) Hold() int32

func (*Ref) Release

func (ref *Ref) Release() int32

func (*Ref) Reset

func (ref *Ref) Reset()

type RtScope

type RtScope uint8

func (RtScope) String

func (scope RtScope) String() string

type RtTable

type RtTable uint32

func (RtTable) String

func (rtt RtTable) String() string

type Rtn

type Rtn uint8

func (Rtn) String

func (rtn Rtn) String() string

type RtnhFlags

type RtnhFlags uint32

func (RtnhFlags) Format

func (flags RtnhFlags) Format(f fmt.State, c rune)

type Task

type Task struct {
	RxCh <-chan Buffer // cloned msgs received from driver

	RxErr error // error that stopped the rx service
	TxErr error // error that stopped the tx service
	// contains filtered or unexported fields
}

func Start

func Start(dev string) (task *Task, err error)

Connect socket and run channel service routines.

func (*Task) DumpFib

func (task *Task) DumpFib()

request fib dump

func (*Task) DumpIfInfo

func (task *Task) DumpIfInfo()

request ifinfo dump

func (*Task) ExceptionFrame

func (task *Task) ExceptionFrame(b []byte)

Send an exception frame to driver through raw socket.

func (*Task) SetCarrier

func (task *Task) SetCarrier(xid Xid, on bool)

Send carrier change to driver through hi-priority channel.

func (*Task) SetEthtoolStat

func (task *Task) SetEthtoolStat(xid Xid, stat uint32, n uint64)

Send ethtool stat change to driver through leaky-bucket channel.

func (*Task) SetLinkStat

func (task *Task) SetLinkStat(xid Xid, stat uint32, n uint64)

Send link stat change to driver through leaky-bucket channel.

func (*Task) SetSpeed

func (task *Task) SetSpeed(xid Xid, mbps uint32)

Send speed change to driver through hi-priority channel.

type Xid

type Xid uint32

func (Xid) Delist

func (xid Xid) Delist(xids []Xid) []Xid

func (Xid) Format

func (xid Xid) Format(f fmt.State, c rune)

func (Xid) List

func (xid Xid) List(xids []Xid) []Xid

func (Xid) RxAdvertising

func (xid Xid) RxAdvertising(modes uint64) DevLinkModesAdvertising

func (Xid) RxDown

func (xid Xid) RxDown() DevDown

func (Xid) RxEthtoolFlags

func (xid Xid) RxEthtoolFlags(flags uint32) *DevEthtoolFlags

func (Xid) RxEthtoolSettings

func (xid Xid) RxEthtoolSettings(msg *internal.MsgEthtoolSettings) DevEthtoolSettings

func (Xid) RxFeatures added in v1.18.9

func (xid Xid) RxFeatures(features uint64) (note DevFeatures)

func (Xid) RxIP4Add

func (xid Xid) RxIP4Add(addr, mask uint32) *DevAddIPNet

func (Xid) RxIP4Del

func (xid Xid) RxIP4Del(addr, mask uint32) *DevDelIPNet

func (Xid) RxIP6Add

func (xid Xid) RxIP6Add(addr []byte, len int) *DevAddIPNet

func (Xid) RxIP6Del

func (xid Xid) RxIP6Del(addr []byte) *DevDelIPNet

func (Xid) RxLPAdvertising

func (xid Xid) RxLPAdvertising(modes uint64) DevLinkModesLPAdvertising

func (Xid) RxReg

func (xid Xid) RxReg(netns NetNs, ifindex int32) DevReg

func (Xid) RxSupported

func (xid Xid) RxSupported(modes uint64) DevLinkModesSupported

func (Xid) RxUnreg

func (xid Xid) RxUnreg(newIfindex int32) (unreg DevUnreg)

func (Xid) RxUp

func (xid Xid) RxUp() DevUp

type Xids

type Xids []Xid

func ListXids

func ListXids() (xids Xids)

func (Xids) Cut

func (xids Xids) Cut(i int) Xids

func (Xids) FilterName

func (xids Xids) FilterName(re *regexp.Regexp) Xids

func (Xids) FilterNetNs

func (xids Xids) FilterNetNs(re *regexp.Regexp) Xids

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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