driver

package
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package driver provides link type specific decoding and encoding types for use with the rtnetlink library.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bond

type Bond struct {

	// Specifies the bonding policy. The default is balance-rr (round robin)
	Mode BondMode

	// Specifies the new active slave for modes that support it (active-backup, balance-alb and balance-tlb)
	ActiveSlave *uint32

	// Specifies the MII link monitoring frequency in milliseconds
	Miimon *uint32

	// Specifies the time, in milliseconds, to wait before enabling a slave after a link recovery has been detected
	UpDelay *uint32

	// Specifies the time, in milliseconds, to wait before disabling a slave after a link failure has been detected
	DownDelay *uint32

	// Specify the delay, in milliseconds, between each peer notification
	PeerNotifyDelay *uint32

	// Specifies whether or not miimon should use MII or ETHTOOL
	UseCarrier *uint8

	// Specifies the ARP link monitoring frequency in milliseconds
	ArpInterval *uint32

	// Specifies the IP addresses to use as ARP monitoring peers when arp_interval is > 0
	ArpIpTargets []net.IP

	// Specifies the IPv6 addresses to use as IPv6 monitoring peers when arp_interval is > 0
	NsIP6Targets []net.IP

	// Specifies whether or not ARP probes and replies should be validated
	ArpValidate *BondArpValidate

	// Specifies the quantity of arp_ip_targets that must be reachable in order for the ARP monitor to consider a slave as being up
	ArpAllTargets *BondArpAllTargets

	// A device index specifying which slave is the primary device
	Primary *uint32

	// Specifies the reselection policy for the primary slave
	PrimaryReselect *BondPrimaryReselect

	// Specifies whether active-backup mode should set all slaves to the same MAC address at enslavement, when enabled, or perform special handling
	FailOverMac *BondFailOverMac

	// Selects the transmit hash policy to use for slave selection
	XmitHashPolicy *BondXmitHashPolicy

	// Specifies the number of IGMP membership reports to be issued after a failover event
	ResendIgmp *uint32

	// Specify the number of peer notifications (gratuitous ARPs and unsolicited IPv6 Neighbor Advertisements) to be issued after a failover event
	NumPeerNotif *uint8

	// Specifies that duplicate frames (received on inactive ports) should be dropped (0) or delivered (1)
	AllSlavesActive *uint8

	// Specifies the minimum number of links that must be active before asserting carrier
	MinLinks *uint32

	// Specifies the number of seconds between instances where the bonding driver sends learning packets to each slaves peer switch
	LpInterval *uint32

	// Specify the number of packets to transmit through a slave before moving to the next one
	PacketsPerSlave *uint32

	// Option specifying whether to send LACPDU frames periodically
	AdLacpActive *BondAdLacpActive

	// Option specifying the rate in which we’ll ask our link partner to transmit LACPDU packets
	AdLacpRate *BondLacpRate

	// Specifies the 802.3ad aggregation selection logic to use
	AdSelect *BondAdSelect

	// In an AD system, this specifies the system priority
	AdActorSysPrio *uint16

	// Defines the upper 10 bits of the port key
	AdUserPortKey *uint16

	// In an AD system, this specifies the mac-address for the actor in protocol packet exchanges
	AdActorSystem net.HardwareAddr

	// Specifies if dynamic shuffling of flows is enabled in tlb or alb mode
	TlbDynamicLb *uint8

	// Specifies the number of arp_interval monitor checks that must fail in order for an interface to be marked down by the ARP monitor
	MissedMax *uint8

	// Specifies the 802.3ad aggregation information, this is read only value
	AdInfo *BondAdInfo
}

Bond implements LinkDriver for the bond driver

func (*Bond) Decode

func (b *Bond) Decode(ad *netlink.AttributeDecoder) error

func (*Bond) Encode

func (b *Bond) Encode(ae *netlink.AttributeEncoder) error

func (*Bond) Kind

func (*Bond) Kind() string

func (*Bond) New

func (b *Bond) New() rtnetlink.LinkDriver

type BondAdInfo

type BondAdInfo struct {
	AggregatorId uint16
	NumPorts     uint16
	ActorKey     uint16
	PartnerKey   uint16
	PartnerMac   net.HardwareAddr
}

