diff options
author | Mathias Hall-Andersen <mathias@hall-andersen.dk> | 2019-11-25 13:33:00 +0100 |
---|---|---|
committer | Mathias Hall-Andersen <mathias@hall-andersen.dk> | 2019-11-25 13:33:00 +0100 |
commit | f228b6f98b141940a3302d4cd1978f56f5edb13e (patch) | |
tree | f0486d26f494ce7f5d507205aa5cd475d05385c1 /src/platform/linux/tun.rs | |
parent | Make IO traits suitable for Tun events (up/down) (diff) | |
download | wireguard-rs-f228b6f98b141940a3302d4cd1978f56f5edb13e.tar.xz wireguard-rs-f228b6f98b141940a3302d4cd1978f56f5edb13e.zip |
Enable up/down from configuration interface
Diffstat (limited to 'src/platform/linux/tun.rs')
-rw-r--r-- | src/platform/linux/tun.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/platform/linux/tun.rs b/src/platform/linux/tun.rs index 604fad9..82eb469 100644 --- a/src/platform/linux/tun.rs +++ b/src/platform/linux/tun.rs @@ -87,10 +87,12 @@ impl Reader for LinuxTunReader { type Error = LinuxTunError; fn read(&self, buf: &mut [u8], offset: usize) -> Result<usize, Self::Error> { + /* debug_assert!( offset < buf.len(), "There is no space for the body of the read" ); + */ let n: isize = unsafe { read(self.fd, buf[offset..].as_mut_ptr() as _, buf.len() - offset) }; if n < 0 { @@ -132,10 +134,11 @@ impl Tun for LinuxTun { type Error = LinuxTunError; type Reader = LinuxTunReader; type Writer = LinuxTunWriter; - type Status = LinuxTunStatus; } impl PlatformTun for LinuxTun { + type Status = LinuxTunStatus; + fn create(name: &str) -> Result<(Vec<Self::Reader>, Self::Writer, Self::Status), Self::Error> { // construct request struct let mut req = Ifreq { |