diff --git a/ethox-iperf/bin/main.rs b/ethox-iperf/bin/main.rs index c3a3d46..771d4a5 100644 --- a/ethox-iperf/bin/main.rs +++ b/ethox-iperf/bin/main.rs @@ -26,10 +26,12 @@ fn main() { let mut neighbors = [arp::Neighbor::default(); 1]; let mut routes = [ip::Route::new_ipv4_gateway(config.gateway.address()); 1]; + let neighbors = arp::NeighborCache::new(&mut neighbors[..]); + let mut ip = ip::Endpoint::new( Slice::One(config.host.into()), ip::Routes::import(List::new_full(routes.as_mut().into())), - arp::NeighborCache::new(&mut neighbors[..])); + arp::Endpoint::new(neighbors)); println!("[+] Configured layers, communicating"); diff --git a/ethox/examples/arp_tap.rs b/ethox/examples/arp_tap.rs index 00792d1..6689a7a 100644 --- a/ethox/examples/arp_tap.rs +++ b/ethox/examples/arp_tap.rs @@ -51,7 +51,7 @@ fn main() { let neighbors = { let mut eth_cache = arp::NeighborCache::new(&mut neighbors[..]); eth_cache.fill(gateway.address().into(), gatemac, None).unwrap(); - eth_cache + arp::Endpoint::new(eth_cache) }; let mut ip = [ip::Route::new_ipv4_gateway(gateway.address()); 1]; let routes = ip::Routes::import(List::new_full(ip.as_mut().into())); diff --git a/ethox/examples/curl.rs b/ethox/examples/curl.rs index 6ca40eb..19c91d6 100644 --- a/ethox/examples/curl.rs +++ b/ethox/examples/curl.rs @@ -26,9 +26,10 @@ fn main() { let mut neighbors = [arp::Neighbor::default(); 1]; // Buffer space for routes, we only have a single state one. let mut routes = [ip::Route::new_ipv4_gateway(gateway.address()); 1]; + let neighbors = arp::NeighborCache::new(&mut neighbors[..]); let mut ip = ip::Endpoint::new(Slice::One(host.into()), ip::Routes::import(List::new_full(routes.as_mut().into())), - arp::NeighborCache::new(&mut neighbors[..])); + arp::Endpoint::new(neighbors)); let mut tcp = tcp::Endpoint::new( Map::Pairs(List::new(Slice::One(Default::default()))), diff --git a/ethox/examples/ping_tap.rs b/ethox/examples/ping_tap.rs index 574215d..c047e02 100644 --- a/ethox/examples/ping_tap.rs +++ b/ethox/examples/ping_tap.rs @@ -45,11 +45,12 @@ fn main() { let mut neighbors = [arp::Neighbor::default(); 1]; let mut routes = [ip::Route::new_ipv4_gateway(gateway.address()); 1]; + let neighbors = arp::NeighborCache::new(&mut neighbors[..]); let mut ip = ip::Endpoint::new(Slice::One(host.into()), // Prefill the routes ip::Routes::import(List::new_full(routes.as_mut().into())), // But do automatic arp - arp::NeighborCache::new(&mut neighbors[..])); + arp::Endpoint::new(neighbors)); let mut icmp = icmp::Endpoint::new(); diff --git a/ethox/src/layer/arp/tests.rs b/ethox/src/layer/arp/tests.rs index 80496df..e1c520b 100644 --- a/ethox/src/layer/arp/tests.rs +++ b/ethox/src/layer/arp/tests.rs @@ -17,10 +17,14 @@ fn simple_arp() { // No prior ARP cache entries needed. let mut neighbors = [arp_layer::Neighbor::default(); 1]; let mut routes = [ip_layer::Route::unspecified(); 2]; - let mut ip = ip_layer::Endpoint::new(ip::Cidr::new(IP_ADDR_HOST.into(), 24), + let arp = arp_layer::Endpoint::new( + arp_layer::NeighborCache::new(Slice::empty())); + let mut ip = ip_layer::Endpoint::new( + ip::Cidr::new(IP_ADDR_HOST.into(), 24), // No routes necessary for local link. ip_layer::Routes::new(&mut routes[..]), - arp_layer::NeighborCache::new(Slice::empty())); + arp, + ); let mut arp = arp_layer::Endpoint::new(arp_layer::NeighborCache::new(&mut neighbors[..])); diff --git a/ethox/src/layer/eth/mod.rs b/ethox/src/layer/eth/mod.rs index 864ade8..fe58fd5 100644 --- a/ethox/src/layer/eth/mod.rs +++ b/ethox/src/layer/eth/mod.rs @@ -61,6 +61,7 @@ impl Recv

for Formatter { } } +#[cfg(feature = "std")] impl Recv

for pretty_print::FormatWith where I: Recv

{ @@ -71,6 +72,7 @@ impl Recv

for pretty_print::FormatWith } } +#[cfg(feature = "std")] impl Send