BondAdInfo specifies the 802.3ad aggregation information

type BondAdLacpActive

type BondAdLacpActive uint8

BondAdLacpActive specifies whether to send LACPDU frames periodically.

const (
	// LACPDU frames acts as “speak when spoken to”
	BondAdLacpActiveOff BondAdLacpActive = iota

	// LACPDU frames are sent along the configured links periodically with the rate configured with BondLacpRate
	// This is the default value
	BondAdLacpActiveOn
)

func (BondAdLacpActive) String

func (b BondAdLacpActive) String() string

type BondAdSelect

type BondAdSelect uint8

BondAdSelect specifies the 802.3ad aggregation selection logic to use.

const (
	// The active aggregator is chosen by largest aggregate bandwidth
	// Reselection of the active aggregator occurs only when all slaves of the active aggregator
	// are down or the active aggregator has no slaves
	// This is the default value.
	BondAdSelectStable BondAdSelect = iota

	// The active aggregator is chosen by largest aggregate bandwidth.
	// Reselection occurs if:
	//  - A slave is added to or removed from the bond
	//  - Any slave’s link state changes
	//  - Any slave’s 802.3ad association state changes
	//  - The bond’s administrative state changes to up
	BondAdSelectBandwidth

	// The active aggregator is chosen by the largest number of ports (slaves)
	// Reselection rules are the same with BOND_AD_SELECT_BANDWIDTH
	BondAdSelectCount
)

func (BondAdSelect) String

func (b BondAdSelect) String() string

type BondArpAllTargets

type BondArpAllTargets uint32

BondArpAllTargets specifies the quantity of arp_ip_targets that must be reachable in order for the ARP monitor to consider a slave as being up. This option affects only active-backup mode for slaves with arp_validation enabled.

const (
	// Consider the slave up only when any of the arp_ip_targets is reachable
	BondArpAllTargetsAny BondArpAllTargets = iota

	// Consider the slave up only when all of the arp_ip_targets are reachable
	BondArpAllTargetsAll
)

func (BondArpAllTargets) String

func (b BondArpAllTargets) String() string

type BondArpValidate

type BondArpValidate uint32

BondArpValidate specifies whether or not ARP probes and replies should be validated in any mode that supports arp monitoring, or whether non-ARP traffic should be filtered (disregarded) for link monitoring purposes.

const (
	// No validation or filtering is performed
	BondArpValidateNone BondArpValidate = iota

	// Validation is performed only for the active slave
	BondArpValidateActive

	// Validation is performed only for backup slaves
	BondArpValidateBackup

	// Validation is performed for all slaves
	BondArpValidateAll

	// Filtering is applied to all slaves. No validation is performed
	BondArpValidateFilter

	// Filtering is applied to all slaves, validation is performed only for the active slave
	BondArpValidateFilterActive

	// Filtering is applied to all slaves, validation is performed only for backup slaves
	BondArpValidateFilterBackup
)

func (BondArpValidate) String

func (b BondArpValidate) String() string

type BondFailOverMac

type BondFailOverMac uint8

BondFailOverMac specifies whether active-backup mode should set all slaves to the same MAC address at enslavement (the traditional behavior), or, when enabled, perform special handling of the bond’s MAC address in accordance with the selected policy.

const (
	// This setting disables fail_over_mac, and causes bonding to set all slaves of an active-backup bond
	// to the same MAC address at enslavement time
	BondFailOverMacNone BondFailOverMac = iota

	// The “active” fail_over_mac policy indicates that the MAC address of the bond should always be
	// the MAC address of the currently active slave. The MAC address of the slaves is not changed;
	// instead, the MAC address of the bond changes during a failover
	BondFailOverMacActive

	// The “follow” fail_over_mac policy causes the MAC address of the bond to be selected normally
	// (normally the MAC address of the first slave added to the bond)
	// However, the second and subsequent slaves are not set to this MAC address while they are in a backup role;
	// a slave is programmed with the bond’s MAC address at failover time
	// (and the formerly active slave receives the newly active slave’s MAC address)
	BondFailOverMacFollow
)

