driver

package
v2.0.2 Latest Latest
Warning

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

Go to latest
Published: May 15, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

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 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

Jump to

Keyboard shortcuts

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