aboutsummaryrefslogtreecommitdiff
path: root/examples/std
diff options
context:
space:
mode:
Diffstat (limited to 'examples/std')
-rw-r--r--examples/std/Cargo.toml5
-rw-r--r--examples/std/src/tuntap.rs6
2 files changed, 3 insertions, 8 deletions
diff --git a/examples/std/Cargo.toml b/examples/std/Cargo.toml
index 2e2f0bd1c..9a9961a36 100644
--- a/examples/std/Cargo.toml
+++ b/examples/std/Cargo.toml
@@ -17,8 +17,3 @@ libc = "0.2.101"
17clap = { version = "3.0.0-beta.5", features = ["derive"] } 17clap = { version = "3.0.0-beta.5", features = ["derive"] }
18rand_core = { version = "0.6.3", features = ["std"] } 18rand_core = { version = "0.6.3", features = ["std"] }
19heapless = { version = "0.7.5", default-features = false } 19heapless = { version = "0.7.5", default-features = false }
20
21[dependencies.smoltcp]
22git = "https://github.com/bobmcwhirter/smoltcp"
23rev = "faf81d21daae16b650b16e59a8422a8283e8a302"
24default-features = false
diff --git a/examples/std/src/tuntap.rs b/examples/std/src/tuntap.rs
index a32099404..4d30118fb 100644
--- a/examples/std/src/tuntap.rs
+++ b/examples/std/src/tuntap.rs
@@ -1,7 +1,5 @@
1use async_io::Async; 1use async_io::Async;
2use libc;
3use log::*; 2use log::*;
4use smoltcp::wire::EthernetFrame;
5use std::io; 3use std::io;
6use std::io::{Read, Write}; 4use std::io::{Read, Write};
7use std::os::unix::io::{AsRawFd, RawFd}; 5use std::os::unix::io::{AsRawFd, RawFd};
@@ -14,6 +12,8 @@ pub const _IFF_TUN: libc::c_int = 0x0001;
14pub const IFF_TAP: libc::c_int = 0x0002; 12pub const IFF_TAP: libc::c_int = 0x0002;
15pub const IFF_NO_PI: libc::c_int = 0x1000; 13pub const IFF_NO_PI: libc::c_int = 0x1000;
16 14
15const ETHERNET_HEADER_LEN: usize = 14;
16
17#[repr(C)] 17#[repr(C)]
18#[derive(Debug)] 18#[derive(Debug)]
19struct ifreq { 19struct ifreq {
@@ -85,7 +85,7 @@ impl TunTap {
85 85
86 // SIOCGIFMTU returns the IP MTU (typically 1500 bytes.) 86 // SIOCGIFMTU returns the IP MTU (typically 1500 bytes.)
87 // smoltcp counts the entire Ethernet packet in the MTU, so add the Ethernet header size to it. 87 // smoltcp counts the entire Ethernet packet in the MTU, so add the Ethernet header size to it.
88 let mtu = ip_mtu + EthernetFrame::<&[u8]>::header_len(); 88 let mtu = ip_mtu + ETHERNET_HEADER_LEN;
89 89
90 Ok(TunTap { fd, mtu }) 90 Ok(TunTap { fd, mtu })
91 } 91 }