func (BondFailOverMac) String

func (b BondFailOverMac) String() string

type BondLacpRate

type BondLacpRate uint8

Option specifying the rate in which we’ll ask our link partner to transmit LACPDU packets in 802.3ad mode.

const (
	// Request partner to transmit LACPDUs every 30 seconds
	// This is the default value
	BondLacpRateSlow BondLacpRate = iota

	// Request partner to transmit LACPDUs every 1 second
	BondLacpRateFast
)

func (BondLacpRate) String

func (b BondLacpRate) String() string

type BondMode

type BondMode uint8

BondMode specifies one of the bonding policies.

const (
	// Round-robin policy: Transmit packets in sequential order from the first available slave through the last
	// This is the default value
	BondModeBalanceRR BondMode = iota

	// Active-backup policy: Only one slave in the bond is active. A different slave becomes active if, and only if,
	// the active slave fails. The bond’s MAC address is externally visible on only one port (network adapter) to
	// avoid confusing the switch.
	BondModeActiveBackup

	// XOR policy: Transmit based on the selected transmit hash policy.
	// The default policy is BOND_XMIT_HASH_POLICY_LAYER2
	// Alternate transmit policies may be selected via the XmitHashPolicy option
	BondModeBalanceXOR

	// Broadcast policy: transmits everything on all slave interfaces
	BondModeBroadcast

	// IEEE 802.3ad Dynamic link aggregation. Creates aggregation groups that share the same speed and duplex settings.
	// Utilizes all slaves in the active aggregator according to the 802.3ad specification
	BondMode802_3AD

	// Adaptive transmit load balancing: channel bonding that does not require any special switch support
	// Outgoing traffic is configured by TlbDynamicLb field
	// Incoming traffic is received by the current slave. If the receiving slave fails,
	// another slave takes over the MAC address of the failed receiving slave.
	BondModeBalanceTLB

	// Adaptive load balancing: includes balance-tlb plus receive load balancing (rlb) for IPV4 traffic,
	// and does not require any special switch support
	BondModeBalanceALB

	BondModeUnknown
)

func (BondMode) String

func (b BondMode) String() string

type BondPrimaryReselect

type BondPrimaryReselect uint8

Specifies the reselection policy for the primary slave. This affects how the primary slave is chosen to become the active slave when failure of the active slave or recovery of the primary slave occurs. This option is designed to prevent flip-flopping between the primary slave and other slaves

const (
	// The primary slave becomes the active slave whenever it comes back up, this is the default value
	BondPrimaryReselectAlways BondPrimaryReselect = iota

	// The primary slave becomes the active slave when it comes back up,
	// if the speed and duplex of the primary slave is better than the speed and duplex of the current active slave
	BondPrimaryReselectBetter

	// The primary slave becomes the active slave only if the current active slave fails and the primary slave is up
	BondPrimaryReselectFailure
)

func (BondPrimaryReselect) String

func (b BondPrimaryReselect) String() string

type BondSlave

type BondSlave struct {
	State                  *BondSlaveState
	MiiStatus              *BondSlaveMiiStatus
	LinkFailureCount       *uint32
	PermHardwareAddr       net.HardwareAddr
	QueueId                *uint16
	Priority               *int32
	AggregatorId           *uint16
	AdActorOperPortState   *uint8
	AdPartnerOperPortState *uint16
}

BondSlave implements LinkSlaveDriver interface for bond driver

func (*BondSlave) Decode

func (b *BondSlave) Decode(ad *netlink.AttributeDecoder) error

func (*BondSlave) Encode

func (b *BondSlave) Encode(ae *netlink.AttributeEncoder) error

func (*BondSlave) Kind

func (*BondSlave) Kind() string

func (*BondSlave) New

func (b *BondSlave) New() rtnetlink.LinkDriver

func (*BondSlave) Slave

func (b *BondSlave) Slave()

type BondSlaveMiiStatus

type BondSlaveMiiStatus uint8

BondSlaveMiiStatus MII link monitoring frequency status

const (
	BondLinkUp BondSlaveMiiStatus = iota
	BondLinkFail
	BondLinkDown
	BondLinkBack
)

