rtnl

package module
v0.1.14 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: Apache-2.0 Imports: 10 Imported by: 21

README

rtnl

A native Go rtnetlink library based on this Go netlink library by Matt Layher.

Why?

Why another netlink-ish library? A few reasons. This library follows the philosophy and reasoning laid out in the why section of the above repo and provides an rtnetlink layer. At the time of writing we know of only this repo that makes a similar attempt for rtnetlink. But it does not appear to be actively maintined and only covers a small part of rtnetlink. As we've been developing various Merge components, we find ourselves often needing to interact with rtnetlink. This library will provide factored out support for that need in Merge and anyone else who wants to use it.

This library will stay exclusive to netlink and will not wander into iproute2 and the like.

Design

rtnl is structured around 5 basic rtnetlink objects.

  • links
  • routes
  • neighbors
  • addresses
  • routing rules

Support for the following virtual link types exists

  • veth
  • vxlan
  • vrf
  • macvlan
  • tun/tap

There is a high level object for each of these object kinds with management functions exposed. There is also support for managing the namespaces of these objects.

Support for the remaining objects may come in time

  • qdiscs
  • tclass
  • tfilter

Examples

Virtual ethernet device management
// create a veth pair
ve := &Link{
  Info: &LinkInfo{
    Name: "vethA",
    Veth: &Veth{
      Peer: "vethB",
    },
  },
}
err := ve.Add()

// add an address
addr, err := ParseAddr("192.168.47.1/24")
err = ve.AddAddr(addr)

// put one side of the pair in the pizza namespace
vb := &Link{
  Info: &LinkInfo{
    Name: "vethB",
    Ns:   netns.GetFd("pizza"),
  },
}
err = vb.Set()

Documentation

Index

Constants

View Source
const (
	IFLA_BR_UNSPEC = iota
	IFLA_BR_FORWARD_DELAY
	IFLA_BR_HELLO_TIME
	IFLA_BR_MAX_AGE
	IFLA_BR_AGEING_TIME
	IFLA_BR_STP_STATE
	IFLA_BR_PRIORITY
	IFLA_BR_VLAN_FILTERING
	IFLA_BR_VLAN_PROTOCOL
	IFLA_BR_GROUP_FWD_MASK
	IFLA_BR_ROOT_ID
	IFLA_BR_BRIDGE_ID
	IFLA_BR_ROOT_PORT
	IFLA_BR_ROOT_PATH_COST
	IFLA_BR_TOPOLOGY_CHANGE
	IFLA_BR_TOPOLOGY_CHANGE_DETECTED
	IFLA_BR_HELLO_TIMER
	IFLA_BR_TCN_TIMER
	IFLA_BR_TOPOLOGY_CHANGE_TIMER
	IFLA_BR_GC_TIMER
	IFLA_BR_GROUP_ADDR
	IFLA_BR_FDB_FLUSH
	IFLA_BR_MCAST_ROUTER
	IFLA_BR_MCAST_SNOOPING
	IFLA_BR_MCAST_QUERY_USE_IFADDR
	IFLA_BR_MCAST_QUERIER
	IFLA_BR_MCAST_HASH_ELASTICITY
	IFLA_BR_MCAST_HASH_MAX
	IFLA_BR_MCAST_LAST_MEMBER_CNT
	IFLA_BR_MCAST_STARTUP_QUERY_CNT
	IFLA_BR_MCAST_LAST_MEMBER_INTVL
	IFLA_BR_MCAST_MEMBERSHIP_INTVL
	IFLA_BR_MCAST_QUERIER_INTVL
	IFLA_BR_MCAST_QUERY_INTVL
	IFLA_BR_MCAST_QUERY_RESPONSE_INTVL
	IFLA_BR_MCAST_STARTUP_QUERY_INTVL
	IFLA_BR_NF_CALL_IPTABLES
	IFLA_BR_NF_CALL_IP6TABLES
	IFLA_BR_NF_CALL_ARPTABLES
	IFLA_BR_VLAN_DEFAULT_PVID
)
View Source
const (
	IFLA_BRIDGE_FLAGS = iota
	IFLA_BRIDGE_MODE
	IFLA_BRIDGE_VLAN_INFO
	IFLA_BRIDGE_VLAN_TUNNEL_INFO
)
View Source
const (
	BRIDGE_VLAN_INFO_MASTER = 1 << iota
	BRIDGE_VLAN_INFO_PVID
	BRIDGE_VLAN_INFO_UNTAGGED
	BRIDGE_VLAN_INFO_RANGE_BEGIN
	BRIDGE_VLAN_INFO_RANGE_END
	BRIDGE_VLAN_INFO_BRENTRY
)
View Source
const (
	BRIDGE_FLAGS_MASTER = 1
	BRIDGE_FLAGS_SELF   = 2
)
View Source
const (
	IFLA_INFO_UNSPEC uint16 = iota
	IFLA_INFO_KIND
	IFLA_INFO_DATA
)