for pretty_print::FormatWith where I: Send

{ diff --git a/ethox/src/layer/icmp/tests.rs b/ethox/src/layer/icmp/tests.rs index dfc4f43..618b9e0 100644 --- a/ethox/src/layer/icmp/tests.rs +++ b/ethox/src/layer/icmp/tests.rs @@ -31,7 +31,7 @@ fn answer_ping() { let neighbors = { let mut eth_cache = arp::NeighborCache::new(&mut neighbors[..]); eth_cache.fill(IP_ADDR_OTHER.into(), MAC_ADDR_OTHER, None).unwrap(); - eth_cache + arp::Endpoint::new(eth_cache) }; let mut ip = [ip::Route::unspecified(); 2]; let mut ip = ip::Endpoint::new(Cidr::new(IP_ADDR_HOST.into(), 24), @@ -72,7 +72,7 @@ fn queue_ping(nic: &mut Loopback>) { let neighbors = { let mut eth_cache = arp::NeighborCache::new(&mut neighbors[..]); eth_cache.fill(IP_ADDR_HOST.into(), MAC_ADDR_HOST, None).unwrap(); - eth_cache + arp::Endpoint::new(eth_cache) }; let mut ip = ip::Endpoint::new( Cidr::new(IP_ADDR_OTHER.into(), 24), diff --git a/ethox/src/layer/ip/tests.rs b/ethox/src/layer/ip/tests.rs index de66688..a7fa4be 100644 --- a/ethox/src/layer/ip/tests.rs +++ b/ethox/src/layer/ip/tests.rs @@ -34,7 +34,7 @@ fn simple_ipv4() { let neighbors = { let mut eth_cache = arp::NeighborCache::new(&mut neighbors[..]); eth_cache.fill(IP_ADDR_DST.into(), MAC_ADDR_DST, None).unwrap(); - eth_cache + arp::Endpoint::new(eth_cache) }; let mut ip = [ip::Route::unspecified(); 2]; let mut ip = ip::Endpoint::new(Cidr::new(IP_ADDR_SRC.into(), 24), @@ -82,7 +82,7 @@ fn simple_ipv6() { let neighbors = { let mut eth_cache = arp::NeighborCache::new(&mut neighbors[..]); eth_cache.fill(IP_ADDR_DST.into(), MAC_ADDR_DST, None).unwrap(); - eth_cache + arp::Endpoint::new(eth_cache) }; let mut ip = [ip::Route::unspecified(); 2]; let mut ip = ip::Endpoint::new(Cidr::new(IP_ADDR_SRC.into(), 24), diff --git a/ethox/src/layer/udp/tests.rs b/ethox/src/layer/udp/tests.rs index ea6a4ec..6da404d 100644 --- a/ethox/src/layer/udp/tests.rs +++ b/ethox/src/layer/udp/tests.rs @@ -50,7 +50,7 @@ fn simple() { let neighbors = { let mut eth_cache = arp::NeighborCache::new(&mut neighbors[..]); eth_cache.fill(IP_ADDR_DST.into(), MAC_ADDR_DST, None).unwrap(); - eth_cache + arp::Endpoint::new(eth_cache) }; let mut ip = [ip::Route::unspecified(); 2]; let mut ip = ip::Endpoint::new(Cidr::new(IP_ADDR_SRC.into(), 24), diff --git a/ethox/src/nic/mod.rs b/ethox/src/nic/mod.rs index f93a07b..ed24e58 100644 --- a/ethox/src/nic/mod.rs +++ b/ethox/src/nic/mod.rs @@ -212,6 +212,7 @@ impl Recv for Formatter Recv for FormatWith where I: Recv { @@ -223,6 +224,7 @@ impl Recv for FormatWith Send for FormatWith where I: Send { diff --git a/ethox/src/wire/ipv6.rs b/ethox/src/wire/ipv6.rs index 8df615a..c91f806 100644 --- a/ethox/src/wire/ipv6.rs +++ b/ethox/src/wire/ipv6.rs @@ -1154,7 +1154,7 @@ mod test { } #[test] - #[should_panic(expected = "destination and source slices have different lengths")] + #[should_panic(expected = "does not match destination slice length")] fn test_from_bytes_too_long() { let _ = Address::from_bytes(&[0u8; 15]); }