func (BondSlaveMiiStatus) String

func (b BondSlaveMiiStatus) String() string

type BondSlaveState

type BondSlaveState uint8

BondSlaveState specifies bond slave state

const (
	BondStateActive BondSlaveState = iota
	BondStateBackup
)

func (BondSlaveState) String

func (b BondSlaveState) String() string

type BondXmitHashPolicy

type BondXmitHashPolicy uint8

BondXmitHashPolicy specifies the transmit hash policy to use for slave selection in balance-xor, 802.3ad, and tlb modes.

const (
	// Uses XOR of hardware MAC addresses and packet type ID field to generate the hash
	BondXmitHashPolicyLayer2 BondXmitHashPolicy = iota

	// This policy uses upper layer protocol information, when available, to generate the hash
	// This allows for traffic to a particular network peer to span multiple slaves,
	// although a single connection will not span multiple slaves
	BondXmitHashPolicyLayer3_4

	// This policy uses a combination of layer2 and layer3 protocol information to generate the hash
	// Uses XOR of hardware MAC addresses and IP addresses to generate the hash
	BondXmitHashPolicyLayer2_3

	// This policy uses the same formula as layer2+3 but it relies on skb_flow_dissect to obtain
	// the header fields which might result in the use of inner headers if an encapsulation protocol is used
	BondXmitHashPolicyEncap2_3

	// This policy uses the same formula as layer3+4 but it relies on skb_flow_dissect to obtain
	// the header fields which might result in the use of inner headers if an encapsulation protocol is used
	BondXmitHashPolicyEncap3_4

	// This policy uses a very rudimentary vlan ID and source mac hash to load-balance traffic per-vlan,
	// with failover should one leg fail
	BondXmitHashPolicyVlanSrcMAC
)

func (BondXmitHashPolicy) String

func (b BondXmitHashPolicy) String() string

type Bridge added in v2.1.0

type Bridge struct {

	// Forward delay time in centiseconds (default: 1500, which is 15 seconds)
	ForwardDelay *uint32

	// Hello time in centiseconds (default: 200, which is 2 seconds)
	HelloTime *uint32

	// Maximum message age in centiseconds (default: 2000, which is 20 seconds)
	MaxAge *uint32

	// Ageing time in centiseconds (default: 30000, which is 300 seconds/5 minutes)
	AgeingTime *uint32

	// STP state (disabled/enabled)
	StpState *BridgeStpState

	// Bridge priority (default: 32768)
	Priority *uint16

	// VLAN filtering
	VlanFiltering *BridgeEnable

	// VLAN protocol (e.g., VlanProtocol8021Q for 802.1Q, VlanProtocol8021AD for 802.1ad)
	VlanProtocol *VlanProtocol

	// Group forward mask
	GroupFwdMask *uint16

	// Group address (MAC address)
	GroupAddr net.HardwareAddr

	// FDB flush - triggers a flush of the forwarding database
	FdbFlush *uint8

	// Multicast router setting (0=disabled, 1=enabled, 2=auto)
	McastRouter *uint8

	// Multicast snooping
	McastSnooping *BridgeEnable

	// Multicast query use IFADDR
	McastQueryUseIfaddr *BridgeEnable

	// Multicast querier
	McastQuerier *BridgeEnable

	// Multicast hash elasticity
	McastHashElasticity *uint32

	// Multicast hash max
	McastHashMax *uint32

	// Multicast last member count
	McastLastMemberCnt *uint32

	// Multicast startup query count
	McastStartupQueryCnt *uint32

	// Multicast last member interval in centiseconds
	McastLastMemberIntvl *uint64

	// Multicast membership interval in centiseconds
	McastMembershipIntvl *uint64

	// Multicast querier interval in centiseconds
	McastQuerierIntvl *uint64

	// Multicast query interval in centiseconds
	McastQueryIntvl *uint64

	// Multicast query response interval in centiseconds
	McastQueryResponseIntvl *uint64

	// Multicast startup query interval in centiseconds
	McastStartupQueryIntvl *uint64

	// NF call iptables
	NfCallIptables *BridgeEnable

	// NF call ip6tables
	NfCallIp6tables *BridgeEnable

	// NF call arptables
	NfCallArptables *BridgeEnable

	// VLAN default PVID
	VlanDefaultPvid *uint16

	// VLAN stats enabled
	VlanStatsEnabled *BridgeEnable

	// Multicast stats enabled
	McastStatsEnabled *BridgeEnable

	// Multicast IGMP version (2 or 3)
	McastIgmpVersion *uint8

	// Multicast MLD version (1 or 2)
	McastMldVersion *uint8

	// VLAN stats per port
	VlanStatsPerPort *BridgeEnable

	// FDB max learned entries (0=unlimited)
	FdbMaxLearned *uint32
}