interface link address attribute types

View Source
const (
	RTEXT_FILTER_VF         uint32 = 1
	RTEXT_FILTER_BRVLAN            = 2
	RTEXT_FILTER_SKIP_STATS        = 8
)

filters for IFLA_EXT_MASK

View Source
const (
	IFLA_MACVLAN_UNSPEC uint16 = iota
	IFLA_MACVLAN_MODE
	IFLA_MACVLAN_FLAGS
	IFLA_MACVLAN_MACADDR_MODE
	IFLA_MACVLAN_MACADDR
	IFLA_MACVLAN_MACADDR_DATA
	IFLA_MACVLAN_MACADDR_COUNT
)
View Source
const (
	MACVLAN_MACADDR_ADD uint32 = iota
	MACVLAN_MACADDR_DEL
	MACVLAN_MACADDR_FLUSH
	MACVLAN_MACADDR_SET
)
View Source
const (
	NDA_UNSPEC uint16 = iota
	NDA_DST
	NDA_LLADDR
	NDA_CACHEINFO
	NDA_PROBES
	NDA_VLAN
	NDA_PORT
	NDA_VNI
	NDA_IFINDEX
	NDA_MASTER
	NDA_LINK_NETNSID
	NDA_SRC_VNI
)

attribute types

View Source
const (
	NTF_USE         = 0x01
	NTF_SELF        = 0x02
	NTF_MASTER      = 0x04
	NTF_PROXY       = 0x08
	NTF_EXT_LEARNED = 0x10
	NTF_OFFLOADED   = 0x20
	NTF_ROUTER      = 0x80
)

neighbor cache entry flags

View Source
const (
	NUD_INCOMPLETE = 0x01
	NUD_REACHABLE  = 0x02
	NUD_STALE      = 0x04
	NUD_DELAY      = 0x08
	NUD_PROBE      = 0x10
	NUD_FAILED     = 0x20
	NUD_NOARP      = 0x40
	NUD_PERMANENT  = 0x80
	NUD_NONE       = 0x00
)

neighbor cache entry states

View Source
const (
	FRA_UNSPEC uint16 = iota
	FRA_DST
	FRA_SRC
	FRA_IIFNAME
	FRA_GOTO
	FRA_UNUSED2
	FRA_PRIORITY
	FRA_UNUSED3
	FRA_UNUSED4
	FRA_UNUSED5
	FRA_FWMARK
	FRA_FLOW
	FRA_TUN_ID
	FRA_SUPPRESS_IFGROUP
	FRA_SUPPRESS_PREFIXLEN
	FRA_TABLE
	FRA_FWMASK
	FRA_OIFNAME
	FRA_PAD
	FRA_L3MDEV
	FRA_UID_RANGE
	FRA_PROTOCOL
	FRA_IP_PROTO
	FRA_SPORT_RANGE
	FRA_DPORT_RANGE
)
View Source
const (
	FR_ACT_UNSPEC uint8 = iota
	FR_ACT_TO_TBL
	FR_ACT_GOTO
	FR_ACT_NOP
	FR_ACT_RES3
	FR_ACT_RES4
	FR_ACT_BLACKHOLE
	FR_ACT_UNREACHABLE
	FR_ACT_PROHIBIT
)
View Source
const (
	VETH_INFO_UNSPEC uint16 = iota
	VETH_INFO_PEER
)

