Struct nmstate::BaseInterface

source ·
#[non_exhaustive]
pub struct BaseInterface {
Show 26 fields pub name: String, pub profile_name: Option<String>, pub description: Option<String>, pub iface_type: InterfaceType, pub driver: Option<String>, pub state: InterfaceState, pub identifier: Option<InterfaceIdentifier>, pub mac_address: Option<String>, pub permanent_mac_address: Option<String>, pub mtu: Option<u64>, pub min_mtu: Option<u64>, pub max_mtu: Option<u64>, pub wait_ip: Option<WaitIp>, pub ipv4: Option<InterfaceIpv4>, pub ipv6: Option<InterfaceIpv6>, pub mptcp: Option<MptcpConfig>, pub controller: Option<String>, pub accept_all_mac_addresses: Option<bool>, pub copy_mac_from: Option<String>, pub ovsdb: Option<OvsDbIfaceConfig>, pub ieee8021x: Option<Ieee8021XConfig>, pub lldp: Option<LldpConfig>, pub ethtool: Option<EthtoolConfig>, pub dispatch: Option<DispatchConfig>, pub controller_type: Option<InterfaceType>, pub _other: Map<String, Value>, /* private fields */
}
Expand description

Information shared among all interface types

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§name: String

Interface name, when applying with InterfaceIdentifier::MacAddress, if profile_name not defined, this will be used as profile name.

§profile_name: Option<String>§description: Option<String>

Interface description stored in network backend. Not available for kernel only mode.

§iface_type: InterfaceType

Interface type. Serialize and deserialize to/from type

§driver: Option<String>

The driver of the specified network device.

§state: InterfaceState

Interface state. Default to InterfaceState::Up when applying.

§identifier: Option<InterfaceIdentifier>

Define network backend matching method on choosing network interface. Default to InterfaceIdentifier::Name.

§mac_address: Option<String>

When applying with [InterfaceIdentifier::MacAddress], nmstate will store original desired interface name as profile_name here and store the real interface name as name property. For InterfaceIdentifier::Name (default), this property will change the interface MAC address to desired one when applying. For InterfaceIdentifier::MacAddress, this property will be used for searching interface on desired MAC address when applying. MAC address in the format: upper case hex string separated by : on every two characters. Case insensitive when applying. Serialize and deserialize to/from mac-address.

§permanent_mac_address: Option<String>

MAC address never change after reboots(normally stored in firmware of network interface). Using the same format as mac_address property. Ignored during apply.

§mtu: Option<u64>

Maximum transmission unit.

§min_mtu: Option<u64>

Minimum MTU allowed. Ignored during apply. Serialize and deserialize to/from min-mtu.

§max_mtu: Option<u64>

Maximum MTU allowed. Ignored during apply. Serialize and deserialize to/from max-mtu.

§wait_ip: Option<WaitIp>

Whether system should wait certain IP stack before considering network interface activated. Serialize and deserialize to/from wait-ip.

§ipv4: Option<InterfaceIpv4>

IPv4 information. Hided if interface is not allowed to hold IP information(e.g. port of bond is not allowed to hold IP information).

§ipv6: Option<InterfaceIpv6>

IPv4 information. Hided if interface is not allowed to hold IP information(e.g. port of bond is not allowed to hold IP information).

§mptcp: Option<MptcpConfig>

Interface wide MPTCP flags. Nmstate will apply these flags to all valid IP addresses(both static and dynamic).

§controller: Option<String>

Controller of the specified interface. Only valid for applying, None means no change, empty string means detach from current controller, please be advise, an error will trigger if this property conflict with ports list of bridge/bond/etc. Been always set to None by crate::NetworkState::retrieve().

§accept_all_mac_addresses: Option<bool>

Whether kernel should skip check on package targeting MAC address and accept all packages, also known as promiscuous mode. Serialize and deserialize to/from accpet-all-mac-addresses.

§copy_mac_from: Option<String>

Copy the MAC address from specified interface. Ignored during serializing. Deserialize from copy-mac-from.

§ovsdb: Option<OvsDbIfaceConfig>

Interface specific OpenvSwitch database configurations.

§ieee8021x: Option<Ieee8021XConfig>

IEEE 802.1X authentication configurations. Serialize and deserialize to/from 802.1x.

§lldp: Option<LldpConfig>

Link Layer Discovery Protocol configurations.

§ethtool: Option<EthtoolConfig>

Ethtool configurations

§dispatch: Option<DispatchConfig>

Dispatch script configurations

§controller_type: Option<InterfaceType>§_other: Map<String, Value>

Implementations§

source§

impl BaseInterface

source

pub fn can_have_ip(&self) -> bool

Whether this interface can hold IP information or not.

source

pub fn new() -> Self

Create empty BaseInterface with state set to InterfaceState::Up

Trait Implementations§

source§

impl Clone for BaseInterface

source§

fn clone(&self) -> BaseInterface

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for BaseInterface

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for BaseInterface

source§

fn default() -> BaseInterface

Returns the “default value” for a type. Read more
source§

impl<'de> Deserialize<'de> for BaseInterface

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl PartialEq for BaseInterface

source§

fn eq(&self, other: &BaseInterface) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for BaseInterface

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl Eq for BaseInterface

source§

impl StructuralPartialEq for BaseInterface

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> NoneValue for T
where T: Default,

§

type NoneType = T

source§

fn null_value() -> T

The none-equivalent value.
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,