Bridge implements LinkDriver for the bridge driver

func (*Bridge) Decode added in v2.1.0

func (b *Bridge) Decode(ad *netlink.AttributeDecoder) error

func (*Bridge) Encode added in v2.1.0

func (b *Bridge) Encode(ae *netlink.AttributeEncoder) error

func (*Bridge) Kind added in v2.1.0

func (*Bridge) Kind() string

func (*Bridge) New added in v2.1.0

func (b *Bridge) New() rtnetlink.LinkDriver

type BridgeEnable added in v2.1.0

type BridgeEnable uint8

BridgeEnable represents an enable/disable flag for various bridge features.

const (
	BridgeEnableDisabled BridgeEnable = 0
	BridgeEnableEnabled  BridgeEnable = 1
)

Enable/disable states.

func (BridgeEnable) String added in v2.1.0

func (e BridgeEnable) String() string

String returns a string representation of the BridgeEnable.

type BridgePort added in v2.1.0

type BridgePort struct {
	// Port state (disabled, listening, learning, forwarding, blocking)
	State *BridgePortState

	// Port priority (default: 32)
	Priority *uint16

	// Port cost (default: automatically calculated from link speed)
	Cost *uint32

	// Hairpin mode - allow packets to be sent back out the port they were received on
	Mode *BridgeEnable

	// BPDU guard - if enabled, STP BPDUs received on the port will cause it to be disabled
	Guard *BridgeEnable

	// Root guard - if enabled, the port will not become a root port
	Protect *BridgeEnable

	// Fast leave - immediately remove the port from multicast group when a leave message is received
	FastLeave *BridgeEnable

	// Learning - controls whether the bridge will learn MAC addresses from packets on this port
	Learning *BridgeEnable

	// Unicast flood - controls flooding of unicast traffic
	UnicastFlood *BridgeEnable

	// Proxy ARP
	ProxyArp *BridgeEnable

	// Learning sync
	LearningSync *BridgeEnable

	// Proxy ARP WiFi
	ProxyArpWifi *BridgeEnable

	// Multicast router (0=disabled, 1=enabled, 2=auto)
	MulticastRouter *uint8

	// Multicast fast leave
	McastFlood *BridgeEnable

	// Multicast to unicast
	McastToUcast *BridgeEnable

	// VLAN tunnel
	VlanTunnel *BridgeEnable

	// Broadcast flood
	BcastFlood *BridgeEnable

	// Group forward mask
	GroupFwdMask *uint16

	// Neighbor suppression
	NeighSuppress *BridgeEnable

	// Isolated - prevents communication between isolated ports
	Isolated *BridgeEnable

	// Backup port index
	BackupPort *uint32

	// Locked - prevents learning of MAC addresses
	Locked *BridgeEnable

	// MAB (MAC Authentication Bypass)
	Mab *BridgeEnable

	// Neighbor VLAN suppression
	NeighVlanSuppress *BridgeEnable

	// Backup nexthop ID
	BackupNhid *uint32
}

BridgePort implements LinkSlaveDriver for bridge port/slave configuration

func (*BridgePort) Decode added in v2.1.0

func (bp *BridgePort) Decode(ad *netlink.AttributeDecoder) error

func (*BridgePort) Encode added in v2.1.0

func (bp *BridgePort) Encode(ae *netlink.AttributeEncoder) error

func (*BridgePort) Kind added in v2.1.0

func (*BridgePort) Kind() string

func (*BridgePort) New added in v2.1.0

