diff --git a/common/sys_util/src/netlink.rs b/common/sys_util/src/netlink.rs index 8db241e02f..b7fb40dfcd 100644 --- a/common/sys_util/src/netlink.rs +++ b/common/sys_util/src/netlink.rs @@ -9,7 +9,9 @@ use libc::EINVAL; use sys_util_core::LayoutAllocation; -use super::{errno_result, Error, FromRawDescriptor, Result, SafeDescriptor}; +use super::{ + errno_result, AsRawDescriptor, Error, FromRawDescriptor, RawDescriptor, Result, SafeDescriptor, +}; // Custom nlmsghdr struct that can be declared DataInit. #[repr(C)] @@ -101,6 +103,12 @@ pub struct NetlinkGenericSocket { sock: SafeDescriptor, } +impl AsRawDescriptor for NetlinkGenericSocket { + fn as_raw_descriptor(&self) -> RawDescriptor { + self.sock.as_raw_descriptor() + } +} + impl NetlinkGenericSocket { /// Create and bind a new `NETLINK_GENERIC` socket. pub fn new(nl_groups: u32) -> Result {