use errno::Errno;
use libc::c_int;
use mnl::{Attr, AttrTbl, MsgVec, Result};
#[repr(C)]
#[derive(Debug, Clone, Copy)]
pub struct RtnlLinkStats {
pub rx_packets: u32, pub tx_packets: u32, pub rx_bytes: u32, pub tx_bytes: u32, pub rx_errors: u32, pub tx_errors: u32, pub rx_dropped: u32, pub tx_dropped: u32, pub multicast: u32, pub collisions: u32,
pub rx_length_errors: u32,
pub rx_over_errors: u32, pub rx_crc_errors: u32, pub rx_frame_errors: u32, pub rx_fifo_errors: u32, pub rx_missed_errors: u32,
pub tx_aborted_errors: u32,
pub tx_carrier_errors: u32,
pub tx_fifo_errors: u32,
pub tx_heartbeat_errors: u32,
pub tx_window_errors: u32,
pub rx_compressed: u32,
pub tx_compressed: u32,
pub rx_nohandler: u32, }
#[repr(C)]
#[derive(Debug, Clone, Copy)]
pub struct RtnlLinkStats64 {
pub rx_packets: u64, pub tx_packets: u64, pub rx_bytes: u64, pub tx_bytes: u64, pub rx_errors: u64, pub tx_errors: u64, pub rx_dropped: u64, pub tx_dropped: u64, pub multicast: u64, pub collisions: u64,
pub rx_length_errors: u64,
pub rx_over_errors: u64, pub rx_crc_errors: u64, pub rx_frame_errors: u64, pub rx_fifo_errors: u64, pub rx_missed_errors: u64,
pub tx_aborted_errors: u64,
pub tx_carrier_errors: u64,
pub tx_fifo_errors: u64,
pub tx_heartbeat_errors: u64,
pub tx_window_errors: u64,
pub rx_compressed: u64,
pub tx_compressed: u64,
pub rx_nohandler: u64, }
#[repr(C)]
#[derive(Debug, Clone, Copy)]
pub struct RtnlLinkIfmap {
pub mem_start: u64,
pub mem_end: u64,
pub base_addr: u64,
pub irq: u16,
pub dma: u8,
pub port: u8,
}
#[repr(u16)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, NlaType)]
#[tbname = "IflaTbl"]
pub enum Ifla {
Unspec = 0,
#[nla_type(bytes, address)]
Address,
#[nla_type(bytes, broadcast)]
Broadcast,
#[nla_type(str, ifname)]
Ifname,
#[nla_type(u32, mtu)]
Mtu,
#[nla_type(u32, link)]
Link,
#[nla_type(str, qdisc)]
Qdisc,
#[nla_type(RtnlLinkStats, stats)]
Stats,
Cost,
Priority,
#[nla_type(u32, master)]
Master,
#[nla_type(bytes, wireless)]
Wireless,
Protinfo,
Txqlen,
Map,
Weight,
Operstate,
Linkmode,
Linkinfo,
NetNsPid,
Ifalias,
NumVf,
VfinfoList,
Stats64,
VfPorts,
PortSelf,
AfSpec,
Group,
NetNsFd,
ExtMask,
Promiscuity,
NumTxQueues,
NumRxQueues,
Carrier,
PhysPortId,
CarrierChanges,
PhysSwitchId,
LinkNetnsid,
PhysPortName,
ProtoDown,
GsoMaxSegs,
GsoMaxSize,
Pad,
Xdp,
Event,
NewNetnsid,
IfNetnsid,
CarrierUpCount,
CarrierDownCount,
NewIfindex,
MinMtu,
MaxMtu,
PropList,
AltIfname,
PermAddress,
ProtoDownReason,
_MAX,
}
#[repr(u16)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, NlaType)]
pub enum ProtoDownReason {
Unspec,
Mask,
Value,
_MAX,
}
#[repr(u16)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, NlaType)]
#[tbname = "InetTbl"]
pub enum Inet {
Unspec = 0,
Conf,
_MAX,
}
#[repr(u16)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, NlaType)]
#[tbname = "IflaInet6Tbl"]
pub enum Inet6 {
Unspec = 0,
#[nla_type(u32, flags)]
Flags,
Conf, Stats, Mcast,
#[nla_type(IflaCacheinfo, cacheinfo)]
Cacheinfo, Icmp6stats, Token, AddrGenMode, _MAX,
}
#[repr(u32)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum In6AddrGenMode {
Eui64 = 0,
None,
StablePrivacy,
Random,
}
pub const IN6_ADDR_GEN_MODE_EUI64: u32 = In6AddrGenMode::Eui64 as u32;
pub const IN6_ADDR_GEN_MODE_NONE: u32 = In6AddrGenMode::None as u32;
pub const IN6_ADDR_GEN_MODE_STABLE_PRIVACY: u32 = In6AddrGenMode::StablePrivacy as u32;
pub const IN6_ADDR_GEN_MODE_RANDOM: u32 = In6AddrGenMode::Random as u32;
#[repr(u16)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, NlaType)]
#[tbname = "BrTbl"]
pub enum Br {
Unspec = 0,
ForwardDelay,
HelloTime,
MasAge,
AgeingTime,
StpState,
Priority,
VlanFiltering,
VlanProtocol,
GroupFwdMask,
RootId,
BridgeId,
RootPort,
RootPathCost,
TopologyChange,
TopologyChangeDetedted,
HelloTimer,
TcnTimer,
TopologyChangeTimer,
GcTimer,
GroupAddr,
FdbFlush,
McastRouter,
McastSnooping,
McastQueryUseIfaddr,
McastQuerier,
McastHashElasticity,
McastHashMax,
McastLastMemberCnt,
McastStartupQueryCnt,
McastLastMemberIntvl,
McastMembershipIntvl,
McastQuerierIntvl,
McastQueryIntvl,
McastQueryResponseIntvl,
McastStartupQueryIntvl,
NfCallIptables,
NfCallIp6Tables,
NfCallArptables,
VlanDefaultPvid,
Pad,
VlanStatsEnabled,
McastStatsEnabled,
McastIgmpVersion,
McastMldVersion,
VlanStatsPerPort,
MultiBoolopt,
_MAX,
}
#[repr(C)]
#[derive(Debug, Clone, Copy)]
pub struct IflaBridgeId {
pub prio: [u8; 2usize],
pub addr: [u8; 6usize],
}
#[repr(C)]
#[derive(Debug, Clone, Copy)]
pub enum BridgeMode {
Unspec = 0,
Hairpin = 1,
}
pub const BRIDGE_MODE_UNSPEC: c_int = BridgeMode::Unspec as c_int;
pub const BRIDGE_MODE_HAIRPIN: c_int = BridgeMode::Hairpin as c_int;
#[repr(u16)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, NlaType)]
#[tbname = "BrportTbl"]
pub enum Brport {
Unspec = 0,
#[nla_type(u8, state)]
State,
#[nla_type(u16, priority)]
Priority,
#[nla_type(u32, cost)]
Cost,
#[nla_type(u8, mode)]
Mode,
#[nla_type(u8, guard)]
Guard,
#[nla_type(u8, protect)]
Protect,
#[nla_type(u8, fast_leave)]
FastLeave,
#[nla_type(u8, learning)]
Learning,
#[nla_type(u8, flood)]
UnicastFlood,
#[nla_type(u8, proxyarp)]
Proxyarp,
LearningSync,
#[nla_type(u8, proxyarp_wifi)]
ProxyarpWifi,
#[nla_type(IflaBridgeId, root_id)]
RootId,
#[nla_type(IflaBridgeId, bridge_id)]
BridgeId,
#[nla_type(u16, designated_port)]
DesignatedPort,
#[nla_type(u16, designated_cost)]
DesignatedCost,
#[nla_type(u16, id)]
Id,
#[nla_type(u16, no)]
No,
#[nla_type(u8, topology_change_ack)]
TopologyChangeAck,
#[nla_type(u8, config_pending)]
ConfigPending,
#[nla_type(u64, message_age_timer)]
MessageAgeTimer,
#[nla_type(u64, forward_delay_timer)]
ForwardDelayTimer,
#[nla_type(u64, hold_timer)]
HoldTimer,
Flush,
#[nla_type(u8, multicast_router)]
MulticastRouter,
Pad,
#[nla_type(u8, mcast_flood)]
McastFlood,
#[nla_type(u8, mcast_to_unicast)]
McastToUnicast,
#[nla_type(u8, vlan_tunnel)]
VlanTunnel,
#[nla_type(u8, bcast_flood)]
BcastFlood,
#[nla_type(u16, group_fwd_mask)]
GroupFwdMask,
#[nla_type(u8, neigh_suppress)]
NeighSuppress,
#[nla_type(u8, isolated)]
Isolated,
#[nla_type(u32, backup_port)]
BackupPort,
#[nla_type(u8, mrp_ring_open)]
MrpRingOpen,
#[nla_type(u8, mrp_in_open)]
MrpInOpen,
_MAX,
}
#[repr(C)]
#[derive(Debug, Clone, Copy)]
pub struct IflaCacheinfo {
pub max_reasm_len: u32,
pub tstamp: u32,
pub reachable_time: u32,
pub retrans_time: u32,
}
#[repr(u16)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, NlaType)]
#[tbname = "InfoTbl"]
pub enum Info {
Unspec = 0,
Kind,
Data,
Xstats,
SlaveKind,
SlaveData,
_MAX,
}
#[repr(u16)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, NlaType)]
#[tbname = "VlanTbl"]
pub enum Vlan {
Unspec = 0,
Id,
Flags,
EgressQos,
IngressQos,
Protocol,
_MAX,
}
#[repr(C)]
#[derive(Debug, Clone, Copy)]
pub struct IflaVlanFlags {
pub flags: u32,
pub mask: u32,
}
#[repr(u16)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, NlaType)]
#[tbname = "VlanQosTbl"]
pub enum VlanQos {
Unspec = 0,
Mapping,
_MAX,
}
#[repr(C)]
#[derive(Debug, Clone, Copy)]
pub struct IflaVlanQosMapping {
pub from: u32,
pub to: u32,
}
#[repr(u16)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, NlaType)]
#[tbname = "MacvlanTbl"]
pub enum Macvlan {
Unspec = 0,
Mode,
Flags,
MacaddrMode,
Macaddr,
MacaddrData,
MacaddrCount,
_MAX,
}
#[repr(u32)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum MacvlanMode {
Private = 1, Vepa = 2, Bridge = 4, Passthru = 8, Source = 16, }
pub const MACVLAN_MODE_PRIVATE: u32 = MacvlanMode::Private as u32;
pub const MACVLAN_MODE_VEPA: u32 = MacvlanMode::Vepa as u32;
pub const MACVLAN_MODE_BRIDGE: u32 = MacvlanMode::Bridge as u32;
pub const MACVLAN_MODE_PASSTHRU: u32 = MacvlanMode::Passthru as u32;
pub const MACVLAN_MODE_SOURCE: u32 = MacvlanMode::Source as u32;
#[repr(u32)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum MacvlanMacaddrMode {
Add = 0,
Del,
Flush,
Set,
}
pub const MACVLAN_MACADDR_ADD: u32 = MacvlanMacaddrMode::Add as u32;
pub const MACVLAN_MACADDR_DEL: u32 = MacvlanMacaddrMode::Del as u32;
pub const MACVLAN_MACADDR_FLUSH: u32 = MacvlanMacaddrMode::Flush as u32;
pub const MACVLAN_MACADDR_SET: u32 = MacvlanMacaddrMode::Set as u32;
#[repr(u16)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, NlaType)]
#[tbname = "VrfTbl"]
pub enum Vrf {
Unspec,
Table,
_MAX,
}
#[repr(u16)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, NlaType)]
#[tbname = "VrfPortTbl"]
pub enum VrfPort {
Unspec = 0,
Table,
_MAX,
}
#[repr(u16)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, NlaType)]
#[tbname = "MacsecTbl"]
pub enum Macsec {
Unspec = 0,
Sci,
Port,
IcvLen,
CipherSuite,
Window,
EncodingSa,
Encrypt,
Protect,
IncSci,
Es,
Scb,
ReplayProtect,
Validation,
Pad,
Offload,
_MAX,
}
#[repr(u16)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, NlaType)]
#[tbname = "XfrmTbl"]
pub enum Xfrm {
Unspec = 0,
Link,
IfId,
_MAX,
}
#[repr(u8)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum MacsecValidationType {
Disabled = 0,
Check = 1,
Strict = 2,
_END,
}
pub const MACSEC_VALIDATE_DISABLED: u8 = MacsecValidationType::Disabled as u8;
pub const MACSEC_VALIDATE_CHECK: u8 = MacsecValidationType::Check as u8;
pub const MACSEC_VALIDATE_STRICT: u8 = MacsecValidationType::Strict as u8;
pub const __MACSEC_VALIDATE_END: u8 = MacsecValidationType::_END as u8;
pub const MACSEC_VALIDATE_MAX: u8 = __MACSEC_VALIDATE_END - 1;
#[repr(C)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum MacsecOffload {
Off = 0,
Phy = 1,
Mac = 2,
_END,
}
pub const MACSEC_OFFLOAD_OFF: c_int = MacsecOffload::Off as c_int;
pub const MACSEC_OFFLOAD_PHY: c_int = MacsecOffload::Phy as c_int;
pub const MACSEC_OFFLOAD_MAC: c_int = MacsecOffload::Mac as c_int;
pub const __MACSEC_OFFLOAD_END: c_int = MacsecOffload::_END as c_int;
pub const MACSEC_OFFLOAD_MAX: c_int = __MACSEC_OFFLOAD_END - 1;
#[repr(u16)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, NlaType)]
#[tbname = "IpvlanTbl"]
pub enum Ipvlan {
Unspec = 0,
Mode,
Flags,
_MAX,
}
#[repr(u16)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum IpvlanMode {
L2 = 0,
L3,
L3S,
MAX,
}
pub const IPVLAN_MODE_L2: u16 = IpvlanMode::L2 as u16;
pub const IPVLAN_MODE_L3: u16 = IpvlanMode::L3 as u16;
pub const IPVLAN_MODE_L3S: u16 = IpvlanMode::L3S as u16;
pub const IPVLAN_MODE_MAX: u16 = IpvlanMode::MAX as u16;
pub const IPVLAN_F_PRIVATE: u16 = 0x01;
pub const IPVLAN_F_VEPA: u16 = 0x02;
#[repr(u16)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, NlaType)]
#[tbname = "VxlanTbl"]
pub enum Vxlan {
Unspec = 0,
Id,
Group, Link,
Local,
Ttl,
Tos,
Learning,
Ageing,
Limit,
PortRange, Proxy,
Rsc,
L2Miss,
L3Miss,
Port, Group6,
Local6,
UdpCsum,
UdpZeroCsum6Tx,
UdpZeroCsum6Rx,
RemcsumTx,
RemcsumRx,
Gbp,
RemcsumNopartial,
CollectMetadata,
Label,
Gpe,
TtlInherit,
Df,
_MAX,
}
#[repr(C)]
#[derive(Debug, Clone, Copy)]
pub struct IflaVxlanPortRange {
pub low: u16,
pub high: u16,
}
#[repr(C)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum IflaVxlanDf {
Unset = 0,
Set,
Inherit,
_END,
}
pub const VXLAN_DF_UNSET: c_int = IflaVxlanDf::Unset as c_int;
pub const VXLAN_DF_SET: c_int = IflaVxlanDf::Set as c_int;
pub const VXLAN_DF_INHERIT: c_int = IflaVxlanDf::Inherit as c_int;
pub const __VXLAN_DF_END: c_int = IflaVxlanDf::_END as c_int;
pub const VXLAN_DF_MAX: c_int = __VXLAN_DF_END - 1;
#[repr(u16)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, NlaType)]
#[tbname = "GeneveTbl"]
pub enum Geneve {
Unspec = 0,
Id,
Remote,
Ttl,
Tos,
Port,
CollectMetadata,
Remote6,
UdpCsum,
UdpZeroCsum6Tx,
UdpZeroCsum6Rx,
Label,
TtlInherit,
Df,
_MAX,
}
#[repr(C)]
#[derive(Debug, Clone, Copy)]
pub enum IflaGeneveDf {
Unset = 0,
Set,
Inherit,
_END,
}
pub const GENEVE_DF_UNSET: c_int = IflaGeneveDf::Unset as c_int;
pub const GENEVE_DF_SET: c_int = IflaGeneveDf::Set as c_int;
pub const GENEVE_DF_INHERIT: c_int = IflaGeneveDf::Inherit as c_int;
pub const __GENEVE_DF_END: c_int = IflaGeneveDf::_END as c_int;
pub const GENEVE_DF_MAX: c_int = __GENEVE_DF_END - 1;
#[repr(u16)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, NlaType)]
#[tbname = "BareUdpTbl"]
pub enum BareUdp {
Unspec,
Port,
Ethertype,
SrcportMin,
MultiprotoMode,
_MAX,
}
#[repr(u16)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, NlaType)]
#[tbname = "PppTbl"]
pub enum Ppp {
Unspec = 0,
DevFd,
_MAX,
}
#[repr(u32)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum IflaGtpRole {
Ggsn = 0,
Sgsn,
}
pub const GTP_ROLE_GGSN: u32 = IflaGtpRole::Ggsn as u32;
pub const GTP_ROLE_SGSN: u32 = IflaGtpRole::Sgsn as u32;
#[repr(u16)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, NlaType)]
#[tbname = "GtpTbl"]
pub enum Gtp {
Unspec = 0,
Fd0,
Fd1,
PdpHashsize,
Role,
_MAX,
}
#[repr(u16)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, NlaType)]
#[tbname = "BondTbl"]
pub enum Bond {
Unspec = 0,
Mode,
ActiveSlave,
Miimon,
Updelay,
Downdelay,
UseCarrier,
ArpInterval,
ArpIpTarget,
ArpValidate,
ArpAllTargets,
Primary,
PrimaryReselect,
FailOverMac,
XmitHashPolicy,
ResendIgmp,
NumPeerNotif,
AllSlavesActive,
MinLinks,
LpInterval,
PacketsPerSlave,
AdLacpRate,
AdSelect,
AdInfo,
AdActorSysPrio,
AdUserPortKey,
AdActorSystem,
TlbDynamicLb,
PeerNotifDelay,
_MAX,
}
#[repr(u16)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, NlaType)]
#[tbname = "BondAdInfoTbl"]
pub enum BondAdInfo {
Unspec = 0,
Aggregator,
NumPorts,
ActorKey,
PartnerKey,
PartnerMac,
_MAX,
}
#[repr(u16)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, NlaType)]
#[tbname = "BondSlaveTbl"]
pub enum BondBondSlave {
Unspec = 0,
State,
MiiStatus,
LinkFailureCount,
PermHwaddr,
QueueId,
AdAggregatorId,
AdActorOperPortState,
AdPartnerOperPortState,
_MAX,
}
#[repr(u16)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, NlaType)]
#[tbname = "VfInfoTbl"]
pub enum VfInfo {
Unspec = 0,
Info = 1, _MAX,
}
#[repr(u16)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, NlaType)]
#[tbname = "VfTbl"]
pub enum Vf {
Unspec = 0,
Mac, Vlan, TxRate, Spoofchk, LinkState, Rate, RssQueryEn, Stats, Trust, IbNodeGuid, IbPortGuid, VlanList, Broadcast, _MAX,
}
#[repr(C)]
#[derive(Debug, Clone, Copy)]
pub struct IflaVfMac {
pub vf: u32,
pub mac: [u8; 32usize], }
#[repr(C)]
#[derive(Debug, Clone, Copy)]
pub struct IflaVfBroadcast {
pub broadcast: [u8; 32usize],
}
#[repr(C)]
#[derive(Debug, Clone, Copy)]
pub struct IflaVfVlan {
pub vf: u32,
pub vlan: u32, pub qos: u32,
}
#[repr(u16)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, NlaType)]
#[tbname = "VfVlanInfoTbl"]
pub enum VfVlanInfo {
Unspec = 0,
Info, _MAX,
}
pub const MAX_VLAN_LIST_LEN: usize = 1;
#[repr(C)]
#[derive(Debug, Clone, Copy)]
pub struct IflaVfVlanInfo {
pub vf: u32,
pub vlan: u32, pub qos: u32,
pub vlan_proto: u16, }
#[repr(C)]
#[derive(Debug, Clone, Copy)]
pub struct IflaVfTxRate {
pub vf: u32,
pub rate: u32, }
#[repr(C)]
#[derive(Debug, Clone, Copy)]
pub struct IflaVfRate {
pub vf: u32,
pub min_tx_rate: u32, pub max_tx_rate: u32, }
#[repr(C)]
#[derive(Debug, Clone, Copy)]
pub struct IflaVfSpoofchk {
pub vf: u32,
pub setting: u32,
}
#[repr(C)]
#[derive(Debug, Clone, Copy)]
pub struct IflaVfGuid {
pub vf: u32,
pub guid: u64,
}
#[repr(u32)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum VfLinkState {
Auto = 0, Enable, Disable, _MAX,
}
pub const IFLA_VF_LINK_STATE_AUTO: u32 = VfLinkState::Auto as u32;
pub const IFLA_VF_LINK_STATE_ENABLE: u32 = VfLinkState::Enable as u32;
pub const IFLA_VF_LINK_STATE_DISABLE: u32 = VfLinkState::Disable as u32;
pub const __IFLA_VF_LINK_STATE_MAX: u32 = VfLinkState::_MAX as u32;
#[repr(C)]
#[derive(Debug, Clone, Copy)]
pub struct IflaVfLinkState {
pub vf: u32,
pub link_state: u32,
}
#[repr(C)]
#[derive(Debug, Clone, Copy)]
pub struct IflaVfRssQueryEn {
pub vf: u32,
pub setting: u32,
}
#[repr(u16)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, NlaType)]
#[tbname = "VfStatsTbl"]
pub enum VfStats {
RxPackets = 0,
TxPackets,
RxBytes,
TxBytes,
Broadcast,
Multicast,
Pad,
RxDropped,
TxDropped,
_MAX,
}
#[repr(C)]
#[derive(Debug, Clone, Copy)]
pub struct ifla_vf_trust {
pub vf: u32,
pub setting: u32,
}
#[repr(u16)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, NlaType)]
#[tbname = "VfPortTbl"]
pub enum VfPort {
Unspec,
Port, _MAX,
}
#[repr(u16)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, NlaType)]
#[tbname = "PortTbl"]
pub enum Port {
Unspec = 0,
Vf, Profile, VsiType, InstanceUuid, HostUuid, Request, Response, _MAX = 8,
}
pub const PORT_PROFILE_MAX: usize = 40;
pub const PORT_UUID_MAX: usize = 16;
pub const PORT_SELF_VF: c_int = -1;
#[repr(u8)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum PortRequest {
Preassociate = 0,
PreassociateRr,
Associate,
Disassociate,
}
pub const PORT_REQUEST_PREASSOCIATE: u8 = PortRequest::Preassociate as u8;
pub const PORT_REQUEST_PREASSOCIATE_RR: u8 = PortRequest::PreassociateRr as u8;
pub const PORT_REQUEST_ASSOCIATE: u8 = PortRequest::Associate as u8;
pub const PORT_REQUEST_DISASSOCIATE: u8 = PortRequest::Disassociate as u8;
#[repr(u16)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum PortResponse {
VdpSuccess = 0,
VdpInvalidFormat,
VdpInsufficientResources,
VdpUnusedVtid,
VdpVtidViolation,
VdpVtidVersionVioaltion,
VdpOutOfSync,
ProfileSuccess = 0x100,
ProfileInprogress,
ProfileInvalid,
ProfileBadstate,
ProfileInsufficientResources,
ProfileError,
}
pub const PORT_VDP_RESPONSE_SUCCESS: u16 = PortResponse::VdpSuccess as u16;
pub const PORT_VDP_RESPONSE_INVALID_FORMAT: u16 = PortResponse::VdpInvalidFormat as u16;
pub const PORT_VDP_RESPONSE_INSUFFICIENT_RESOURCES: u16 =
PortResponse::VdpInsufficientResources as u16;
pub const PORT_VDP_RESPONSE_UNUSED_VTID: u16 = PortResponse::VdpUnusedVtid as u16;
pub const PORT_VDP_RESPONSE_VTID_VIOLATION: u16 = PortResponse::VdpVtidViolation as u16;
pub const PORT_VDP_RESPONSE_VTID_VERSION_VIOALTION: u16 =
PortResponse::VdpVtidVersionVioaltion as u16;
pub const PORT_VDP_RESPONSE_OUT_OF_SYNC: u16 = PortResponse::VdpOutOfSync as u16;
pub const PORT_PROFILE_RESPONSE_SUCCESS: u16 = PortResponse::ProfileSuccess as u16;
pub const PORT_PROFILE_RESPONSE_INPROGRESS: u16 = PortResponse::ProfileInprogress as u16;
pub const PORT_PROFILE_RESPONSE_INVALID: u16 = PortResponse::ProfileInvalid as u16;
pub const PORT_PROFILE_RESPONSE_BADSTATE: u16 = PortResponse::ProfileBadstate as u16;
pub const PORT_PROFILE_RESPONSE_INSUFFICIENT_RESOURCES: u16 =
PortResponse::ProfileInsufficientResources as u16;
pub const PORT_PROFILE_RESPONSE_ERROR: u16 = PortResponse::ProfileError as u16;
#[repr(C)]
#[derive(Debug, Clone, Copy)]
pub struct ifla_port_vsi {
pub vsi_mgr_id: u8,
pub vsi_type_id: [u8; 3usize],
pub vsi_type_version: u8,
pub pad: [u8; 3usize],
}
#[repr(u16)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, NlaType)]
#[tbname = "IopbTbl"]
pub enum Ipoib {
Unspec,
Pkey,
Mode,
Umcast,
_MAX,
}
#[repr(u16)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum IpoibMode {
Datagram = 0, Connected = 1, }
pub const IPOIB_MODE_DATAGRAM: u16 = IpoibMode::Datagram as u16;
pub const IPOIB_MODE_CONNECTED: u16 = IpoibMode::Connected as u16;
#[repr(u8)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum HsrProtocol {
Hsr,
Prp,
MAX,
}
pub const HSR_PROTOCOL_HSR: u8 = HsrProtocol::Hsr as u8;
pub const HSR_PROTOCOL_PRP: u8 = HsrProtocol::Prp as u8;
pub const HSR_PROTOCOL_MAX: u8 = HsrProtocol::MAX as u8;
#[repr(u16)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, NlaType)]
#[tbname = "HsrTbl"]
pub enum Hsr {
Unspec,
Slave1,
Slave2,
MulticastSpec, SupervisionAddr, SeqNr,
Version, _MAX,
}
#[repr(C)]
#[derive(Debug, Clone, Copy)]
pub struct IfStatsMsg {
pub family: u8,
_pad1: u8,
_pad2: u16,
pub ifindex: u32,
pub filter_mask: u32,
}
#[repr(u16)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, NlaType)]
#[tbname = "StatsTbl"]
pub enum Stats {
Unspec, Link64,
LinkXstats,
LinkXstatsSlave,
LinkOffloadXstats,
AfSpec,
_MAX,
}
pub const fn ifla_stats_filter_bit(attr: u16) -> u16 {
1 << (attr - 1)
}
#[repr(u16)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, NlaType)]
#[tbname = "LinkXstatsTyepTbl"]
pub enum LinkXstatsType {
Unspec,
Bridge,
Bond,
_MAX,
}
#[repr(u16)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, NlaType)]
#[tbname = "OffloadXstatsTbl"]
pub enum OffloadXstats {
Unspec,
CpuHit, _MAX,
}
pub const XDP_FLAGS_UPDATE_IF_NOEXIST: u32 = 1 << 0;
pub const XDP_FLAGS_SKB_MODE: u32 = 1 << 1;
pub const XDP_FLAGS_DRV_MODE: u32 = 1 << 2;
pub const XDP_FLAGS_HW_MODE: u32 = 1 << 3;
pub const XDP_FLAGS_MODES: u32 = XDP_FLAGS_SKB_MODE | XDP_FLAGS_DRV_MODE | XDP_FLAGS_HW_MODE;
pub const XDP_FLAGS_MASK: u32 = XDP_FLAGS_UPDATE_IF_NOEXIST | XDP_FLAGS_MODES;
#[repr(u8)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum XdpAttached {
None = 0,
Drv,
Skb,
Hw,
Multi,
}
pub const XDP_ATTACHED_NONE: u8 = XdpAttached::None as u8;
pub const XDP_ATTACHED_DRV: u8 = XdpAttached::Drv as u8;
pub const XDP_ATTACHED_SKB: u8 = XdpAttached::Skb as u8;
pub const XDP_ATTACHED_HW: u8 = XdpAttached::Hw as u8;
pub const XDP_ATTACHED_MULTI: u8 = XdpAttached::Multi as u8;
#[repr(u16)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, NlaType)]
#[tbname = "XdpTbl"]
pub enum Xdp {
Unspec,
Fd,
Attached,
Flags,
ProgId,
DrvProgId,
SkbProgId,
HwProgId,
ExpectedFd,
_MAX,
}
#[repr(u32)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum Event {
None,
Reboot, Features, BondingFailover, NotifyPeers, IgmpResend, BondingOptions, }
pub const IFLA_EVENT_NONE: u32 = Event::None as u32;
pub const IFLA_EVENT_REBOOT: u32 = Event::Reboot as u32;
pub const IFLA_EVENT_FEATURES: u32 = Event::Features as u32;
pub const IFLA_EVENT_BONDING_FAILOVER: u32 = Event::BondingFailover as u32;
pub const IFLA_EVENT_NOTIFY_PEERS: u32 = Event::NotifyPeers as u32;
pub const IFLA_EVENT_IGMP_RESEND: u32 = Event::IgmpResend as u32;
pub const IFLA_EVENT_BONDING_OPTIONS: u32 = Event::BondingOptions as u32;
#[repr(u16)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, NlaType)]
#[tbname = "TunTbl"]
pub enum Tun {
Unspec,
Owner,
Group,
Type,
Pi,
VnetHdr,
Persist,
MultiQueue,
NumQueues,
NumDisabledQueues,
_MAX,
}
pub const RMNET_FLAGS_INGRESS_DEAGGREGATION: u32 = 1 << 0;
pub const RMNET_FLAGS_INGRESS_MAP_COMMANDS: u32 = 1 << 1;
pub const RMNET_FLAGS_INGRESS_MAP_CKSUMV4: u32 = 1 << 2;
pub const RMNET_FLAGS_EGRESS_MAP_CKSUMV4: u32 = 1 << 3;
#[repr(u16)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, NlaType)]
#[tbname = "RmnetTbl"]
pub enum Rmnet {
Unspec,
MuxId,
Flags,
_MAX,
}
#[repr(C)]
#[derive(Debug, Clone, Copy)]
pub struct IflaRmnetFlags {
flags: u32,
mask: u32,
}