func (bp *BridgePort) New() rtnetlink.LinkDriver

func (*BridgePort) Slave added in v2.1.0

func (bp *BridgePort) Slave()

type BridgePortState added in v2.1.0

type BridgePortState uint8

BridgePortState specifies the port state in Spanning Tree Protocol

const (
	BridgePortStateDisabled BridgePortState = iota
	BridgePortStateListening
	BridgePortStateLearning
	BridgePortStateForwarding
	BridgePortStateBlocking
)

func (BridgePortState) String added in v2.1.0

func (s BridgePortState) String() string

type BridgeStpState added in v2.1.0

type BridgeStpState uint32

BridgeStpState represents the Spanning Tree Protocol state.

const (
	BridgeStpStateDisabled BridgeStpState = 0
	BridgeStpStateEnabled  BridgeStpState = 1
)

STP states.

func (BridgeStpState) String added in v2.1.0

func (s BridgeStpState) String() string

String returns a string representation of the BridgeStpState.

type Macvlan added in v2.1.0

type Macvlan struct {
	// Mode specifies the MACVLAN mode (private, vepa, bridge, passthru, source).
	Mode *MacvlanMode

	// Flags specifies MACVLAN flags (nopromisc, nodst).
	Flags *MacvlanFlag

	// MacaddrMode specifies the MAC address mode for source mode.
	MacaddrMode *MacvlanMacaddrMode

	// MacaddrData contains MAC addresses for source mode.
	MacaddrData [][]byte

	// MacaddrCount specifies the number of MAC addresses in source mode.
	MacaddrCount *uint32

	// BcQueueLen specifies the broadcast queue length.
	BcQueueLen *uint32

	// BcQueueLenUsed indicates if the broadcast queue length is being used.
	BcQueueLenUsed *uint8

	// BcCutoff specifies the broadcast cutoff value.
	BcCutoff *int32
}

Macvlan represents a MACVLAN device configuration.

func (*Macvlan) Decode added in v2.1.0

func (m *Macvlan) Decode(ad *netlink.AttributeDecoder) error

Decode decodes netlink attributes into the MACVLAN configuration.

func (*Macvlan) Encode added in v2.1.0

func (m *Macvlan) Encode(ae *netlink.AttributeEncoder) error

Encode encodes the MACVLAN configuration into netlink attributes.

func (*Macvlan) Kind added in v2.1.0

func (m *Macvlan) Kind() string

Kind returns the MACVLAN interface kind.

func (*Macvlan) New added in v2.1.0

func (m *Macvlan) New() rtnetlink.LinkDriver

New creates a new Macvlan instance.

type MacvlanFlag added in v2.1.0

type MacvlanFlag uint16

MacvlanFlag represents MACVLAN flags.

const (
	MacvlanFlagNopromisc MacvlanFlag = 0x1
	MacvlanFlagNodst     MacvlanFlag = 0x2
)

MACVLAN flags.

type MacvlanMacaddrMode added in v2.1.0

type MacvlanMacaddrMode uint32

MacvlanMacaddrMode represents the MACVLAN MAC address mode.

const (
	MacvlanMacaddrAdd   MacvlanMacaddrMode = 0x0
	MacvlanMacaddrDel   MacvlanMacaddrMode = 0x1
	MacvlanMacaddrFlush MacvlanMacaddrMode = 0x2
	MacvlanMacaddrSet   MacvlanMacaddrMode = 0x3
)

MACVLAN MAC address modes.

type MacvlanMode added in v2.1.0

type MacvlanMode uint32

MacvlanMode represents the MACVLAN operating mode.

const (
	MacvlanModePrivate  MacvlanMode = 0x1
	MacvlanModeVEPA     MacvlanMode = 0x2
	MacvlanModeBridge   MacvlanMode = 0x4
	MacvlanModePassthru MacvlanMode = 0x8
	MacvlanModeSource   MacvlanMode = 0x10
)

MACVLAN modes.

func (MacvlanMode) String added in v2.1.0

func (m MacvlanMode) String() string

String returns a string representation of the MacvlanMode.

type Netkit