veth attribute types

View Source
const (
	IFLA_VLAN_UNSPEC uint16 = iota
	IFLA_VLAN_ID
	IFLA_VLAN_FLAGS
	IFLA_VLAN_EGRESS_QOS
	IFLA_VLAN_INGRESS_QOS
	IFLA_VLAN_PROTOCOL
)
View Source
const (
	IFLA_VRF_UNSPEC uint16 = iota
	IFLA_VRF_TABLE
)
View Source
const (
	IFLA_VRF_PORT_UNSPEC uint16 = iota
	IFLA_VRF_PORT_TABLE
)
View Source
const (
	IFLA_VXLAN_UNSPEC uint16 = iota
	IFLA_VXLAN_ID
	IFLA_VXLAN_GROUP /* group or remote address */
	IFLA_VXLAN_LINK
	IFLA_VXLAN_LOCAL
	IFLA_VXLAN_TTL
	IFLA_VXLAN_TOS
	IFLA_VXLAN_LEARNING
	IFLA_VXLAN_AGEING
	IFLA_VXLAN_LIMIT
	IFLA_VXLAN_PORT_RANGE /* source port */
	IFLA_VXLAN_PROXY
	IFLA_VXLAN_RSC
	IFLA_VXLAN_L2MISS
	IFLA_VXLAN_L3MISS
	IFLA_VXLAN_PORT /* destination port */
	IFLA_VXLAN_GROUP6
	IFLA_VXLAN_LOCAL6
	IFLA_VXLAN_UDP_CSUM
	IFLA_VXLAN_UDP_ZERO_CSUM6_TX
	IFLA_VXLAN_UDP_ZERO_CSUM6_RX
	IFLA_VXLAN_REMCSUM_TX
	IFLA_VXLAN_REMCSUM_RX
	IFLA_VXLAN_GBP
	IFLA_VXLAN_REMCSUM_NOPARTIAL
	IFLA_VXLAN_COLLECT_METADATA
	IFLA_VXLAN_LABEL
	IFLA_VXLAN_GPE
	IFLA_VXLAN_TTL_INHERIT
)

vxlan attribute types

Variables

View Source
var Version = "undefined"

Functions

func AddAddr

func AddAddr(ctx *Context, addr *Address) error

AddAddr adds the specified address.

func AddAddrs

func AddAddrs(ctx *Context, addrs []*Address) error

AddAddrs adds the specified addresses.

func IfInfomsgBytes

func IfInfomsgBytes(msg unix.IfInfomsg) []byte

func IsNotFound

func IsNotFound(err error) bool

Types

type AddrInfo

type AddrInfo struct {
	Address   *net.IPNet
	Local     net.IP
	Label     string
	Broadcast net.IP
	Anycast   net.IP
}

AddrInfo holds address attribute data.

type Address

type Address struct {
	Msg  unix.IfAddrmsg
	Info *AddrInfo
}

Address consolidates address information from rtnetlink.

func NewAddress

func NewAddress() *Address

Create a new address struct

func ParseAddr

func ParseAddr(addr string) (*Address, error)

func ReadAddrs

func ReadAddrs(ctx *Context, spec *Address) ([]*Address, error)

ReadAddrs reads a set of addresses according to the provided specification. For example, if you specify the address family, only addresses from that family will be returned. Some basic attribute filtering is also implemented.

func (Address) Family

func (a Address) Family() uint8

Return the address family, one of

  • AF_UNSPEC
  • AF_INET
  • AF_INET6

func (Address) Marshal

func (a Address) Marshal() ([]byte, error)

Marshal turns an address into a binary rtnetlink message and a set of attributes.

func (Address) Prefix

func (a Address) Prefix() uint8

func (*Address) Unmarshal

func (a *Address) Unmarshal(buf []byte) error

Unmarshal reads an address and its attributes from a binary rtnetlink message.

type Attributes

