/// Adds a new loopback device to the device layer.
Adds a new loopback device to the device layer.
Adds a new loopback device to the device layer .
pub(crate) fn add_loopback_device(&mut self, mtu: u32) -> Result<DeviceId, ExistsError> {
        let Self { ethernet: _, loopback, default_ndp_config: _, default_ipv6_config } = self;
        if let Some(DeviceState { .. }) = loopback {
            return Err(ExistsError);
        }
        let mut loopback_state = IpLinkDeviceState::new(LoopbackDeviceState::new(mtu));
        loopback_state.ip.ipv6.config = default_ipv6_config.clone();
        let loopback_state = DeviceState::new(loopback_state);
        *loopback = Some(loopback_state);
        debug!("added loopback device");
        Ok(DeviceIdInner::Loopback.into())
    }
pub ( crate ) fn add_loopback_device ( & mut self , mtu : u32 ) -> Result < DeviceId , ExistsError > { let Self { ethernet : _ , loopback , default_ndp_config : _ , default_ipv6_config } = self ; if let Some ( DeviceState { .. } ) = loopback { return Err ( ExistsError ) ; } let mut loopback_state = IpLinkDeviceState :: new ( LoopbackDeviceState :: new ( mtu ) ) ; loopback_state . ip . ipv6 . config = default_ipv6_config . clone ( ) ; let loopback_state = DeviceState :: new ( loopback_state ) ; * loopback = Some ( loopback_state ) ; debug ! ( " " ) ; Ok ( DeviceIdInner :: Loopback . into ( ) ) }
Adds a new loopback device to the device layer.
Adds a new loopback device to the device layer .
&mut self
mtu
u32