diff options
Diffstat (limited to 'net_util')
-rw-r--r-- | net_util/Cargo.toml | 1 | ||||
-rw-r--r-- | net_util/src/lib.rs | 8 |
2 files changed, 7 insertions, 2 deletions
diff --git a/net_util/Cargo.toml b/net_util/Cargo.toml index bfa3bc8..c7f61b1 100644 --- a/net_util/Cargo.toml +++ b/net_util/Cargo.toml @@ -6,5 +6,6 @@ edition = "2018" [dependencies] libc = "*" +data_model = { path = "../data_model" } net_sys = { path = "../net_sys" } sys_util = { path = "../sys_util" } diff --git a/net_util/src/lib.rs b/net_util/src/lib.rs index 9508dcc..0243552 100644 --- a/net_util/src/lib.rs +++ b/net_util/src/lib.rs @@ -15,7 +15,8 @@ use std::str::FromStr; use libc::EPERM; use sys_util::Error as SysError; -use sys_util::{ioctl_with_mut_ref, ioctl_with_ref, ioctl_with_val}; +use sys_util::FileReadWriteVolatile; +use sys_util::{ioctl_with_mut_ref, ioctl_with_ref, ioctl_with_val, volatile_impl}; #[derive(Debug)] pub enum Error { @@ -189,7 +190,7 @@ impl Tap { } } -pub trait TapT: Read + Write + AsRawFd + Send + Sized { +pub trait TapT: FileReadWriteVolatile + Read + Write + AsRawFd + Send + Sized { /// Create a new tap interface. Set the `vnet_hdr` flag to true to allow offloading on this tap, /// which will add an extra 12 byte virtio net header to incoming frames. Offloading cannot /// be used if `vnet_hdr` is false. @@ -484,6 +485,8 @@ impl AsRawFd for Tap { } } +volatile_impl!(Tap); + pub mod fakes { use super::*; use std::fs::remove_file; @@ -580,6 +583,7 @@ pub mod fakes { self.tap_file.as_raw_fd() } } + volatile_impl!(FakeTap); } #[cfg(test)] |