type Attributes interface {
	Marshal(*Context) ([]byte, error)
	Unmarshal(*Context, []byte) error
	Resolve(*Context) error
}

Attributes is an interface that is used on all types that can be marshaled and unmarshaled from rtnetlink attributes

type Bridge

type Bridge struct {
	VlanAware bool
}

func (*Bridge) Marshal

func (b *Bridge) Marshal(ctx *Context) ([]byte, error)

func (*Bridge) Resolve

func (b *Bridge) Resolve(ctx *Context) error

func (*Bridge) Unmarshal

func (b *Bridge) Unmarshal(ctx *Context, buf []byte) error

type Context

type Context struct {
	Target *Context
	// contains filtered or unexported fields
}

func OpenContext

func OpenContext(namespace string) (*Context, error)

OpenContext creates a context in the specified namespace

func OpenDefaultContext

func OpenDefaultContext() (*Context, error)

OpenDefaultContext creates a context in the default namespace

func (*Context) Close

func (c *Context) Close() error

func (*Context) Fd

func (c *Context) Fd() int

type Fib

type Fib struct {
	Family uint8
	DstLen uint8
	SrcLen uint8
	Tos    uint8
	Table  uint8
	Res1   uint8
	Res2   uint8
	Action uint8
	Flags  uint32
}
type Link struct {
	Msg  unix.IfInfomsg
	Info *LinkInfo
}

Link consolidates link information from rtnetlink

func GetLink(ctx *Context, name string) (*Link, error)

func GetLinkByIndex

func GetLinkByIndex(ctx *Context, index int32) (*Link, error)
func NewLink() *Link

NewLink creates a new empty link data structure

func ReadLinks(ctx *Context, spec *Link) ([]*Link, error)

ReadLinks reads a set of links according to the provided specification. For example, if you specify the address family, only links from that family will be returned. Some basic attribute filtering is also implemented.

func (*Link) Absent

func (l *Link) Absent(ctx *Context) error

Absent ensures the link is absent.

func (*Link) Add

func (l *Link) Add(ctx *Context) error

Add the link to the kernel.

func (*Link) AddAddr

func (l *Link) AddAddr(ctx *Context, addr *Address) error

func (*Link) AddAltNames added in v0.1.13

func (l *Link) AddAltNames(ctx *Context, altNames []string) error

AddAltNames: adds altnames of the interface/link analogous to `ip link property add dev <dev> altname <altName>` If any of the altNames are already assigned, returns an error

func (*Link) Addrs added in v0.1.9

func (l *Link) Addrs(ctx *Context) ([]*Address, error)

func (*Link) ApplyType

func (l *Link) ApplyType(typ string) Attributes

ApplyType activates the link type defined by the provided string.

func (*Link) Attributes

func (l *Link) Attributes() []Attributes

Attributes returns a set of Attributes objects from the link.

func (*Link) ChangeContext added in v0.1.11

func (l *Link) ChangeContext(ctx *Context, new *Context) error

func (*Link) Del

func (l *Link) Del(ctx *Context) error

Del deletes the link from the kernel.

func (*Link) DelAltNames added in v0.1.13

func (l *Link) DelAltNames(ctx *Context, altNames []string) error

DelAltNames: adds altnames of the interface/link analogous to `ip link property del dev <dev> altname <altName>` If any of the altNames aren't assigned, returns an error

func (*Link) Down

func (l *Link) Down(ctx *Context) error

Up down brings down the link

func (*Link) IsUp added in v0.1.11

func (l *Link) IsUp() bool

Determine if a link is up

func (Link) Marshal

func (l Link) Marshal(ctx *Context) ([]byte, error)

Marshal turns a link into a binary rtnetlink message and a set of attributes.

func (*Link) Modify

func (l *Link) Modify(ctx *Context, op uint16) error

Modify changes the link according to the supplied operation. Supported operations include RTM_NEWLINK, RTM_SETLINK, and RTM_DELLINK.

func (*Link) Present

func (l *Link) Present(ctx *Context) error

Present ensures the link is present.

func (*Link) Promisc

func (l *Link) Promisc(ctx *Context, v bool) error

