1use errno::Errno;
2use mnl::{Attr, AttrTbl, MsgVec, Result};
3use std::net::{Ipv4Addr, Ipv6Addr};
4
5#[repr(C)]
6#[derive(Debug, Clone, Copy)]
7pub struct Ifaddrmsg {
8 pub ifa_family: u8,
9 pub ifa_prefixlen: u8, pub ifa_flags: u8, pub ifa_scope: u8, pub ifa_index: u32, }
14
15#[repr(u16)]
24#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, NlaType)]
25#[tbname = "IfAddrTbl"]
26pub enum IfAddr {
27 Unspec = 0,
29
30 #[nla_type(Ipv4Addr, address4)]
31 #[nla_type(Ipv6Addr, address6)]
32 Address = 1,
33
34 #[nla_type(Ipv4Addr, local4)]
35 #[nla_type(Ipv6Addr, local6)]
36 Local = 2,
38
39 #[nla_type(str, label)]
40 Label = 3,
41
42 #[nla_type(Ipv4Addr, broadcast)]
43 Broadcast = 4,
44
45 #[nla_type(Ipv6Addr, anycast)]
46 Anycast = 5,
47
48 #[nla_type(IfaCacheinfo, cacheinfo)]
49 CacheInfo = 6,
50
51 #[nla_type(Ipv6Addr, multicast)]
52 Multicast = 7,
53
54 #[nla_type(u32, flags)]
55 Flags = 8,
56
57 #[nla_type(u32, rt_priority)]
58 RtPriority = 9,
59
60 #[nla_type(i32, target_netnsid)]
61 TargetNetnsid = 10,
62
63 _MAX = 11,
64}
65
66pub const IFA_F_SECONDARY: u32 = 0x01;
68pub const IFA_F_TEMPORARY: u32 = IFA_F_SECONDARY;
69pub const IFA_F_NODAD: u32 = 0x02;
70pub const IFA_F_OPTIMISTIC: u32 = 0x04;
71pub const IFA_F_DADFAILED: u32 = 0x08;
72pub const IFA_F_HOMEADDRESS: u32 = 0x10;
73pub const IFA_F_DEPRECATED: u32 = 0x20;
74pub const IFA_F_TENTATIVE: u32 = 0x40;
75pub const IFA_F_PERMANENT: u32 = 0x80;
76pub const IFA_F_MANAGETEMPADDR: u32 = 0x100;
77pub const IFA_F_NOPREFIXROUTE: u32 = 0x200;
78pub const IFA_F_MCAUTOJOIN: u32 = 0x400;
79pub const IFA_F_STABLE_PRIVACY: u32 = 0x800;
80
81#[repr(C)]
82#[derive(Debug, Clone, Copy)]
83pub struct IfaCacheinfo {
84 pub ifa_prefered: u32,
85 pub ifa_valid: u32,
86 pub cstamp: u32, pub tstamp: u32, }