Skip to content

Commit

Permalink
Merge pull request #41 from HeroicKatora/2024-02-20-fixes-for-ci
Browse files Browse the repository at this point in the history
Fix CI
  • Loading branch information
HeroicKatora authored Apr 12, 2024
2 parents af71366 + 8d76575 commit dbe5d40
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 12 deletions.
4 changes: 3 additions & 1 deletion ethox-iperf/bin/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down
2 changes: 1 addition & 1 deletion ethox/examples/arp_tap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()));
Expand Down
3 changes: 2 additions & 1 deletion ethox/examples/curl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()))),
Expand Down
3 changes: 2 additions & 1 deletion ethox/examples/ping_tap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
8 changes: 6 additions & 2 deletions ethox/src/layer/arp/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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[..]));

Expand Down
2 changes: 2 additions & 0 deletions ethox/src/layer/eth/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ impl<P: Payload> Recv<P> for Formatter<ethernet::frame> {
}
}

#[cfg(feature = "std")]
impl<P: Payload, I> Recv<P> for pretty_print::FormatWith<I, ethernet::frame>
where I: Recv<P>
{
Expand All @@ -71,6 +72,7 @@ impl<P: Payload, I> Recv<P> for pretty_print::FormatWith<I, ethernet::frame>
}
}

#[cfg(feature = "std")]
impl<P: Payload, I> Send<P> for pretty_print::FormatWith<I, ethernet::frame>
where I: Send<P>
{
Expand Down
4 changes: 2 additions & 2 deletions ethox/src/layer/icmp/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -72,7 +72,7 @@ fn queue_ping(nic: &mut Loopback<Vec<u8>>) {
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),
Expand Down
4 changes: 2 additions & 2 deletions ethox/src/layer/ip/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion ethox/src/layer/udp/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
2 changes: 2 additions & 0 deletions ethox/src/nic/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ impl<H: Handle + ?Sized, P: Payload + ?Sized> Recv<H, P> for Formatter<ethernet:
}
}

#[cfg(feature = "std")]
impl<I, H: Handle + ?Sized, P: Payload + ?Sized> Recv<H, P> for FormatWith<I, ethernet::frame>
where I: Recv<H, P>
{
Expand All @@ -223,6 +224,7 @@ impl<I, H: Handle + ?Sized, P: Payload + ?Sized> Recv<H, P> for FormatWith<I, et
}
}

#[cfg(feature = "std")]
impl<I, H: Handle + ?Sized, P: Payload + ?Sized> Send<H, P> for FormatWith<I, ethernet::frame>
where I: Send<H, P>
{
Expand Down
2 changes: 1 addition & 1 deletion ethox/src/wire/ipv6.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
}
Expand Down

0 comments on commit dbe5d40

Please sign in to comment.