func (*Link) Read

func (l *Link) Read(ctx *Context) error

func (*Link) Satisfies

func (l *Link) Satisfies(spec *Link) bool

Satisfies returns true if this link satisfies the provided spec.

func (*Link) Set

func (l *Link) Set(ctx *Context) error

Set sets link attributes, currently doesn't set VFs, use VfSet for that

func (*Link) SetMaster

func (l *Link) SetMaster(ctx *Context, index int) error

func (*Link) SetMtu

func (l *Link) SetMtu(ctx *Context, mtu int) error

func (*Link) SetNoMaster added in v0.1.11

func (l *Link) SetNoMaster(ctx *Context) error

func (*Link) SetTagged

func (l *Link) SetTagged(ctx *Context, vid uint16, unset bool, pvid bool, self bool) error

func (*Link) SetUntagged

func (l *Link) SetUntagged(ctx *Context, vid uint16, unset bool, pvid bool, self bool) error

func (*Link) SetVf added in v0.1.13

func (l *Link) SetVf(ctx *Context, vfn uint32, vfi *VfInfo) error

func (*Link) SetVlan

func (l *Link) SetVlan(ctx *Context, vid uint16, unset, untagged, pvid, self bool) error

func (*Link) Unmarshal

func (l *Link) Unmarshal(ctx *Context, bs []byte) error

Unmarshal reads a link and its attributes from a binary rtnetlink message.

func (*Link) Up

func (l *Link) Up(ctx *Context) error

Up brings up the link

type LinkInfo

type LinkInfo struct {
	// Name of the link
	Name string

	// Alt Names of the link
	AltNames []string

	// layer 2 address
	Address net.HardwareAddr

	Promisc bool

	// network namespace file descriptor
	Ns uint32

	// maximum transmission unit
	Mtu uint32

	// the network namespace the link is in
	LinkNS uint32

	// bridge master
	Master uint32

	// vlan-aware bridge properties
	Pvid     uint16
	Untagged []uint16
	Tagged   []uint16

	// loopback properties
	Loopback *Loopback

	// veth properties
	Veth *Veth

	// vxlan properties
	Vxlan *Vxlan

	// bridge properties
	Bridge *Bridge

	// tap properties
	Tap *Tap

	// tun properties
	Tun *Tun

	// vrf properties
	Vrf *Vrf

	// macvlan properties
	Macvlan *Macvlan

	// wireguard properties
	Wireguard *Wireguard

	// Vlan properties
	Vlan *Vlan

	// VF Data
	Vfi VfInfos
}

LinkInfo holds link attribute data

func (*LinkInfo) Type

func (li *LinkInfo) Type() LinkType

type LinkType

type LinkType uint32

LinkType aliases link type enumerations in a type safe way

const (
	UnspecLinkType LinkType = iota
	LoopbackType
	PhysicalType
	VxlanType
	VethType
	BridgeType
	TapType
	TunType
	VrfType
	MacvlanType
	WireguardType
	VlanType
)

func ParseLinkType

func ParseLinkType(str string) LinkType

func (LinkType) String

func (lt LinkType) String() string

type Loopback

type Loopback struct {
}

func (*Loopback) Marshal

func (t *Loopback) Marshal(ctx *Context) ([]byte, error)

func (*Loopback) Resolve

func (t *Loopback) Resolve(ctx *Context) error

func (*Loopback) Unmarshal

func (t *Loopback) Unmarshal(ctx *Context, buf []byte) error

type Macvlan added in v0.1.3

type Macvlan struct {
	Mode MacvlanMode
	Link uint32
}

func (*Macvlan) Marshal added in v0.1.3

func (m *Macvlan) Marshal(ctx *Context) ([]byte, error)

func (*Macvlan) Resolve added in v0.1.3

func (m *Macvlan) Resolve(ctx *Context) error

func (*Macvlan) Unmarshal added in v0.1.3

func (m *Macvlan) Unmarshal(ctx *Context, buf []byte) error

type MacvlanMode added in v0.1.3