type Netkit struct {
	Mode       *NetkitMode            // Specifies driver operation mode
	Policy     *NetkitPolicy          // Specifies default policy
	PeerPolicy *NetkitPolicy          // Specifies default peer policy
	Primary    bool                   // Shows primary link
	PeerInfo   *rtnetlink.LinkMessage // Specifies peer link information
}

Netkit implements LinkDriverVerifier for the netkit driver

func (*Netkit) Decode

func (n *Netkit) Decode(ad *netlink.AttributeDecoder) error

func (*Netkit) Encode

func (n *Netkit) Encode(ae *netlink.AttributeEncoder) error

func (*Netkit) Kind

func (n *Netkit) Kind() string

func (*Netkit) New

func (n *Netkit) New() rtnetlink.LinkDriver

func (*Netkit) Verify

func (n *Netkit) Verify(msg *rtnetlink.LinkMessage) error

type NetkitMode

type NetkitMode uint32

NetkitMode specifies netkit operation mode

const (
	// Netkit operates on layer2
	NetkitModeL2 NetkitMode = unix.NETKIT_L2

	// Netkit operates on layer3, this is the default mode
	NetkitModeL3 NetkitMode = unix.NETKIT_L3
)

func (NetkitMode) String

func (n NetkitMode) String() string

type NetkitPolicy

type NetkitPolicy int32

NetkitPolicy specifies default packet policy when no eBPF program is attached

const (
	// Default policy to forwards packets
	NetkitPolicyPass NetkitPolicy = unix.NETKIT_PASS

	// Default policy to drops packets
	NetkitPolicyDrop NetkitPolicy = unix.NETKIT_DROP
)

func (NetkitPolicy) String

func (n NetkitPolicy) String() string

type Veth

type Veth struct {
	PeerInfo *rtnetlink.LinkMessage // Specifies peer link information
}

Veth implements LinkDriverVerifier for the veth driver

func (*Veth) Decode

func (v *Veth) Decode(ad *netlink.AttributeDecoder) error

func (*Veth) Encode

func (v *Veth) Encode(ae *netlink.AttributeEncoder) error

func (*Veth) Kind

func (*Veth) Kind() string

func (*Veth) New

func (v *Veth) New() rtnetlink.LinkDriver

func (*Veth) Verify

func (v *Veth) Verify(msg *rtnetlink.LinkMessage) error

type Vlan added in v2.1.0

type Vlan struct {
	// ID specifies the VLAN ID (1-4094).
	ID *uint16

	// Protocol specifies the VLAN protocol (802.1Q or 802.1ad).
	Protocol *VlanProtocol

	// Flags specifies VLAN flags.
	Flags *VlanFlag

	// EgressQos specifies egress QoS mappings.
	EgressQos []VlanQosMapping

	// IngressQos specifies ingress QoS mappings.
	IngressQos []VlanQosMapping
}

Vlan represents a VLAN device configuration.

func (*Vlan) Decode added in v2.1.0

func (v *Vlan) Decode(ad *netlink.AttributeDecoder) error

Decode decodes netlink attributes into a Vlan.

func (*Vlan) Encode added in v2.1.0

func (v *Vlan) Encode(ae *netlink.AttributeEncoder) error

Encode encodes a Vlan into netlink attributes.

func (*Vlan) Kind added in v2.1.0

func (v *Vlan) Kind() string

Kind returns the VLAN interface kind.

func (*Vlan) New added in v2.1.0

func (v *Vlan) New() rtnetlink.LinkDriver

New creates a new Vlan instance.

type VlanFlag added in v2.1.0

type VlanFlag uint32

VlanFlag represents VLAN flags.

const (
	VlanFlagReorderHdr    VlanFlag = 0x1
	VlanFlagGVRP          VlanFlag = 0x2
	VlanFlagLooseBinding  VlanFlag = 0x4
	VlanFlagMVRP          VlanFlag = 0x8
	VlanFlagBridgeBinding VlanFlag = 0x10
)

VLAN flags.

type VlanProtocol added in v2.1.0

type VlanProtocol uint16

VlanProtocol represents the VLAN protocol type.

