Skip to main content

ip_nlroute/addr/
flags.rs

1/// Flags associated with an interface address.
2#[derive(Default, Clone, Copy, Debug)]
3pub struct AddressFlags {
4    pub secondary: bool,
5    pub nodad: bool,
6    pub optimistic: bool,
7    pub dadfailed: bool,
8    pub homeaddress: bool,
9    pub deprecated: bool,
10    pub tentative: bool,
11    pub permanent: bool,
12}
13
14#[cfg(all(target_os = "linux", feature = "netlink"))]
15impl From<neli::consts::rtnl::IfaF> for AddressFlags {
16    fn from(value: neli::consts::rtnl::IfaF) -> Self {
17        use neli::consts::rtnl::IfaF;
18        Self {
19            secondary: value.contains(IfaF::SECONDARY),
20            nodad: value.contains(IfaF::NODAD),
21            optimistic: value.contains(IfaF::OPTIMISTIC),
22            dadfailed: value.contains(IfaF::DADFAILED),
23            homeaddress: value.contains(IfaF::HOMEADDRESS),
24            deprecated: value.contains(IfaF::DEPRECATED),
25            tentative: value.contains(IfaF::TENTATIVE),
26            permanent: value.contains(IfaF::PERMANENT),
27        }
28    }
29}