503: net: don't depend directly on smoltcp outside embassy-net r=Dirbaio a=Dirbaio



Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
This commit is contained in:
bors[bot] 2021-11-24 19:22:04 +00:00 committed by GitHub
commit 32d52c89a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 3 additions and 32 deletions

View File

@ -17,8 +17,3 @@ libc = "0.2.101"
clap = { version = "3.0.0-beta.5", features = ["derive"] } clap = { version = "3.0.0-beta.5", features = ["derive"] }
rand_core = { version = "0.6.3", features = ["std"] } rand_core = { version = "0.6.3", features = ["std"] }
heapless = { version = "0.7.5", default-features = false } heapless = { version = "0.7.5", default-features = false }
[dependencies.smoltcp]
git = "https://github.com/bobmcwhirter/smoltcp"
rev = "faf81d21daae16b650b16e59a8422a8283e8a302"
default-features = false

View File

@ -1,7 +1,5 @@
use async_io::Async; use async_io::Async;
use libc;
use log::*; use log::*;
use smoltcp::wire::EthernetFrame;
use std::io; use std::io;
use std::io::{Read, Write}; use std::io::{Read, Write};
use std::os::unix::io::{AsRawFd, RawFd}; 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_TAP: libc::c_int = 0x0002;
pub const IFF_NO_PI: libc::c_int = 0x1000; pub const IFF_NO_PI: libc::c_int = 0x1000;
const ETHERNET_HEADER_LEN: usize = 14;
#[repr(C)] #[repr(C)]
#[derive(Debug)] #[derive(Debug)]
struct ifreq { struct ifreq {
@ -85,7 +85,7 @@ impl TunTap {
// SIOCGIFMTU returns the IP MTU (typically 1500 bytes.) // 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. // 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 }) Ok(TunTap { fd, mtu })
} }

View File

@ -25,15 +25,3 @@ heapless = { version = "0.7.5", default-features = false }
nb = "1.0.0" nb = "1.0.0"
rand_core = "0.6.3" rand_core = "0.6.3"
critical-section = "0.2.3" critical-section = "0.2.3"
[dependencies.smoltcp]
git = "https://github.com/bobmcwhirter/smoltcp"
rev = "faf81d21daae16b650b16e59a8422a8283e8a302"
default-features = false
features = [
"proto-ipv4",
"socket",
"async",
"defmt",
]

View File

@ -26,16 +26,4 @@ futures = { version = "0.3.17", default-features = false, features = ["async-awa
heapless = { version = "0.7.5", default-features = false } heapless = { version = "0.7.5", default-features = false }
rand_core = "0.6.3" rand_core = "0.6.3"
critical-section = "0.2.5" critical-section = "0.2.5"
micromath = "2.0.0" micromath = "2.0.0"
[dependencies.smoltcp]
git = "https://github.com/bobmcwhirter/smoltcp"
rev = "faf81d21daae16b650b16e59a8422a8283e8a302"
default-features = false
features = [
"proto-ipv4",
"socket",
"async",
"defmt",
]