const (
	// VlanProtocol8021Q represents 802.1Q VLAN tagging (standard VLAN).
	VlanProtocol8021Q VlanProtocol = 0x0081

	// VlanProtocol8021AD represents 802.1ad QinQ (VLAN stacking).
	VlanProtocol8021AD VlanProtocol = 0xA888
)

VLAN protocols.

func (VlanProtocol) String added in v2.1.0

func (p VlanProtocol) String() string

String returns a string representation of the VlanProtocol.

type VlanQosMapping added in v2.1.0

type VlanQosMapping struct {
	From uint32
	To   uint32
}

VlanQosMapping represents a QoS priority mapping.

type Vxlan added in v2.1.0

type Vxlan struct {
	// VXLAN Network Identifier (or VXLAN Segment ID) - required
	ID *uint32

	// Multicast group IP address to join (IPv4)
	Group net.IP

	// Multicast group IP address to join (IPv6)
	Group6 net.IP

	// Physical device to use for tunnel endpoint communication
	Link *uint32

	// Source IP address to use in outgoing packets (IPv4)
	Local net.IP

	// Source IP address to use in outgoing packets (IPv6)
	Local6 net.IP

	// TTL to use in outgoing packets
	TTL *uint8

	// TOS to use in outgoing packets
	TOS *uint8

	// Enable learning of source link addresses
	Learning *bool

	// Lifetime in seconds of FDB entries learnt by the kernel
	Ageing *uint32

	// Maximum number of FDB entries
	Limit *uint32

	// Range of source UDP ports to use
	PortRange *VxlanPortRange

	// Enable ARP proxy
	Proxy *bool

	// Enable route short circuit
	RSC *bool

	// Enable netlink LLADDR miss notifications
	L2Miss *bool

	// Enable netlink IP address miss notifications
	L3Miss *bool

	// Destination port for VXLAN traffic (default 4789)
	Port *uint16

	// Enable UDP checksums on transmit for outer IPv4
	UDPCsum *bool

	// Enable zero UDP checksums on transmit for outer IPv6
	UDPZeroCsum6Tx *bool

	// Allow zero UDP checksums on receive for outer IPv6
	UDPZeroCsum6Rx *bool

	// Enable remote checksum offload on transmit
	RemCsumTx *bool

	// Enable remote checksum offload on receive
	RemCsumRx *bool

	// Enable VXLAN Group Policy extension
	GBP *bool

	// Enable remote checksum offload without partial checksums
	RemCsumNoPartial *bool

	// Enable metadata collection mode
	CollectMetadata *bool

	// MPLS label to use for VXLAN encapsulation
	Label *uint32

	// Enable Generic Protocol Extension (VXLAN-GPE)
	GPE *bool

	// Inherit TTL from inner packet
	TTLInherit *bool

	// Specifies how to handle DF flag in outer IPv4 header
	DF *VxlanDFMode

	// Enable VXLAN VNI filtering
	VNIFilter *bool
}

Vxlan implements LinkDriver for the vxlan driver

func (*Vxlan) Decode added in v2.1.0

func (v *Vxlan) Decode(ad *netlink.AttributeDecoder) error

func (*Vxlan) Encode added in v2.1.0

func (v *Vxlan) Encode(ae *netlink.AttributeEncoder) error

func (*Vxlan) Kind added in v2.1.0

func (*Vxlan) Kind() string

func (*Vxlan) New added in v2.1.0

func (v *Vxlan) New() rtnetlink.LinkDriver

type VxlanDFMode added in v2.1.0

type VxlanDFMode uint8

VxlanDFMode specifies how to handle DF flag in outer IPv4 header

const (
	// VxlanDFUnset indicates DF flag is not set (default)
	VxlanDFUnset VxlanDFMode = iota

	// VxlanDFSet indicates DF flag is set
	VxlanDFSet

	// VxlanDFInherit indicates DF flag is inherited from inner IPv4 header
	VxlanDFInherit
)

func (VxlanDFMode) String added in v2.1.0

func (v VxlanDFMode) String() string

type VxlanPortRange added in v2.1.0

type VxlanPortRange struct {
	Low  uint16
	High uint16
}

VxlanPortRange specifies the range of source UDP ports

Jump to

Keyboard shortcuts

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