pub async fn update_lif_properties(
        &mut self,
        lif_id: UUID,
        lp: &lifmgr::LIFProperties,
    ) -> error::Result<()> {
        let lif = match self.lif_manager.lif_mut(&lif_id) {
            None => {
                info!("update_lif_properties: lif not found {:?} ", lif_id);
                return Err(error::NetworkManager::Lif(error::Lif::NotFound));
            }
            Some(x) => x,
        };

        let old = lif.properties();
        self.hal.apply_properties(lif.pid(), &old, &lp).await?;
        if let Some(addr) = lp.address_v4 {
            match lif.ltype() {
                LIFType::WAN => self.service_manager.set_global_ip_nat(addr.clone(), lif.pid()),
                LIFType::LAN => self.service_manager.set_local_subnet_nat(addr.clone()),
                _ => (),
            }
        }
        match self.packet_filter.update_nat_config(self.service_manager.get_nat_config()).await {
            // If the result of this call was `UpdateNatPendingConfig` or `NatNotEnabled`, then NAT
            // is not yet ready to be enabled until we have more configuration data.
            Ok(())
            | Err(error::NetworkManager::Service(error::Service::UpdateNatPendingConfig))
            | Err(error::NetworkManager::Service(error::Service::NatNotEnabled)) => {}
            Err(e) => {
                // Otherwise, this was an actual error and we should not increment the
                // version number.
                error!("Failed to update NAT rules: {:?}; Version not incremented.", e);
                return Err(e);
            }
        }
        lif.set_properties(self.version, lp.clone())?;
        self.version += 1;
        Ok(())
    }
/// Configures an interface with the given properties, and updates the LIF information.
Configures an interface with the given properties, and updates the LIF information.
Configures an interface with the given properties and updates the LIF information .
pub async fn update_lif_properties(
        &mut self,
        lif_id: UUID,
        lp: &lifmgr::LIFProperties,
    ) -> error::Result<()> {
        let lif = match self.lif_manager.lif_mut(&lif_id) {
            None => {
                info!("update_lif_properties: lif not found {:?} ", lif_id);
                return Err(error::NetworkManager::Lif(error::Lif::NotFound));
            }
            Some(x) => x,
        };
        let old = lif.properties();
        self.hal.apply_properties(lif.pid(), &old, &lp).await?;
        if let Some(addr) = lp.address_v4 {
            match lif.ltype() {
                LIFType::WAN => self.service_manager.set_global_ip_nat(addr.clone(), lif.pid()),
                LIFType::LAN => self.service_manager.set_local_subnet_nat(addr.clone()),
                _ => (),
            }
        }
        match self.packet_filter.update_nat_config(self.service_manager.get_nat_config()).await {
            // If the result of this call was `UpdateNatPendingConfig` or `NatNotEnabled`, then NAT
            // is not yet ready to be enabled until we have more configuration data.
            Ok(())
            | Err(error::NetworkManager::Service(error::Service::UpdateNatPendingConfig))
            | Err(error::NetworkManager::Service(error::Service::NatNotEnabled)) => {}
            Err(e) => {
                // Otherwise, this was an actual error and we should not increment the
                // version number.
                error!("Failed to update NAT rules: {:?}; Version not incremented.", e);
                return Err(e);
            }
        }
        lif.set_properties(self.version, lp.clone())?;
        self.version += 1;
        Ok(())
    }
pub async fn update_lif_properties ( & mut self , lif_id : UUID , lp : & lifmgr :: LIFProperties , ) -> error :: Result < ( ) > { let lif = match self . lif_manager . lif_mut ( & lif_id ) { None => { info ! ( " " lif_id ) ; return Err ( error :: NetworkManager :: Lif ( error :: Lif :: NotFound ) ) ; } Some ( x ) => x , } ; let old = lif . properties ( ) ; self . hal . apply_properties ( lif . pid ( ) , & old , & lp ) . await ? ; if let Some ( addr ) = lp . address_v4 { match lif . ltype ( ) { LIFType :: WAN => self . service_manager . set_global_ip_nat ( addr . clone ( ) , lif . pid ( ) ) , LIFType :: LAN => self . service_manager . set_local_subnet_nat ( addr . clone ( ) ) , _ => ( ) , } } match self . packet_filter . update_nat_config ( self . service_manager . get_nat_config ( ) ) . await { // If the result of this call was `UpdateNatPendingConfig` or `NatNotEnabled`, then NAT // is not yet ready to be enabled until we have more configuration data. Ok ( ( ) ) | Err ( error :: NetworkManager :: Service ( error :: Service :: UpdateNatPendingConfig ) ) | Err ( error :: NetworkManager :: Service ( error :: Service :: NatNotEnabled ) ) => { } Err ( e ) => { // Otherwise, this was an actual error and we should not increment the // version number. error ! ( " " e ) ; return Err ( e ) ; } } lif . set_properties ( self . version , lp . clone ( ) ) ? ; self . version += 1 ; Ok ( ( ) ) }
Configures an interface with the given properties, and updates the LIF information.
Configures an interface with the given properties and updates the LIF information .
&mut self
lif_id
UUID
lp
&lifmgr::LIFProperties
&mut self
lif_id
UUID
lp
&lifmgr::LIFProperties