/// Set the link up/down state.
Set the link up/down state.
Set the link up / down state .
fn update_flags(&self, sock: &NlRoutingSocket, flags: RtnlLinkFlags, set: bool) -> Result<()> {
        let op = match set {
            true => "set",
            false => "clear",
        };
        let cmsg = format!(
            "Failed to {} link state flags {:#x} for link {}",
            op, flags.bits, self
        );
        let change = RtnlLink::new().context(cmsg.clone())?;
        unsafe {
            if set {
                rtnl_link_set_flags(change.0, flags.bits);
            } else {
                rtnl_link_unset_flags(change.0, flags.bits);
            }
        };
        let nlerr = unsafe { rtnl_link_change(*sock.nl_sock(), self.0, change.0, 0) };
        if nlerr != 0 {
            return Err(Error::msg(nlerrmsg(nlerr, "rtnl_link_change() failed"))).context(cmsg);
        }
        Ok(())
    }
fn update_flags ( & self , sock : & NlRoutingSocket , flags : RtnlLinkFlags , set : bool ) -> Result < ( ) > { let op = match set { true => " " , false => " " , } ; let cmsg = format ! ( " " op flags bits self ) ; let change = RtnlLink :: new ( ) . context ( cmsg . clone ( ) ) ? ; unsafe { if set { rtnl_link_set_flags ( change . 0 , flags . bits ) ; } else { rtnl_link_unset_flags ( change . 0 , flags . bits ) ; } } ; let nlerr = unsafe { rtnl_link_change ( * sock . nl_sock ( ) , self . 0 , change . 0 , 0 ) } ; if nlerr != 0 { return Err ( Error :: msg ( nlerrmsg ( nlerr , " " ) ) ) . context ( cmsg ) ; } Ok ( ( ) ) }
Set the link up/down state.
Set the link up / down state .
&self
sock
&NlRoutingSocket
flags
RtnlLinkFlags
set
bool