type MacvlanMode uint32
const (
	MACVLAN_MODE_PRIVATE MacvlanMode = 1 << iota
	MACVLAN_MODE_VEPA
	MACVLAN_MODE_BRIDGE
	MACVLAN_MODE_PASSTHRU
	MACVLAN_MODE_SOURCE
)

func ParseMacvlanMode added in v0.1.3

func ParseMacvlanMode(mode string) (MacvlanMode, error)

type NbrMsg

type NbrMsg struct {
	Msg           NdMsg
	RawAttributes []netlink.Attribute

	Neighbor
}

NbrMsg encapsulates a netlink NdMsg, providing Marshal/Unmarshal support

func (NbrMsg) Marshal

func (n NbrMsg) Marshal() ([]byte, error)

Marshal a neighbor message to bytes

func (*NbrMsg) Unmarshal

func (n *NbrMsg) Unmarshal(bs []byte) error

Unmarshal a neighbor message and its attributes from bytes

type NdMsg

type NdMsg struct {
	Family  uint8
	Ifindex uint32
	State   uint16
	Flags   uint8
	Type    uint8
}

NdMsg is a Netlink message for communicating with the kernel about neighbors. The unix library does not have this one

type Neighbor

type Neighbor struct {
	Mac    net.HardwareAddr
	Vlan   uint32
	Port   uint32
	Master uint32
	If     uint32
	Ifx    string
	Dst    net.IP
	Vni    uint32
	SrcVni uint32
	Router bool
	Family uint8
}

Neighbor encapsulates information about neighbors

type Route

type Route struct {
	Hdr      unix.RtMsg
	Dest     net.IP
	Src      net.IP
	Gateway  net.IP
	PrefSrc  net.IP
	Oif      uint32
	Iif      uint32
	Priority uint32
	Metrics  uint32
	Table    uint32
}

Route encapsulates information about a route

func ReadRoutes

func ReadRoutes(ctx *Context, spec *Route) ([]*Route, error)

func (*Route) Absent

func (r *Route) Absent(ctx *Context) error

func (*Route) Add

func (r *Route) Add(ctx *Context) error

func (*Route) Del

func (r *Route) Del(ctx *Context) error

func (*Route) Marshal

func (r *Route) Marshal() ([]byte, error)

Marshal a route message to bytes

func (*Route) Modify

func (r *Route) Modify(ctx *Context, op uint16) error

func (*Route) Present

func (r *Route) Present(ctx *Context) error

func (*Route) Unmarshal

func (r *Route) Unmarshal(bs []byte) error

Unmarshal an route message and its attributes from bytes

type Rule

type Rule struct {
	Fib      Fib
	Priority uint32
	Src      net.IP
	Dest     net.IP
	Oif      string
	Iif      string
	Fwmark   uint32
	Table    uint32
}

func ReadRules

func ReadRules(ctx *Context, spec *Rule) ([]*Rule, error)

func (*Rule) Absent

func (r *Rule) Absent(ctx *Context) error

func (*Rule) Add

func (r *Rule) Add(ctx *Context) error

func (*Rule) Del

func (r *Rule) Del(ctx *Context) error

func (*Rule) Marshal

func (r *Rule) Marshal(ctx *Context) ([]byte, error)

func (*Rule) Modify

func (r *Rule) Modify(ctx *Context, op uint16) error

func (*Rule) Present

func (r *Rule) Present(ctx *Context) error

func (*Rule) Resolve

func (r *Rule) Resolve(ctx *Context) error

func (*Rule) Unmarshal

func (r *Rule) Unmarshal(ctx *Context, buf []byte) error

type Tap

type Tap struct {
}

func (*Tap) Marshal

func (t *Tap) Marshal(ctx *Context) ([]byte, error)

func (*Tap) Resolve

func (t *Tap) Resolve(ctx *Context) error

func (*Tap) Unmarshal

func (t *Tap) Unmarshal(ctx *Context, buf []byte) error

type Tun

type Tun struct {
}

func (*Tun) Marshal

func (t *Tun) Marshal(ctx *Context) ([]byte, error)

func (*Tun) Resolve

