diff options
author | Dario Nieuwenhuis <dirbaio@dirbaio.net> | 2021-11-24 17:48:48 +0100 |
---|---|---|
committer | Dario Nieuwenhuis <dirbaio@dirbaio.net> | 2021-11-24 17:48:48 +0100 |
commit | e4de15e4de455f378286f39b5c9c079c26a68014 (patch) | |
tree | 941019933b994e86978951a7f504163ab9b7ab7c /examples/std/src | |
parent | 8fea6c94f6d0978042554eb6b154706d8f7a9fd5 (diff) | |
download | embassy-e4de15e4de455f378286f39b5c9c079c26a68014.zip |
net: don't depend directly on smoltcp outside embassy-net
Diffstat (limited to 'examples/std/src')
-rw-r--r-- | examples/std/src/tuntap.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/examples/std/src/tuntap.rs b/examples/std/src/tuntap.rs index a3209940..4d30118f 100644 --- a/examples/std/src/tuntap.rs +++ b/examples/std/src/tuntap.rs @@ -1,7 +1,5 @@ use async_io::Async; -use libc; use log::*; -use smoltcp::wire::EthernetFrame; use std::io; use std::io::{Read, Write}; use std::os::unix::io::{AsRawFd, RawFd}; @@ -14,6 +12,8 @@ pub const _IFF_TUN: libc::c_int = 0x0001; pub const IFF_TAP: libc::c_int = 0x0002; pub const IFF_NO_PI: libc::c_int = 0x1000; +const ETHERNET_HEADER_LEN: usize = 14; + #[repr(C)] #[derive(Debug)] struct ifreq { @@ -85,7 +85,7 @@ impl TunTap { // SIOCGIFMTU returns the IP MTU (typically 1500 bytes.) // smoltcp counts the entire Ethernet packet in the MTU, so add the Ethernet header size to it. - let mtu = ip_mtu + EthernetFrame::<&[u8]>::header_len(); + let mtu = ip_mtu + ETHERNET_HEADER_LEN; Ok(TunTap { fd, mtu }) } |