func (t *Tun) Resolve(ctx *Context) error

func (*Tun) Unmarshal

func (t *Tun) Unmarshal(ctx *Context, buf []byte) error

type Veth

type Veth struct {
	Peer    string
	PeerIfx uint32
	PeerNS  uint32
}

Veth encapsulates information about virtual ethernet devices

func (*Veth) Marshal

func (v *Veth) Marshal(ctx *Context) ([]byte, error)

Marshal turns a veth into a binary rtnetlink set of attributes.

func (*Veth) Resolve

func (v *Veth) Resolve(ctx *Context) error

Reolve handle attributes

func (*Veth) ResolvePeer

func (v *Veth) ResolvePeer(ctx *Context) error

ResolvePeer fills in this veth's peer interface name from its index.

func (*Veth) Satisfies

func (v *Veth) Satisfies(spec *Veth) bool

Satisfies returns true if this veth satisfies the provided spec

func (*Veth) Unmarshal

func (v *Veth) Unmarshal(ctx *Context, buf []byte) error

Unmarshal reads a veth from a binary set of attributes.

type VfInfo added in v0.1.13

type VfInfo struct {
	// Mac address
	Address net.HardwareAddr
	// Vlan id assigned to the VF (VST?)
	Vlan uint32
	// Quality-ofService
	Qos uint32
	// limit on tx-rate, 0 is unlimited, in Mbps
	TxRate    uint32
	MinTxRate uint32
	MaxTxRate uint32
	// spoofcheck is enabled
	Spoofchk bool
}

VfInfo holds data on a particular VF

type VfInfos added in v0.1.13

type VfInfos struct {
	// Number of VFs on the device (this comes from a separate field)
	NumVf uint32
	// Info returned about each VF, indexed by VF number
	Map map[uint32]*VfInfo
}

VfInfos holds virtual function data

type Vlan added in v0.1.11

type Vlan struct {
	Id   uint16
	Link uint32
}

func (*Vlan) Marshal added in v0.1.11

func (v *Vlan) Marshal(ctx *Context) ([]byte, error)

func (*Vlan) Resolve added in v0.1.11

func (v *Vlan) Resolve(ctx *Context) error

Resolve handle attributes

func (*Vlan) Unmarshal added in v0.1.11

func (v *Vlan) Unmarshal(ctx *Context, buf []byte) error

type Vrf added in v0.1.2

type Vrf struct {
	Table uint32
}

func (*Vrf) Marshal added in v0.1.2

func (v *Vrf) Marshal(ctx *Context) ([]byte, error)

func (*Vrf) Resolve added in v0.1.2

func (v *Vrf) Resolve(ctx *Context) error

func (*Vrf) Unmarshal added in v0.1.2

func (v *Vrf) Unmarshal(ctx *Context, buf []byte) error

type Vxlan

type Vxlan struct {
	Vni      uint32
	Learning uint8
	DstPort  uint16
	Local    net.IP
	Link     uint32 // interface index
}

Vxlan encapsulates information about virtual extensible LAN devices.

func (*Vxlan) Marshal

func (v *Vxlan) Marshal(ctx *Context) ([]byte, error)

Marshal turns a vxlan into a binary rtnetlink set of attributes.

func (*Vxlan) Resolve

func (v *Vxlan) Resolve(ctx *Context) error

Resolve handle attributes

func (*Vxlan) Unmarshal

func (v *Vxlan) Unmarshal(ctx *Context, buf []byte) error

Unmarshal reads a vxlan from a binary set of attributes.

type Wireguard added in v0.1.7

type Wireguard struct {
}

func (*Wireguard) Marshal added in v0.1.7

func (t *Wireguard) Marshal(ctx *Context) ([]byte, error)

func (*Wireguard) Resolve added in v0.1.7

func (t *Wireguard) Resolve(ctx *Context) error

func (*Wireguard) Unmarshal added in v0.1.7

func (t *Wireguard) Unmarshal(ctx *Context, buf []byte) error

Directories

Path Synopsis
cmd
nl

Jump to

Keyboard shortcuts

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